@@ -56,8 +56,8 @@ discard block  | 
                                                    ||
| 56 | 56 |  $cancel     = GETPOST('cancel', 'alpha'); | 
                                                        
| 57 | 57 |  $toselect   = GETPOST('toselect', 'array'); | 
                                                        
| 58 | 58 |  $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search | 
                                                        
| 59 | -$backtopage = GETPOST('backtopage', 'alpha');					// if not set, a default page will be used | 
                                                        |
| 60 | -$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used | 
                                                        |
| 59 | +$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used | 
                                                        |
| 60 | +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used | 
                                                        |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 |  $id = (GETPOSTINT('facid') ? GETPOSTINT('facid') : GETPOSTINT('id')); | 
                                                        
@@ -812,7 +812,7 @@ discard block  | 
                                                    ||
| 812 | 812 | // Define special_code for special lines  | 
                                                        
| 813 | 813 |  		$special_code = GETPOSTINT('special_code'); | 
                                                        
| 814 | 814 |  		if ($special_code == 3) { | 
                                                        
| 815 | - $special_code = 0; // Options should not exists on invoices  | 
                                                        |
| 815 | + $special_code = 0; // Options should not exists on invoices  | 
                                                        |
| 816 | 816 | }  | 
                                                        
| 817 | 817 | |
| 818 | 818 | /*$line = new FactureLigne($db);  | 
                                                        
@@ -1695,10 +1695,10 @@ discard block  | 
                                                    ||
| 1695 | 1695 | |
| 1696 | 1696 | // Lines  | 
                                                        
| 1697 | 1697 |  		print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOSTINT('lineid')).'" method="POST">'; | 
                                                        
| 1698 | - print '<input type="hidden" name="token" value="' . newToken().'">';  | 
                                                        |
| 1699 | - print '<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">';  | 
                                                        |
| 1698 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1699 | + print '<input type="hidden" name="action" value="'.(($action != 'editline') ? 'addline' : 'updateline').'">';  | 
                                                        |
| 1700 | 1700 | print '<input type="hidden" name="mode" value="">';  | 
                                                        
| 1701 | - print '<input type="hidden" name="id" value="' . $object->id.'">';  | 
                                                        |
| 1701 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 1702 | 1702 | print '<input type="hidden" name="page_y" value="">';  | 
                                                        
| 1703 | 1703 | |
| 1704 | 1704 |  		if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { | 
                                                        
@@ -1753,16 +1753,16 @@ discard block  | 
                                                    ||
| 1753 | 1753 |  			if (empty($object->suspended)) { | 
                                                        
| 1754 | 1754 |  				if ($user->hasRight('facture', 'creer')) { | 
                                                        
| 1755 | 1755 |  					if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { | 
                                                        
| 1756 | -						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1756 | +						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1757 | 1757 |  					} else { | 
                                                        
| 1758 | 1758 |  						if (empty($object->frequency) || $object->date_when <= $nowlasthour) { | 
                                                        
| 1759 | -							print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1759 | +							print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1760 | 1760 |  						} else { | 
                                                        
| 1761 | -							print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1761 | +							print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1762 | 1762 | }  | 
                                                        
| 1763 | 1763 | }  | 
                                                        
| 1764 | 1764 |  				} else { | 
                                                        
| 1765 | -					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1765 | +					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1766 | 1766 | }  | 
                                                        
| 1767 | 1767 | }  | 
                                                        
| 1768 | 1768 | |
@@ -1775,7 +1775,7 @@ discard block  | 
                                                    ||
| 1775 | 1775 | }  | 
                                                        
| 1776 | 1776 | |
| 1777 | 1777 | // Delete  | 
                                                        
| 1778 | -			print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete&token=' . newToken(), 'delete', $user->hasRight('facture', 'supprimer')); | 
                                                        |
| 1778 | +			print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->hasRight('facture', 'supprimer')); | 
                                                        |
| 1779 | 1779 | }  | 
                                                        
| 1780 | 1780 | print '</div>';  | 
                                                        
| 1781 | 1781 | |
@@ -223,7 +223,7 @@ discard block  | 
                                                    ||
| 223 | 223 |  		if (getDolGlobalString('HOLIDAY_ADDON')) { | 
                                                        
| 224 | 224 | $mybool = false;  | 
                                                        
| 225 | 225 | |
| 226 | -			$file = getDolGlobalString('HOLIDAY_ADDON') . ".php"; | 
                                                        |
| 226 | +			$file = getDolGlobalString('HOLIDAY_ADDON').".php"; | 
                                                        |
| 227 | 227 |  			$classname = getDolGlobalString('HOLIDAY_ADDON'); | 
                                                        
| 228 | 228 | |
| 229 | 229 | // Include file with class  | 
                                                        
@@ -452,7 +452,7 @@ discard block  | 
                                                    ||
| 452 | 452 | $this->date_fin_gmt = $this->db->jdate($obj->date_fin, 1);  | 
                                                        
| 453 | 453 | $this->halfday = $obj->halfday;  | 
                                                        
| 454 | 454 | $this->status = $obj->status;  | 
                                                        
| 455 | - $this->statut = $obj->status; // deprecated  | 
                                                        |
| 455 | + $this->statut = $obj->status; // deprecated  | 
                                                        |
| 456 | 456 | $this->fk_validator = $obj->fk_validator;  | 
                                                        
| 457 | 457 | $this->date_valid = $this->db->jdate($obj->date_valid);  | 
                                                        
| 458 | 458 | $this->fk_user_valid = $obj->fk_user_valid;  | 
                                                        
@@ -817,8 +817,8 @@ discard block  | 
                                                    ||
| 817 | 817 | // Rename directory if dir was a temporary ref  | 
                                                        
| 818 | 818 |  			if (preg_match('/^[\(]?PROV/i', $this->ref)) { | 
                                                        
| 819 | 819 | // Now we rename also files into index  | 
                                                        
| 820 | -				$sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'holiday/" . $this->db->escape($this->newref) . "'"; | 
                                                        |
| 821 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'holiday/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity);  | 
                                                        |
| 820 | +				$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'holiday/".$this->db->escape($this->newref)."'"; | 
                                                        |
| 821 | + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'holiday/".$this->db->escape($this->ref)."' and entity = ".((int) $conf->entity);  | 
                                                        |
| 822 | 822 | $resql = $this->db->query($sql);  | 
                                                        
| 823 | 823 |  				if (!$resql) { | 
                                                        
| 824 | 824 | $error++;  | 
                                                        
@@ -835,19 +835,19 @@ discard block  | 
                                                    ||
| 835 | 835 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments  | 
                                                        
| 836 | 836 | $oldref = dol_sanitizeFileName($this->ref);  | 
                                                        
| 837 | 837 | $newref = dol_sanitizeFileName($num);  | 
                                                        
| 838 | - $dirsource = $conf->holiday->multidir_output[$this->entity] . '/' . $oldref;  | 
                                                        |
| 839 | - $dirdest = $conf->holiday->multidir_output[$this->entity] . '/' . $newref;  | 
                                                        |
| 838 | + $dirsource = $conf->holiday->multidir_output[$this->entity].'/'.$oldref;  | 
                                                        |
| 839 | + $dirdest = $conf->holiday->multidir_output[$this->entity].'/'.$newref;  | 
                                                        |
| 840 | 840 |  				if (!$error && file_exists($dirsource)) { | 
                                                        
| 841 | - dol_syslog(get_class($this) . "::validate rename dir " . $dirsource . " into " . $dirdest);  | 
                                                        |
| 841 | + dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);  | 
                                                        |
| 842 | 842 |  					if (@rename($dirsource, $dirdest)) { | 
                                                        
| 843 | 843 |  						dol_syslog("Rename ok"); | 
                                                        
| 844 | 844 | // Rename docs starting with $oldref with $newref  | 
                                                        
| 845 | - $listoffiles = dol_dir_list($dirdest, 'files', 1, '^' . preg_quote($oldref, '/'));  | 
                                                        |
| 845 | + $listoffiles = dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref, '/'));  | 
                                                        |
| 846 | 846 |  						foreach ($listoffiles as $fileentry) { | 
                                                        
| 847 | 847 | $dirsource = $fileentry['name'];  | 
                                                        
| 848 | -							$dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); | 
                                                        |
| 849 | - $dirsource = $fileentry['path'] . '/' . $dirsource;  | 
                                                        |
| 850 | - $dirdest = $fileentry['path'] . '/' . $dirdest;  | 
                                                        |
| 848 | +							$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); | 
                                                        |
| 849 | + $dirsource = $fileentry['path'].'/'.$dirsource;  | 
                                                        |
| 850 | + $dirdest = $fileentry['path'].'/'.$dirdest;  | 
                                                        |
| 851 | 851 | @rename($dirsource, $dirdest);  | 
                                                        
| 852 | 852 | }  | 
                                                        
| 853 | 853 | }  | 
                                                        
@@ -1304,7 +1304,7 @@ discard block  | 
                                                    ||
| 1304 | 1304 | }  | 
                                                        
| 1305 | 1305 | |
| 1306 | 1306 | // We found a record, user is on holiday by default, so is not available is true.  | 
                                                        
| 1307 | - $isavailablemorning = true; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1307 | + $isavailablemorning = true; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1308 | 1308 |  				foreach ($arrayofrecord as $record) { | 
                                                        
| 1309 | 1309 |  					if ($timestamp == $record['date_start'] && $record['halfday'] == 2) { | 
                                                        
| 1310 | 1310 | continue;  | 
                                                        
@@ -1315,7 +1315,7 @@ discard block  | 
                                                    ||
| 1315 | 1315 | $isavailablemorning = false;  | 
                                                        
| 1316 | 1316 | break;  | 
                                                        
| 1317 | 1317 | }  | 
                                                        
| 1318 | - $isavailableafternoon = true; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1318 | + $isavailableafternoon = true; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1319 | 1319 |  				foreach ($arrayofrecord as $record) { | 
                                                        
| 1320 | 1320 |  					if ($timestamp == $record['date_end'] && $record['halfday'] == 2) { | 
                                                        
| 1321 | 1321 | continue;  | 
                                                        
@@ -1369,7 +1369,7 @@ discard block  | 
                                                    ||
| 1369 | 1369 |  			} else { | 
                                                        
| 1370 | 1370 | $labeltoshow = (($typeleaves[$this->fk_type]['code'] && $langs->trans($typeleaves[$this->fk_type]['code']) != $typeleaves[$this->fk_type]['code']) ? $langs->trans($typeleaves[$this->fk_type]['code']) : $typeleaves[$this->fk_type]['label']);  | 
                                                        
| 1371 | 1371 | }  | 
                                                        
| 1372 | -			$datas['type'] = '<br><b>'.$langs->trans("Type") . ':</b> ' . $labeltoshow; | 
                                                        |
| 1372 | +			$datas['type'] = '<br><b>'.$langs->trans("Type").':</b> '.$labeltoshow; | 
                                                        |
| 1373 | 1373 | }  | 
                                                        
| 1374 | 1374 |  		if (isset($this->halfday) && !empty($this->date_debut) && !empty($this->date_fin)) { | 
                                                        
| 1375 | 1375 | $listhalfday = array(  | 
                                                        
@@ -1378,8 +1378,8 @@ discard block  | 
                                                    ||
| 1378 | 1378 | );  | 
                                                        
| 1379 | 1379 | $starthalfday = ($this->halfday == -1 || $this->halfday == 2) ? 'afternoon' : 'morning';  | 
                                                        
| 1380 | 1380 | $endhalfday = ($this->halfday == 1 || $this->halfday == 2) ? 'morning' : 'afternoon';  | 
                                                        
| 1381 | -			$datas['date_start'] = '<br><b>'.$langs->trans('DateDebCP') . '</b>: '. dol_print_date($this->date_debut, 'day') . '  <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; | 
                                                        |
| 1382 | -			$datas['date_end'] = '<br><b>'.$langs->trans('DateFinCP') . '</b>: '. dol_print_date($this->date_fin, 'day') . '  <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; | 
                                                        |
| 1381 | +			$datas['date_start'] = '<br><b>'.$langs->trans('DateDebCP').'</b>: '.dol_print_date($this->date_debut, 'day').'  <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>'; | 
                                                        |
| 1382 | +			$datas['date_end'] = '<br><b>'.$langs->trans('DateFinCP').'</b>: '.dol_print_date($this->date_fin, 'day').'  <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>'; | 
                                                        |
| 1383 | 1383 | }  | 
                                                        
| 1384 | 1384 | |
| 1385 | 1385 | |
@@ -1460,7 +1460,7 @@ discard block  | 
                                                    ||
| 1460 | 1460 | $result .= $linkend;  | 
                                                        
| 1461 | 1461 | |
| 1462 | 1462 | global $action;  | 
                                                        
| 1463 | - $hookmanager->initHooks(array($this->element . 'dao'));  | 
                                                        |
| 1463 | + $hookmanager->initHooks(array($this->element.'dao'));  | 
                                                        |
| 1464 | 1464 |  		$parameters = array('id' => $this->id, 'getnomurl' => &$result); | 
                                                        
| 1465 | 1465 |  		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks | 
                                                        
| 1466 | 1466 |  		if ($reshook > 0) { | 
                                                        
@@ -602,11 +602,11 @@ discard block  | 
                                                    ||
| 602 | 602 | $this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array());  | 
                                                        
| 603 | 603 | $this->job = $obj->job;  | 
                                                        
| 604 | 604 | $this->signature = $obj->signature;  | 
                                                        
| 605 | - $this->admin = $obj->admin;  | 
                                                        |
| 605 | + $this->admin = $obj->admin;  | 
                                                        |
| 606 | 606 | $this->note_public = $obj->note_public;  | 
                                                        
| 607 | 607 | $this->note_private = $obj->note_private;  | 
                                                        
| 608 | 608 | |
| 609 | - $this->statut = $obj->status; // deprecated  | 
                                                        |
| 609 | + $this->statut = $obj->status; // deprecated  | 
                                                        |
| 610 | 610 | $this->status = $obj->status;  | 
                                                        
| 611 | 611 | |
| 612 | 612 | $this->photo = $obj->photo;  | 
                                                        
@@ -735,7 +735,7 @@ discard block  | 
                                                    ||
| 735 | 735 | require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';  | 
                                                        
| 736 | 736 | |
| 737 | 737 | $defaultValues = new DefaultValues($this->db);  | 
                                                        
| 738 | -			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,'.$this->id.') AND (entity:in:'.(isset($this->entity) ? $this->entity : $conf->entity).','.$conf->entity.')');	// User 0 (all) + me (if defined) | 
                                                        |
| 738 | +			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,'.$this->id.') AND (entity:in:'.(isset($this->entity) ? $this->entity : $conf->entity).','.$conf->entity.')'); // User 0 (all) + me (if defined) | 
                                                        |
| 739 | 739 |  			//$result = $defaultValues->fetchAll('', '', 0, 0, array('t.user_id'=>array(0, $this->id), 'entity'=>array((isset($this->entity) ? $this->entity : $conf->entity), $conf->entity)));	// User 0 (all) + me (if defined) | 
                                                        
| 740 | 740 | |
| 741 | 741 |  			if (!is_array($result) && $result < 0) { | 
                                                        
@@ -849,7 +849,7 @@ discard block  | 
                                                    ||
| 849 | 849 | // Special case for external user  | 
                                                        
| 850 | 850 |  		if (!empty($this->socid)) { | 
                                                        
| 851 | 851 |  			if ($module = 'societe' && $permlevel1 = 'client' && $permlevel2 == 'voir') { | 
                                                        
| 852 | - return 0; // An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)  | 
                                                        |
| 852 | + return 0; // An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)  | 
                                                        |
| 853 | 853 | }  | 
                                                        
| 854 | 854 | }  | 
                                                        
| 855 | 855 | |
@@ -997,7 +997,7 @@ discard block  | 
                                                    ||
| 997 | 997 | $sql .= " FROM ".$this->db->prefix()."rights_def";  | 
                                                        
| 998 | 998 | $sql .= " WHERE entity = ".((int) $entity);  | 
                                                        
| 999 | 999 |  			if (!empty($whereforadd) && $whereforadd != 'allmodules') { | 
                                                        
| 1000 | -				$sql .= " AND (".$whereforadd.")";	// Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized | 
                                                        |
| 1000 | +				$sql .= " AND (".$whereforadd.")"; // Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized | 
                                                        |
| 1001 | 1001 | }  | 
                                                        
| 1002 | 1002 | |
| 1003 | 1003 | $sqldelete = "DELETE FROM ".$this->db->prefix()."user_rights";  | 
                                                        
@@ -1133,7 +1133,7 @@ discard block  | 
                                                    ||
| 1133 | 1133 | $sql .= " FROM ".$this->db->prefix()."rights_def";  | 
                                                        
| 1134 | 1134 | $sql .= " WHERE entity = ".((int) $entity);  | 
                                                        
| 1135 | 1135 |  			if (!empty($wherefordel) && $wherefordel != 'allmodules') { | 
                                                        
| 1136 | -				$sql .= " AND (".$wherefordel.")";	// Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized | 
                                                        |
| 1136 | +				$sql .= " AND (".$wherefordel.")"; // Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized | 
                                                        |
| 1137 | 1137 | }  | 
                                                        
| 1138 | 1138 | |
| 1139 | 1139 | // avoid admin can remove his own important rights  | 
                                                        
@@ -1307,12 +1307,12 @@ discard block  | 
                                                    ||
| 1307 | 1307 | $sql .= " AND r.entity = ".((int) $conf->entity);  | 
                                                        
| 1308 | 1308 | }  | 
                                                        
| 1309 | 1309 |  			} else { | 
                                                        
| 1310 | - $sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity  | 
                                                        |
| 1310 | + $sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity  | 
                                                        |
| 1311 | 1311 | // The entity on the table usergroup_user should be useless and should never be used because it is already into gr and r.  | 
                                                        
| 1312 | 1312 | // but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of  | 
                                                        
| 1313 | 1313 | // other entities, so we are forced to add a filter here  | 
                                                        
| 1314 | 1314 | $sql .= " AND gu.entity IN (0,".$conf->entity.")";  | 
                                                        
| 1315 | - $sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity  | 
                                                        |
| 1315 | + $sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity  | 
                                                        |
| 1316 | 1316 | }  | 
                                                        
| 1317 | 1317 | // End of strange business rule  | 
                                                        
| 1318 | 1318 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup";  | 
                                                        
@@ -1846,7 +1846,7 @@ discard block  | 
                                                    ||
| 1846 | 1846 | $this->civility_code = $member->civility_code;  | 
                                                        
| 1847 | 1847 | $this->lastname = $member->lastname;  | 
                                                        
| 1848 | 1848 | $this->firstname = $member->firstname;  | 
                                                        
| 1849 | - $this->gender = $member->gender;  | 
                                                        |
| 1849 | + $this->gender = $member->gender;  | 
                                                        |
| 1850 | 1850 | $this->email = $member->email;  | 
                                                        
| 1851 | 1851 | $this->fk_member = $member->id;  | 
                                                        
| 1852 | 1852 | $this->address = $member->address;  | 
                                                        
@@ -1984,44 +1984,44 @@ discard block  | 
                                                    ||
| 1984 | 1984 | $this->lastname = trim((string) $this->lastname);  | 
                                                        
| 1985 | 1985 | $this->firstname = trim((string) $this->firstname);  | 
                                                        
| 1986 | 1986 | $this->ref_employee = trim((string) $this->ref_employee);  | 
                                                        
| 1987 | - $this->national_registration_number = trim((string) $this->national_registration_number);  | 
                                                        |
| 1987 | + $this->national_registration_number = trim((string) $this->national_registration_number);  | 
                                                        |
| 1988 | 1988 | $this->employee = ($this->employee > 0 ? $this->employee : 0);  | 
                                                        
| 1989 | 1989 | $this->login = trim((string) $this->login);  | 
                                                        
| 1990 | - $this->gender = trim((string) $this->gender);  | 
                                                        |
| 1990 | + $this->gender = trim((string) $this->gender);  | 
                                                        |
| 1991 | 1991 | |
| 1992 | 1992 | $this->pass = trim((string) $this->pass);  | 
                                                        
| 1993 | - $this->api_key = trim((string) $this->api_key);  | 
                                                        |
| 1994 | - $this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity;  | 
                                                        |
| 1995 | - $this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity;  | 
                                                        |
| 1993 | + $this->api_key = trim((string) $this->api_key);  | 
                                                        |
| 1994 | + $this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity;  | 
                                                        |
| 1995 | + $this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity;  | 
                                                        |
| 1996 | 1996 | |
| 1997 | - $this->address = trim((string) $this->address);  | 
                                                        |
| 1998 | - $this->zip = trim((string) $this->zip);  | 
                                                        |
| 1999 | - $this->town = trim((string) $this->town);  | 
                                                        |
| 1997 | + $this->address = trim((string) $this->address);  | 
                                                        |
| 1998 | + $this->zip = trim((string) $this->zip);  | 
                                                        |
| 1999 | + $this->town = trim((string) $this->town);  | 
                                                        |
| 2000 | 2000 | |
| 2001 | - $this->state_id = ($this->state_id > 0 ? $this->state_id : 0);  | 
                                                        |
| 2001 | + $this->state_id = ($this->state_id > 0 ? $this->state_id : 0);  | 
                                                        |
| 2002 | 2002 | $this->country_id = ($this->country_id > 0 ? $this->country_id : 0);  | 
                                                        
| 2003 | - $this->office_phone = trim((string) $this->office_phone);  | 
                                                        |
| 2003 | + $this->office_phone = trim((string) $this->office_phone);  | 
                                                        |
| 2004 | 2004 | $this->office_fax = trim((string) $this->office_fax);  | 
                                                        
| 2005 | - $this->user_mobile = trim((string) $this->user_mobile);  | 
                                                        |
| 2006 | - $this->personal_mobile = trim((string) $this->personal_mobile);  | 
                                                        |
| 2007 | - $this->email = trim((string) $this->email);  | 
                                                        |
| 2008 | - $this->personal_email = trim((string) $this->personal_email);  | 
                                                        |
| 2009 | -  | 
                                                        |
| 2010 | - $this->job = trim((string) $this->job);  | 
                                                        |
| 2011 | - $this->signature = trim((string) $this->signature);  | 
                                                        |
| 2012 | - $this->note_public = trim((string) $this->note_public);  | 
                                                        |
| 2013 | - $this->note_private = trim((string) $this->note_private);  | 
                                                        |
| 2014 | - $this->openid = trim((string) $this->openid);  | 
                                                        |
| 2005 | + $this->user_mobile = trim((string) $this->user_mobile);  | 
                                                        |
| 2006 | + $this->personal_mobile = trim((string) $this->personal_mobile);  | 
                                                        |
| 2007 | + $this->email = trim((string) $this->email);  | 
                                                        |
| 2008 | + $this->personal_email = trim((string) $this->personal_email);  | 
                                                        |
| 2009 | +  | 
                                                        |
| 2010 | + $this->job = trim((string) $this->job);  | 
                                                        |
| 2011 | + $this->signature = trim((string) $this->signature);  | 
                                                        |
| 2012 | + $this->note_public = trim((string) $this->note_public);  | 
                                                        |
| 2013 | + $this->note_private = trim((string) $this->note_private);  | 
                                                        |
| 2014 | + $this->openid = trim((string) $this->openid);  | 
                                                        |
| 2015 | 2015 | $this->admin = ($this->admin > 0 ? $this->admin : 0);  | 
                                                        
| 2016 | 2016 | |
| 2017 | 2017 | $this->accountancy_code = trim((string) $this->accountancy_code);  | 
                                                        
| 2018 | 2018 | $this->color = trim((string) $this->color);  | 
                                                        
| 2019 | - $this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;  | 
                                                        |
| 2019 | + $this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;  | 
                                                        |
| 2020 | 2020 | $this->dateemploymentend = empty($this->dateemploymentend) ? '' : $this->dateemploymentend;  | 
                                                        
| 2021 | 2021 | |
| 2022 | - $this->birth = empty($this->birth) ? '' : $this->birth;  | 
                                                        |
| 2023 | - $this->fk_warehouse = (int) $this->fk_warehouse;  | 
                                                        |
| 2024 | - $this->fk_establishment = (int) $this->fk_establishment;  | 
                                                        |
| 2022 | + $this->birth = empty($this->birth) ? '' : $this->birth;  | 
                                                        |
| 2023 | + $this->fk_warehouse = (int) $this->fk_warehouse;  | 
                                                        |
| 2024 | + $this->fk_establishment = (int) $this->fk_establishment;  | 
                                                        |
| 2025 | 2025 | |
| 2026 | 2026 | $this->setUpperOrLowerCase();  | 
                                                        
| 2027 | 2027 | |
@@ -2776,7 +2776,7 @@ discard block  | 
                                                    ||
| 2776 | 2776 | $sql .= " WHERE fk_user = ".((int) $this->id);  | 
                                                        
| 2777 | 2777 | $sql .= " AND fk_usergroup = ".((int) $group);  | 
                                                        
| 2778 | 2778 |  		if (empty($entity)) { | 
                                                        
| 2779 | - $sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1.  | 
                                                        |
| 2779 | + $sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1.  | 
                                                        |
| 2780 | 2780 |  		} else { | 
                                                        
| 2781 | 2781 | $sql .= " AND entity = ".((int) $entity);  | 
                                                        
| 2782 | 2782 | }  | 
                                                        
@@ -3038,7 +3038,7 @@ discard block  | 
                                                    ||
| 3038 | 3038 | $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';  | 
                                                        
| 3039 | 3039 | }  | 
                                                        
| 3040 | 3040 | $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');  | 
                                                        
| 3041 | - $linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';  | 
                                                        |
| 3041 | + $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';  | 
                                                        |
| 3042 | 3042 |  		} else { | 
                                                        
| 3043 | 3043 | $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');  | 
                                                        
| 3044 | 3044 | }  | 
                                                        
@@ -3118,7 +3118,7 @@ discard block  | 
                                                    ||
| 3118 | 3118 | |
| 3119 | 3119 |  		if ($option == 'xxx') { | 
                                                        
| 3120 | 3120 | $linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">';  | 
                                                        
| 3121 | - $linkend = '</a>'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 3121 | + $linkend = '</a>'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 3122 | 3122 | }  | 
                                                        
| 3123 | 3123 | |
| 3124 | 3124 |  		if ($option == 'nolink') { | 
                                                        
@@ -3277,11 +3277,11 @@ discard block  | 
                                                    ||
| 3277 | 3277 | global $conf;  | 
                                                        
| 3278 | 3278 | $dn = '';  | 
                                                        
| 3279 | 3279 |  		if ($mode == 0) { | 
                                                        
| 3280 | -			$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')]."," . getDolGlobalString('LDAP_USER_DN'); | 
                                                        |
| 3280 | +			$dn = getDolGlobalString('LDAP_KEY_USERS')."=".$info[getDolGlobalString('LDAP_KEY_USERS')].",".getDolGlobalString('LDAP_USER_DN'); | 
                                                        |
| 3281 | 3281 |  		} elseif ($mode == 1) { | 
                                                        
| 3282 | 3282 |  			$dn = getDolGlobalString('LDAP_USER_DN'); | 
                                                        
| 3283 | 3283 |  		} elseif ($mode == 2) { | 
                                                        
| 3284 | -			$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')]; | 
                                                        |
| 3284 | +			$dn = getDolGlobalString('LDAP_KEY_USERS')."=".$info[getDolGlobalString('LDAP_KEY_USERS')]; | 
                                                        |
| 3285 | 3285 | }  | 
                                                        
| 3286 | 3286 | return $dn;  | 
                                                        
| 3287 | 3287 | }  | 
                                                        
@@ -3496,7 +3496,7 @@ discard block  | 
                                                    ||
| 3496 | 3496 | $this->iplastlogin = '127.0.0.1';  | 
                                                        
| 3497 | 3497 | $this->datepreviouslogin = $now;  | 
                                                        
| 3498 | 3498 | $this->ippreviouslogin = '127.0.0.1';  | 
                                                        
| 3499 | - $this->statut = 1; // deprecated  | 
                                                        |
| 3499 | + $this->statut = 1; // deprecated  | 
                                                        |
| 3500 | 3500 | $this->status = 1;  | 
                                                        
| 3501 | 3501 | |
| 3502 | 3502 | $this->entity = 1;  | 
                                                        
@@ -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 wysiwig 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' : $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? 0 : $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? '20' : $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));  | 
                                                        
| 321 | 321 | $ret .= $doleditor->Create(1);  | 
                                                        
| 322 | 322 |  				} elseif ($typeofdata == 'asis') { | 
                                                        
@@ -331,19 +331,19 @@ discard block  | 
                                                    ||
| 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: 3px;';  | 
                                                        
| 663 | 663 | }  | 
                                                        
| 664 | 664 |  		if ($direction > 0) { | 
                                                        
| 665 | - $extracss = ($extracss ? $extracss . ' ' : '') . ($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 665 | + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : '');  | 
                                                        |
| 666 | 666 | $extrastyle = 'padding: 0px; padding-right: 3px;';  | 
                                                        
| 667 | 667 | }  | 
                                                        
| 668 | 668 | |
@@ -675,53 +675,53 @@ discard block  | 
                                                    ||
| 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 | }  | 
                                                        
@@ -1342,12 +1342,12 @@ discard block  | 
                                                    ||
| 1342 | 1342 | $ajaxoptions = array();  | 
                                                        
| 1343 | 1343 | }  | 
                                                        
| 1344 | 1344 | |
| 1345 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1345 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1346 | 1346 | |
| 1347 | 1347 | // No immediate load of all database  | 
                                                        
| 1348 | 1348 | $placeholder = '';  | 
                                                        
| 1349 | 1349 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 1350 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 1350 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 1351 | 1351 | $societetmp = new Societe($this->db);  | 
                                                        
| 1352 | 1352 | $societetmp->fetch($selected);  | 
                                                        
| 1353 | 1353 | $selected_input_value = $societetmp->name;  | 
                                                        
@@ -1355,25 +1355,25 @@ discard block  | 
                                                    ||
| 1355 | 1355 | }  | 
                                                        
| 1356 | 1356 | |
| 1357 | 1357 | // mode 1  | 
                                                        
| 1358 | -			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($excludeids) ? '' : '&excludeids=' . implode(',', $excludeids)) . ($showtype ? '&showtype=' . urlencode((string) ($showtype)) : '') . ($showcode ? '&showcode=' . urlencode((string) ($showcode)) : ''); | 
                                                        |
| 1358 | +			$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 | 1359 | |
| 1360 | 1360 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 1361 | 1361 |  			if (empty($hidelabel)) { | 
                                                        
| 1362 | -				print $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 1362 | +				print $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 1363 | 1363 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 1364 | 1364 |  				$placeholder = $langs->trans("RefOrLabel"); | 
                                                        
| 1365 | 1365 |  				if ($hidelabel == 2) { | 
                                                        
| 1366 | 1366 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1367 | 1367 | }  | 
                                                        
| 1368 | 1368 | }  | 
                                                        
| 1369 | -			$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' : '') . ' />'; | 
                                                        |
| 1369 | +			$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 | 1370 |  			if ($hidelabel == 3) { | 
                                                        
| 1371 | 1371 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1372 | 1372 | }  | 
                                                        
| 1373 | 1373 | |
| 1374 | 1374 | $out .= ajax_event($htmlname, $events);  | 
                                                        
| 1375 | 1375 | |
| 1376 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 1376 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 1377 | 1377 |  		} else { | 
                                                        
| 1378 | 1378 | // Immediate load of all database  | 
                                                        
| 1379 | 1379 | $out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode);  | 
                                                        
@@ -1458,30 +1458,30 @@ discard block  | 
                                                    ||
| 1458 | 1458 | $sql .= ", s.address, s.zip, s.town";  | 
                                                        
| 1459 | 1459 | $sql .= ", dictp.code as country_code";  | 
                                                        
| 1460 | 1460 | }  | 
                                                        
| 1461 | - $sql .= " FROM " . $this->db->prefix() . "societe as s";  | 
                                                        |
| 1461 | + $sql .= " FROM ".$this->db->prefix()."societe as s";  | 
                                                        |
| 1462 | 1462 |  		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1463 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1463 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1464 | 1464 | }  | 
                                                        
| 1465 | 1465 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1466 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 1466 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 1467 | 1467 | }  | 
                                                        
| 1468 | -		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; | 
                                                        |
| 1468 | +		$sql .= " WHERE s.entity IN (".getEntity('societe').")"; | 
                                                        |
| 1469 | 1469 |  		if (!empty($user->socid)) { | 
                                                        
| 1470 | - $sql .= " AND s.rowid = " . ((int) $user->socid);  | 
                                                        |
| 1470 | + $sql .= " AND s.rowid = ".((int) $user->socid);  | 
                                                        |
| 1471 | 1471 | }  | 
                                                        
| 1472 | 1472 |  		if ($filter) { | 
                                                        
| 1473 | 1473 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
| 1474 | 1474 | // if not, by testSqlAndScriptInject() only.  | 
                                                        
| 1475 | -			$sql .= " AND (" . $filter . ")"; | 
                                                        |
| 1475 | +			$sql .= " AND (".$filter.")"; | 
                                                        |
| 1476 | 1476 | }  | 
                                                        
| 1477 | 1477 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1478 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 1478 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 1479 | 1479 | }  | 
                                                        
| 1480 | 1480 |  		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1481 | 1481 | $sql .= " AND s.status <> 0";  | 
                                                        
| 1482 | 1482 | }  | 
                                                        
| 1483 | 1483 |  		if (!empty($excludeids)) { | 
                                                        
| 1484 | -			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; | 
                                                        |
| 1484 | +			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; | 
                                                        |
| 1485 | 1485 | }  | 
                                                        
| 1486 | 1486 | // Add where from hooks  | 
                                                        
| 1487 | 1487 | $parameters = array();  | 
                                                        
@@ -1501,17 +1501,17 @@ discard block  | 
                                                    ||
| 1501 | 1501 |  				if ($i > 0) { | 
                                                        
| 1502 | 1502 | $sql .= " AND ";  | 
                                                        
| 1503 | 1503 | }  | 
                                                        
| 1504 | - $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 1504 | + $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 1505 | 1505 | $i++;  | 
                                                        
| 1506 | 1506 | }  | 
                                                        
| 1507 | 1507 |  			if (count($search_crit) > 1) { | 
                                                        
| 1508 | 1508 | $sql .= ")";  | 
                                                        
| 1509 | 1509 | }  | 
                                                        
| 1510 | 1510 |  			if (isModEnabled('barcode')) { | 
                                                        
| 1511 | - $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1511 | + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1512 | 1512 | }  | 
                                                        
| 1513 | - $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1514 | - $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1513 | + $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1514 | + $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1515 | 1515 | $sql .= ")";  | 
                                                        
| 1516 | 1516 | }  | 
                                                        
| 1517 | 1517 |  		$sql .= $this->db->order("nom", "ASC"); | 
                                                        
@@ -1522,7 +1522,7 @@ discard block  | 
                                                    ||
| 1522 | 1522 | $resql = $this->db->query($sql);  | 
                                                        
| 1523 | 1523 |  		if ($resql) { | 
                                                        
| 1524 | 1524 | // Construct $out and $outarray  | 
                                                        
| 1525 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";  | 
                                                        |
| 1525 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";  | 
                                                        |
| 1526 | 1526 | |
| 1527 | 1527 | $textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');  | 
                                                        
| 1528 | 1528 |  			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { | 
                                                        
@@ -1535,7 +1535,7 @@ discard block  | 
                                                    ||
| 1535 | 1535 | }  | 
                                                        
| 1536 | 1536 | }  | 
                                                        
| 1537 | 1537 |  			if ($showempty) { | 
                                                        
| 1538 | -				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; | 
                                                        |
| 1538 | +				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; | 
                                                        |
| 1539 | 1539 | }  | 
                                                        
| 1540 | 1540 | |
| 1541 | 1541 | $companytemp = new Societe($this->db);  | 
                                                        
@@ -1548,18 +1548,18 @@ discard block  | 
                                                    ||
| 1548 | 1548 | $label = '';  | 
                                                        
| 1549 | 1549 |  					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { | 
                                                        
| 1550 | 1550 |  						if (($obj->client) && (!empty($obj->code_client))) { | 
                                                        
| 1551 | - $label = $obj->code_client . ' - ';  | 
                                                        |
| 1551 | + $label = $obj->code_client.' - ';  | 
                                                        |
| 1552 | 1552 | }  | 
                                                        
| 1553 | 1553 |  						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { | 
                                                        
| 1554 | - $label .= $obj->code_fournisseur . ' - ';  | 
                                                        |
| 1554 | + $label .= $obj->code_fournisseur.' - ';  | 
                                                        |
| 1555 | 1555 | }  | 
                                                        
| 1556 | - $label .= ' ' . $obj->name;  | 
                                                        |
| 1556 | + $label .= ' '.$obj->name;  | 
                                                        |
| 1557 | 1557 |  					} else { | 
                                                        
| 1558 | 1558 | $label = $obj->name;  | 
                                                        
| 1559 | 1559 | }  | 
                                                        
| 1560 | 1560 | |
| 1561 | 1561 |  					if (!empty($obj->name_alias)) { | 
                                                        
| 1562 | -						$label .= ' (' . $obj->name_alias . ')'; | 
                                                        |
| 1562 | +						$label .= ' ('.$obj->name_alias.')'; | 
                                                        |
| 1563 | 1563 | }  | 
                                                        
| 1564 | 1564 | |
| 1565 | 1565 |  					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { | 
                                                        
@@ -1574,7 +1574,7 @@ discard block  | 
                                                    ||
| 1574 | 1574 | $companytemp->fournisseur = $obj->fournisseur;  | 
                                                        
| 1575 | 1575 | $tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');  | 
                                                        
| 1576 | 1576 |  						if ($tmptype) { | 
                                                        
| 1577 | - $labelhtml .= ' ' . $tmptype;  | 
                                                        |
| 1577 | + $labelhtml .= ' '.$tmptype;  | 
                                                        |
| 1578 | 1578 | }  | 
                                                        
| 1579 | 1579 | |
| 1580 | 1580 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
@@ -1584,10 +1584,10 @@ discard block  | 
                                                    ||
| 1584 | 1584 |  							$label .= $langs->trans("Customer"); | 
                                                        
| 1585 | 1585 | }  | 
                                                        
| 1586 | 1586 |  						if ($obj->client == 2 || $obj->client == 3) { | 
                                                        
| 1587 | -							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); | 
                                                        |
| 1587 | +							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); | 
                                                        |
| 1588 | 1588 | }  | 
                                                        
| 1589 | 1589 |  						if ($obj->fournisseur) { | 
                                                        
| 1590 | -							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); | 
                                                        |
| 1590 | +							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); | 
                                                        |
| 1591 | 1591 | }  | 
                                                        
| 1592 | 1592 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
| 1593 | 1593 | $label .= ')';  | 
                                                        
@@ -1595,9 +1595,9 @@ discard block  | 
                                                    ||
| 1595 | 1595 | }  | 
                                                        
| 1596 | 1596 | |
| 1597 | 1597 |  					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1598 | - $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');  | 
                                                        |
| 1598 | + $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');  | 
                                                        |
| 1599 | 1599 |  						if (!empty($obj->country_code)) { | 
                                                        
| 1600 | -							$s .= ', ' . $langs->trans('Country' . $obj->country_code); | 
                                                        |
| 1600 | +							$s .= ', '.$langs->trans('Country'.$obj->country_code); | 
                                                        |
| 1601 | 1601 | }  | 
                                                        
| 1602 | 1602 | $label .= $s;  | 
                                                        
| 1603 | 1603 | $labelhtml .= $s;  | 
                                                        
@@ -1605,9 +1605,9 @@ discard block  | 
                                                    ||
| 1605 | 1605 | |
| 1606 | 1606 |  					if (empty($outputmode)) { | 
                                                        
| 1607 | 1607 |  						if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1608 | - $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>';  | 
                                                        |
| 1608 | + $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>';  | 
                                                        |
| 1609 | 1609 |  						} else { | 
                                                        
| 1610 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 1610 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 1611 | 1611 | }  | 
                                                        
| 1612 | 1612 |  					} else { | 
                                                        
| 1613 | 1613 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); | 
                                                        
@@ -1619,9 +1619,9 @@ discard block  | 
                                                    ||
| 1619 | 1619 | }  | 
                                                        
| 1620 | 1620 | }  | 
                                                        
| 1621 | 1621 | }  | 
                                                        
| 1622 | - $out .= '</select>' . "\n";  | 
                                                        |
| 1622 | + $out .= '</select>'."\n";  | 
                                                        |
| 1623 | 1623 |  			if (!$forcecombo) { | 
                                                        
| 1624 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1624 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1625 | 1625 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1626 | 1626 | }  | 
                                                        
| 1627 | 1627 |  		} else { | 
                                                        
@@ -1657,18 +1657,18 @@ discard block  | 
                                                    ||
| 1657 | 1657 | // On recherche les remises  | 
                                                        
| 1658 | 1658 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";  | 
                                                        
| 1659 | 1659 | $sql .= " re.description, re.fk_facture_source";  | 
                                                        
| 1660 | - $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";  | 
                                                        |
| 1661 | - $sql .= " WHERE re.fk_soc = " . (int) $socid;  | 
                                                        |
| 1662 | - $sql .= " AND re.entity = " . $conf->entity;  | 
                                                        |
| 1660 | + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";  | 
                                                        |
| 1661 | + $sql .= " WHERE re.fk_soc = ".(int) $socid;  | 
                                                        |
| 1662 | + $sql .= " AND re.entity = ".$conf->entity;  | 
                                                        |
| 1663 | 1663 |  		if ($filter) { | 
                                                        
| 1664 | - $sql .= " AND " . $filter;  | 
                                                        |
| 1664 | + $sql .= " AND ".$filter;  | 
                                                        |
| 1665 | 1665 | }  | 
                                                        
| 1666 | 1666 | $sql .= " ORDER BY re.description ASC";  | 
                                                        
| 1667 | 1667 | |
| 1668 | - dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);  | 
                                                        |
| 1668 | + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);  | 
                                                        |
| 1669 | 1669 | $resql = $this->db->query($sql);  | 
                                                        
| 1670 | 1670 |  		if ($resql) { | 
                                                        
| 1671 | - print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';  | 
                                                        |
| 1671 | + print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';  | 
                                                        |
| 1672 | 1672 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1673 | 1673 | |
| 1674 | 1674 | $qualifiedlines = $num;  | 
                                                        
@@ -1706,16 +1706,16 @@ discard block  | 
                                                    ||
| 1706 | 1706 |  					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { | 
                                                        
| 1707 | 1707 | $tmpfac = new Facture($this->db);  | 
                                                        
| 1708 | 1708 |  						if ($tmpfac->fetch($obj->fk_facture_source) > 0) { | 
                                                        
| 1709 | - $desc = $desc . ' - ' . $tmpfac->ref;  | 
                                                        |
| 1709 | + $desc = $desc.' - '.$tmpfac->ref;  | 
                                                        |
| 1710 | 1710 | }  | 
                                                        
| 1711 | 1711 | }  | 
                                                        
| 1712 | 1712 | |
| 1713 | -					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; | 
                                                        |
| 1713 | +					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; | 
                                                        |
| 1714 | 1714 | $i++;  | 
                                                        
| 1715 | 1715 | }  | 
                                                        
| 1716 | 1716 | }  | 
                                                        
| 1717 | 1717 | print '</select>';  | 
                                                        
| 1718 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 1718 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 1719 | 1719 | |
| 1720 | 1720 | return $qualifiedlines;  | 
                                                        
| 1721 | 1721 |  		} else { | 
                                                        
@@ -1796,7 +1796,7 @@ discard block  | 
                                                    ||
| 1796 | 1796 | $out = '';  | 
                                                        
| 1797 | 1797 | |
| 1798 | 1798 |  		if (!is_object($hookmanager)) { | 
                                                        
| 1799 | - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';  | 
                                                        |
| 1799 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';  | 
                                                        |
| 1800 | 1800 | $hookmanager = new HookManager($this->db);  | 
                                                        
| 1801 | 1801 | }  | 
                                                        
| 1802 | 1802 | |
@@ -1805,13 +1805,13 @@ discard block  | 
                                                    ||
| 1805 | 1805 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1806 | 1806 | $sql .= ", s.nom as company, s.town AS company_town";  | 
                                                        
| 1807 | 1807 | }  | 
                                                        
| 1808 | - $sql .= " FROM " . $this->db->prefix() . "socpeople as sp";  | 
                                                        |
| 1808 | + $sql .= " FROM ".$this->db->prefix()."socpeople as sp";  | 
                                                        |
| 1809 | 1809 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1810 | - $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1810 | + $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1811 | 1811 | }  | 
                                                        
| 1812 | -		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; | 
                                                        |
| 1812 | +		$sql .= " WHERE sp.entity IN (".getEntity('contact').")"; | 
                                                        |
| 1813 | 1813 |  		if ($socid > 0 || $socid == -1) { | 
                                                        
| 1814 | - $sql .= " AND sp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 1814 | + $sql .= " AND sp.fk_soc = ".((int) $socid);  | 
                                                        |
| 1815 | 1815 | }  | 
                                                        
| 1816 | 1816 |  		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1817 | 1817 | $sql .= " AND sp.statut <> 0";  | 
                                                        
@@ -1822,30 +1822,30 @@ discard block  | 
                                                    ||
| 1822 | 1822 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 1823 | 1823 | $sql .= " ORDER BY sp.lastname ASC";  | 
                                                        
| 1824 | 1824 | |
| 1825 | - dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1825 | + dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1826 | 1826 | $resql = $this->db->query($sql);  | 
                                                        
| 1827 | 1827 |  		if ($resql) { | 
                                                        
| 1828 | 1828 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1829 | 1829 | |
| 1830 | 1830 |  			if ($htmlname != 'none' && !$options_only) { | 
                                                        
| 1831 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';  | 
                                                        |
| 1831 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';  | 
                                                        |
| 1832 | 1832 | }  | 
                                                        
| 1833 | 1833 | |
| 1834 | 1834 |  			if ($showempty && !is_numeric($showempty)) { | 
                                                        
| 1835 | 1835 | $textforempty = $showempty;  | 
                                                        
| 1836 | - $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';  | 
                                                        |
| 1836 | + $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';  | 
                                                        |
| 1837 | 1837 |  			} else { | 
                                                        
| 1838 | 1838 |  				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { | 
                                                        
| 1839 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 1839 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 1840 | 1840 | }  | 
                                                        
| 1841 | 1841 |  				if ($showempty == 2) { | 
                                                        
| 1842 | -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; | 
                                                        |
| 1842 | +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; | 
                                                        |
| 1843 | 1843 | }  | 
                                                        
| 1844 | 1844 | }  | 
                                                        
| 1845 | 1845 | |
| 1846 | 1846 | $i = 0;  | 
                                                        
| 1847 | 1847 |  			if ($num) { | 
                                                        
| 1848 | - include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 1848 | + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 1849 | 1849 | $contactstatic = new Contact($this->db);  | 
                                                        
| 1850 | 1850 | |
| 1851 | 1851 |  				while ($i < $num) { | 
                                                        
@@ -1881,7 +1881,7 @@ discard block  | 
                                                    ||
| 1881 | 1881 | }  | 
                                                        
| 1882 | 1882 |  						$extendedInfos = implode(' - ', $extendedInfos); | 
                                                        
| 1883 | 1883 |  						if (!empty($extendedInfos)) { | 
                                                        
| 1884 | - $extendedInfos = ' - ' . $extendedInfos;  | 
                                                        |
| 1884 | + $extendedInfos = ' - '.$extendedInfos;  | 
                                                        |
| 1885 | 1885 | }  | 
                                                        
| 1886 | 1886 | }  | 
                                                        
| 1887 | 1887 | |
@@ -1898,42 +1898,42 @@ discard block  | 
                                                    ||
| 1898 | 1898 | $disabled = 1;  | 
                                                        
| 1899 | 1899 | }  | 
                                                        
| 1900 | 1900 |  							if (!empty($selected) && in_array($obj->rowid, $selected)) { | 
                                                        
| 1901 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1901 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1902 | 1902 |  								if ($disabled) { | 
                                                        
| 1903 | 1903 | $out .= ' disabled';  | 
                                                        
| 1904 | 1904 | }  | 
                                                        
| 1905 | 1905 | $out .= ' selected>';  | 
                                                        
| 1906 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1906 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1907 | 1907 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1908 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1908 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1909 | 1909 | }  | 
                                                        
| 1910 | 1910 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1911 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1911 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1912 | 1912 | }  | 
                                                        
| 1913 | 1913 | $out .= '</option>';  | 
                                                        
| 1914 | 1914 |  							} else { | 
                                                        
| 1915 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1915 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1916 | 1916 |  								if ($disabled) { | 
                                                        
| 1917 | 1917 | $out .= ' disabled';  | 
                                                        
| 1918 | 1918 | }  | 
                                                        
| 1919 | 1919 | $out .= '>';  | 
                                                        
| 1920 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1920 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1921 | 1921 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1922 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1922 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1923 | 1923 | }  | 
                                                        
| 1924 | 1924 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1925 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1925 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1926 | 1926 | }  | 
                                                        
| 1927 | 1927 | $out .= '</option>';  | 
                                                        
| 1928 | 1928 | }  | 
                                                        
| 1929 | 1929 |  						} else { | 
                                                        
| 1930 | 1930 |  							if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1931 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1931 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1932 | 1932 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1933 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1933 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1934 | 1934 | }  | 
                                                        
| 1935 | 1935 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1936 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1936 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1937 | 1937 | }  | 
                                                        
| 1938 | 1938 | }  | 
                                                        
| 1939 | 1939 | }  | 
                                                        
@@ -1942,7 +1942,7 @@ discard block  | 
                                                    ||
| 1942 | 1942 | }  | 
                                                        
| 1943 | 1943 |  			} else { | 
                                                        
| 1944 | 1944 |  				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); | 
                                                        
| 1945 | - $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';  | 
                                                        |
| 1945 | + $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';  | 
                                                        |
| 1946 | 1946 | $out .= $labeltoshow;  | 
                                                        
| 1947 | 1947 | $out .= '</option>';  | 
                                                        
| 1948 | 1948 | }  | 
                                                        
@@ -1963,7 +1963,7 @@ discard block  | 
                                                    ||
| 1963 | 1963 | }  | 
                                                        
| 1964 | 1964 | |
| 1965 | 1965 |  			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { | 
                                                        
| 1966 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1966 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1967 | 1967 |  				$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1968 | 1968 | }  | 
                                                        
| 1969 | 1969 | |
@@ -2072,14 +2072,14 @@ discard block  | 
                                                    ||
| 2072 | 2072 |  		if ($showlabelofentity) { | 
                                                        
| 2073 | 2073 | $sql .= ", e.label";  | 
                                                        
| 2074 | 2074 | }  | 
                                                        
| 2075 | - $sql .= " FROM " . $this->db->prefix() . "user as u";  | 
                                                        |
| 2075 | + $sql .= " FROM ".$this->db->prefix()."user as u";  | 
                                                        |
| 2076 | 2076 |  		if ($showlabelofentity) { | 
                                                        
| 2077 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2077 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2078 | 2078 | }  | 
                                                        
| 2079 | 2079 | // Condition here should be the same than into societe->getSalesRepresentatives().  | 
                                                        
| 2080 | 2080 |  		if ($userissuperadminentityone && $force_entity != 'default') { | 
                                                        
| 2081 | 2081 |  			if (!empty($force_entity)) { | 
                                                        
| 2082 | - $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";  | 
                                                        |
| 2082 | + $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";  | 
                                                        |
| 2083 | 2083 |  			} else { | 
                                                        
| 2084 | 2084 | $sql .= " WHERE u.entity IS NOT NULL";  | 
                                                        
| 2085 | 2085 | }  | 
                                                        
@@ -2087,18 +2087,18 @@ discard block  | 
                                                    ||
| 2087 | 2087 |  			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { | 
                                                        
| 2088 | 2088 |  				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; | 
                                                        
| 2089 | 2089 |  			} else { | 
                                                        
| 2090 | -				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; | 
                                                        |
| 2090 | +				$sql .= " WHERE u.entity IN (".getEntity('user').")"; | 
                                                        |
| 2091 | 2091 | }  | 
                                                        
| 2092 | 2092 | }  | 
                                                        
| 2093 | 2093 | |
| 2094 | 2094 |  		if (!empty($user->socid)) { | 
                                                        
| 2095 | - $sql .= " AND u.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 2095 | + $sql .= " AND u.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 2096 | 2096 | }  | 
                                                        
| 2097 | 2097 |  		if (is_array($exclude) && $excludeUsers) { | 
                                                        
| 2098 | -			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; | 
                                                        |
| 2098 | +			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; | 
                                                        |
| 2099 | 2099 | }  | 
                                                        
| 2100 | 2100 |  		if ($includeUsers) { | 
                                                        
| 2101 | -			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; | 
                                                        |
| 2101 | +			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; | 
                                                        |
| 2102 | 2102 | }  | 
                                                        
| 2103 | 2103 |  		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { | 
                                                        
| 2104 | 2104 | $sql .= " AND u.statut <> 0";  | 
                                                        
@@ -2110,7 +2110,7 @@ discard block  | 
                                                    ||
| 2110 | 2110 | $sql .= " AND u.fk_soc IS NULL";  | 
                                                        
| 2111 | 2111 | }  | 
                                                        
| 2112 | 2112 |  		if (!empty($morefilter)) { | 
                                                        
| 2113 | - $sql .= " " . $morefilter;  | 
                                                        |
| 2113 | + $sql .= " ".$morefilter;  | 
                                                        |
| 2114 | 2114 | }  | 
                                                        
| 2115 | 2115 | |
| 2116 | 2116 | //Add hook to filter on user (for example on usergroup define in custom modules)  | 
                                                        
@@ -2125,7 +2125,7 @@ discard block  | 
                                                    ||
| 2125 | 2125 | $sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";  | 
                                                        
| 2126 | 2126 | }  | 
                                                        
| 2127 | 2127 | |
| 2128 | - dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2128 | + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2129 | 2129 | |
| 2130 | 2130 | $resql = $this->db->query($sql);  | 
                                                        
| 2131 | 2131 |  		if ($resql) { | 
                                                        
@@ -2133,7 +2133,7 @@ discard block  | 
                                                    ||
| 2133 | 2133 | $i = 0;  | 
                                                        
| 2134 | 2134 |  			if ($num) { | 
                                                        
| 2135 | 2135 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined  | 
                                                        
| 2136 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 2136 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 2137 | 2137 |  				if ($show_empty && !$multiple) { | 
                                                        
| 2138 | 2138 | $textforempty = ' ';  | 
                                                        
| 2139 | 2139 |  					if (!empty($conf->use_javascript_ajax)) { | 
                                                        
@@ -2142,10 +2142,10 @@ discard block  | 
                                                    ||
| 2142 | 2142 |  					if (!is_numeric($show_empty)) { | 
                                                        
| 2143 | 2143 | $textforempty = $show_empty;  | 
                                                        
| 2144 | 2144 | }  | 
                                                        
| 2145 | - $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 2145 | + $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 2146 | 2146 | }  | 
                                                        
| 2147 | 2147 |  				if ($show_every) { | 
                                                        
| 2148 | -					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; | 
                                                        |
| 2148 | +					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; | 
                                                        |
| 2149 | 2149 | }  | 
                                                        
| 2150 | 2150 | |
| 2151 | 2151 | $userstatic = new User($this->db);  | 
                                                        
@@ -2192,21 +2192,21 @@ discard block  | 
                                                    ||
| 2192 | 2192 | }  | 
                                                        
| 2193 | 2193 |  					if ($showstatus >= 0) { | 
                                                        
| 2194 | 2194 |  						if ($obj->status == 1 && $showstatus == 1) { | 
                                                        
| 2195 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); | 
                                                        |
| 2196 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); | 
                                                        |
| 2195 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); | 
                                                        |
| 2196 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); | 
                                                        |
| 2197 | 2197 | }  | 
                                                        
| 2198 | 2198 |  						if ($obj->status == 0 && $showstatus == 1) { | 
                                                        
| 2199 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); | 
                                                        |
| 2200 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); | 
                                                        |
| 2199 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); | 
                                                        |
| 2200 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); | 
                                                        |
| 2201 | 2201 | }  | 
                                                        
| 2202 | 2202 | }  | 
                                                        
| 2203 | 2203 |  					if ($showlabelofentity) { | 
                                                        
| 2204 | 2204 |  						if (empty($obj->entity)) { | 
                                                        
| 2205 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); | 
                                                        |
| 2206 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); | 
                                                        |
| 2205 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); | 
                                                        |
| 2206 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); | 
                                                        |
| 2207 | 2207 |  						} else { | 
                                                        
| 2208 | 2208 |  							if ($obj->entity != $conf->entity) { | 
                                                        
| 2209 | -								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2209 | +								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2210 | 2210 |  								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        
| 2211 | 2211 | }  | 
                                                        
| 2212 | 2212 | }  | 
                                                        
@@ -2215,13 +2215,13 @@ discard block  | 
                                                    ||
| 2215 | 2215 | $moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');  | 
                                                        
| 2216 | 2216 |  					if (!empty($disableline) && $disableline != '1') { | 
                                                        
| 2217 | 2217 | // Add text from $enableonlytext parameter  | 
                                                        
| 2218 | - $moreinfo .= ' - ' . $disableline;  | 
                                                        |
| 2219 | - $moreinfohtml .= ' - ' . $disableline;  | 
                                                        |
| 2218 | + $moreinfo .= ' - '.$disableline;  | 
                                                        |
| 2219 | + $moreinfohtml .= ' - '.$disableline;  | 
                                                        |
| 2220 | 2220 | }  | 
                                                        
| 2221 | 2221 | $labeltoshow .= $moreinfo;  | 
                                                        
| 2222 | 2222 | $labeltoshowhtml .= $moreinfohtml;  | 
                                                        
| 2223 | 2223 | |
| 2224 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2224 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2225 | 2225 |  					if (!empty($disableline)) { | 
                                                        
| 2226 | 2226 | $out .= ' disabled';  | 
                                                        
| 2227 | 2227 | }  | 
                                                        
@@ -2229,7 +2229,7 @@ discard block  | 
                                                    ||
| 2229 | 2229 | $out .= ' selected';  | 
                                                        
| 2230 | 2230 | }  | 
                                                        
| 2231 | 2231 | $out .= ' data-html="';  | 
                                                        
| 2232 | - $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';  | 
                                                        |
| 2232 | + $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';  | 
                                                        |
| 2233 | 2233 |  					if ($showstatus >= 0 && $obj->status == 0) { | 
                                                        
| 2234 | 2234 | $outhtml .= '<strike class="opacitymediumxxx">';  | 
                                                        
| 2235 | 2235 | }  | 
                                                        
@@ -2242,7 +2242,7 @@ discard block  | 
                                                    ||
| 2242 | 2242 | $out .= $labeltoshow;  | 
                                                        
| 2243 | 2243 | $out .= '</option>';  | 
                                                        
| 2244 | 2244 | |
| 2245 | - $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;  | 
                                                        |
| 2245 | + $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;  | 
                                                        |
| 2246 | 2246 | $outarray2[$userstatic->id] = array(  | 
                                                        
| 2247 | 2247 | 'id' => $userstatic->id,  | 
                                                        
| 2248 | 2248 | 'label' => $labeltoshow,  | 
                                                        
@@ -2254,14 +2254,14 @@ discard block  | 
                                                    ||
| 2254 | 2254 | $i++;  | 
                                                        
| 2255 | 2255 | }  | 
                                                        
| 2256 | 2256 |  			} else { | 
                                                        
| 2257 | - $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';  | 
                                                        |
| 2258 | -				$out .= '<option value="">' . $langs->trans("None") . '</option>'; | 
                                                        |
| 2257 | + $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';  | 
                                                        |
| 2258 | +				$out .= '<option value="">'.$langs->trans("None").'</option>'; | 
                                                        |
| 2259 | 2259 | }  | 
                                                        
| 2260 | 2260 | $out .= '</select>';  | 
                                                        
| 2261 | 2261 | |
| 2262 | 2262 |  			if ($num && !$forcecombo) { | 
                                                        
| 2263 | 2263 | // Enhance with select2  | 
                                                        
| 2264 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2264 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2265 | 2265 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 2266 | 2266 | }  | 
                                                        
| 2267 | 2267 |  		} else { | 
                                                        
@@ -2335,16 +2335,16 @@ discard block  | 
                                                    ||
| 2335 | 2335 | $out .= $userstatic->getNomUrl(-1);  | 
                                                        
| 2336 | 2336 |  			if ($i == 0) { | 
                                                        
| 2337 | 2337 | $ownerid = $value['id'];  | 
                                                        
| 2338 | -				$out .= ' (' . $langs->trans("Owner") . ')'; | 
                                                        |
| 2338 | +				$out .= ' ('.$langs->trans("Owner").')'; | 
                                                        |
| 2339 | 2339 | }  | 
                                                        
| 2340 | 2340 |  			if ($nbassignetouser > 1 && $action != 'view') { | 
                                                        
| 2341 | -				$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 . '">'; | 
                                                        |
| 2341 | +				$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.'">'; | 
                                                        |
| 2342 | 2342 | }  | 
                                                        
| 2343 | 2343 | // Show my availability  | 
                                                        
| 2344 | 2344 |  			if ($showproperties) { | 
                                                        
| 2345 | 2345 |  				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { | 
                                                        
| 2346 | 2346 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2347 | -					$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>'; | 
                                                        |
| 2347 | +					$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>'; | 
                                                        |
| 2348 | 2348 | $out .= '</div>';  | 
                                                        
| 2349 | 2349 | }  | 
                                                        
| 2350 | 2350 | }  | 
                                                        
@@ -2361,15 +2361,15 @@ discard block  | 
                                                    ||
| 2361 | 2361 | // Method with no ajax  | 
                                                        
| 2362 | 2362 |  		if ($action != 'view') { | 
                                                        
| 2363 | 2363 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';  | 
                                                        
| 2364 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2364 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2365 | 2365 |  			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; | 
                                                        
| 2366 | 2366 |  			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; | 
                                                        
| 2367 | -			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2368 | -			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2367 | +			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2368 | +			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2369 | 2369 | $out .= '});';  | 
                                                        
| 2370 | 2370 | $out .= '})</script>';  | 
                                                        
| 2371 | 2371 |  			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2372 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2372 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2373 | 2373 | $out .= '<br>';  | 
                                                        
| 2374 | 2374 | }  | 
                                                        
| 2375 | 2375 | |
@@ -2428,13 +2428,13 @@ discard block  | 
                                                    ||
| 2428 | 2428 | $resourcestatic->fetch($value['id']);  | 
                                                        
| 2429 | 2429 | $out .= $resourcestatic->getNomUrl(-1);  | 
                                                        
| 2430 | 2430 |  			if ($nbassignetoresource > 1 && $action != 'view') { | 
                                                        
| 2431 | -				$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 . '">'; | 
                                                        |
| 2431 | +				$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.'">'; | 
                                                        |
| 2432 | 2432 | }  | 
                                                        
| 2433 | 2433 | // Show my availability  | 
                                                        
| 2434 | 2434 |  			if ($showproperties) { | 
                                                        
| 2435 | 2435 |  				if (is_array($listofresourceid) && count($listofresourceid)) { | 
                                                        
| 2436 | 2436 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2437 | -					$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>'; | 
                                                        |
| 2437 | +					$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>'; | 
                                                        |
| 2438 | 2438 | $out .= '</div>';  | 
                                                        
| 2439 | 2439 | }  | 
                                                        
| 2440 | 2440 | }  | 
                                                        
@@ -2451,11 +2451,11 @@ discard block  | 
                                                    ||
| 2451 | 2451 | // Method with no ajax  | 
                                                        
| 2452 | 2452 |  		if ($action != 'view') { | 
                                                        
| 2453 | 2453 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';  | 
                                                        
| 2454 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2454 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2455 | 2455 |  			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; | 
                                                        
| 2456 | 2456 |  			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; | 
                                                        
| 2457 | -			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2458 | -			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2457 | +			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2458 | +			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2459 | 2459 | $out .= '});';  | 
                                                        
| 2460 | 2460 | $out .= '})</script>';  | 
                                                        
| 2461 | 2461 | |
@@ -2463,7 +2463,7 @@ discard block  | 
                                                    ||
| 2463 | 2463 |  			$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); | 
                                                        
| 2464 | 2464 | $out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);  | 
                                                        
| 2465 | 2465 |  			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2466 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2466 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2467 | 2467 | $out .= '<br>';  | 
                                                        
| 2468 | 2468 | }  | 
                                                        
| 2469 | 2469 | |
@@ -2524,7 +2524,7 @@ discard block  | 
                                                    ||
| 2524 | 2524 | $placeholder = '';  | 
                                                        
| 2525 | 2525 | |
| 2526 | 2526 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 2527 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2527 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2528 | 2528 | $producttmpselect = new Product($this->db);  | 
                                                        
| 2529 | 2529 | $producttmpselect->fetch($selected);  | 
                                                        
| 2530 | 2530 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -2539,17 +2539,17 @@ discard block  | 
                                                    ||
| 2539 | 2539 | }  | 
                                                        
| 2540 | 2540 | }  | 
                                                        
| 2541 | 2541 | // mode=1 means customers products  | 
                                                        
| 2542 | - $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;  | 
                                                        |
| 2543 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2542 | + $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;  | 
                                                        |
| 2543 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2544 | 2544 | |
| 2545 | 2545 |  			if (isModEnabled('variants') && is_array($selected_combinations)) { | 
                                                        
| 2546 | 2546 | // Code to automatically insert with javascript the select of attributes under the select of product  | 
                                                        
| 2547 | 2547 | // when a parent of variant has been selected.  | 
                                                        
| 2548 | 2548 | $out .= '  | 
                                                        
| 2549 | 2549 | <!-- script to auto show attributes select tags if a variant was selected -->  | 
                                                        
| 2550 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 2550 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 2551 | 2551 | // auto show attributes fields  | 
                                                        
| 2552 | - selected = ' . json_encode($selected_combinations) . ';  | 
                                                        |
| 2552 | + selected = ' . json_encode($selected_combinations).';  | 
                                                        |
| 2553 | 2553 |  					combvalues = {}; | 
                                                        
| 2554 | 2554 | |
| 2555 | 2555 |  					jQuery(document).ready(function () { | 
                                                        
@@ -2560,7 +2560,7 @@ discard block  | 
                                                    ||
| 2560 | 2560 | }  | 
                                                        
| 2561 | 2561 | });  | 
                                                        
| 2562 | 2562 | |
| 2563 | -						jQuery("input#' . $htmlname . '").change(function () { | 
                                                        |
| 2563 | +						jQuery("input#' . $htmlname.'").change(function () { | 
                                                        |
| 2564 | 2564 | |
| 2565 | 2565 |  							if (!jQuery(this).val()) { | 
                                                        
| 2566 | 2566 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2569,7 +2569,7 @@ discard block  | 
                                                    ||
| 2569 | 2569 | |
| 2570 | 2570 |  							console.log("A change has started. We get variants fields to inject html select"); | 
                                                        
| 2571 | 2571 | |
| 2572 | -							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { | 
                                                        |
| 2572 | +							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { | 
                                                        |
| 2573 | 2573 | id: jQuery(this).val()  | 
                                                        
| 2574 | 2574 |  							}, function (data) { | 
                                                        
| 2575 | 2575 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2612,21 +2612,21 @@ discard block  | 
                                                    ||
| 2612 | 2612 | })  | 
                                                        
| 2613 | 2613 | });  | 
                                                        
| 2614 | 2614 | |
| 2615 | -						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' | 
                                                        |
| 2615 | +						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' | 
                                                        |
| 2616 | 2616 | });  | 
                                                        
| 2617 | 2617 | </script>  | 
                                                        
| 2618 | 2618 | ';  | 
                                                        
| 2619 | 2619 | }  | 
                                                        
| 2620 | 2620 | |
| 2621 | 2621 |  			if (empty($hidelabel)) { | 
                                                        
| 2622 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 2622 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 2623 | 2623 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 2624 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 2624 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 2625 | 2625 |  				if ($hidelabel == 2) { | 
                                                        
| 2626 | 2626 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2627 | 2627 | }  | 
                                                        
| 2628 | 2628 | }  | 
                                                        
| 2629 | -			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 2629 | +			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 2630 | 2630 |  			if ($hidelabel == 3) { | 
                                                        
| 2631 | 2631 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2632 | 2632 | }  | 
                                                        
@@ -2663,33 +2663,33 @@ discard block  | 
                                                    ||
| 2663 | 2663 | // phpcs:enable  | 
                                                        
| 2664 | 2664 | global $conf, $user, $langs, $db;  | 
                                                        
| 2665 | 2665 | |
| 2666 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2666 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2667 | 2667 | |
| 2668 | 2668 | $error = 0;  | 
                                                        
| 2669 | 2669 | $out = '';  | 
                                                        
| 2670 | 2670 | |
| 2671 | 2671 |  		if (!$forcecombo) { | 
                                                        
| 2672 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2672 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2673 | 2673 | $events = array();  | 
                                                        
| 2674 | 2674 |  			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2675 | 2675 | }  | 
                                                        
| 2676 | 2676 | |
| 2677 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2677 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2678 | 2678 | |
| 2679 | 2679 | $sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';  | 
                                                        
| 2680 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';  | 
                                                        |
| 2681 | -		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; | 
                                                        |
| 2680 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';  | 
                                                        |
| 2681 | +		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; | 
                                                        |
| 2682 | 2682 |  		if (!empty($status)) { | 
                                                        
| 2683 | - $sql .= ' AND status = ' . (int) $status;  | 
                                                        |
| 2683 | + $sql .= ' AND status = '.(int) $status;  | 
                                                        |
| 2684 | 2684 | }  | 
                                                        
| 2685 | 2685 |  		if (!empty($type)) { | 
                                                        
| 2686 | - $sql .= ' AND bomtype = ' . (int) $type;  | 
                                                        |
| 2686 | + $sql .= ' AND bomtype = '.(int) $type;  | 
                                                        |
| 2687 | 2687 | }  | 
                                                        
| 2688 | 2688 |  		if (!empty($TProducts)) { | 
                                                        
| 2689 | -			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; | 
                                                        |
| 2689 | +			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; | 
                                                        |
| 2690 | 2690 | }  | 
                                                        
| 2691 | 2691 |  		if (!empty($limit)) { | 
                                                        
| 2692 | - $sql .= ' LIMIT ' . (int) $limit;  | 
                                                        |
| 2692 | + $sql .= ' LIMIT '.(int) $limit;  | 
                                                        |
| 2693 | 2693 | }  | 
                                                        
| 2694 | 2694 | $resql = $db->query($sql);  | 
                                                        
| 2695 | 2695 |  		if ($resql) { | 
                                                        
@@ -2703,11 +2703,11 @@ discard block  | 
                                                    ||
| 2703 | 2703 |  			while ($obj = $db->fetch_object($resql)) { | 
                                                        
| 2704 | 2704 | $product = new Product($db);  | 
                                                        
| 2705 | 2705 | $res = $product->fetch($obj->fk_product);  | 
                                                        
| 2706 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2706 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2707 | 2707 |  				if ($obj->rowid == $selected) { | 
                                                        
| 2708 | 2708 | $out .= 'selected';  | 
                                                        
| 2709 | 2709 | }  | 
                                                        
| 2710 | - $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';  | 
                                                        |
| 2710 | + $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';  | 
                                                        |
| 2711 | 2711 | }  | 
                                                        
| 2712 | 2712 |  		} else { | 
                                                        
| 2713 | 2713 | $error++;  | 
                                                        
@@ -2764,7 +2764,7 @@ discard block  | 
                                                    ||
| 2764 | 2764 | |
| 2765 | 2765 | $warehouseStatusArray = array();  | 
                                                        
| 2766 | 2766 |  		if (!empty($warehouseStatus)) { | 
                                                        
| 2767 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2767 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2768 | 2768 |  			if (preg_match('/warehouseclosed/', $warehouseStatus)) { | 
                                                        
| 2769 | 2769 | $warehouseStatusArray[] = Entrepot::STATUS_CLOSED;  | 
                                                        
| 2770 | 2770 | }  | 
                                                        
@@ -2778,9 +2778,9 @@ discard block  | 
                                                    ||
| 2778 | 2778 | |
| 2779 | 2779 | $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";  | 
                                                        
| 2780 | 2780 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2781 | -			$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 | 
                                                        |
| 2781 | +			$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 | 
                                                        |
| 2782 | 2782 |  		} else { | 
                                                        
| 2783 | -			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; | 
                                                        |
| 2783 | +			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; | 
                                                        |
| 2784 | 2784 | }  | 
                                                        
| 2785 | 2785 | |
| 2786 | 2786 | $sql = "SELECT ";  | 
                                                        
@@ -2796,9 +2796,9 @@ discard block  | 
                                                    ||
| 2796 | 2796 | |
| 2797 | 2797 |  		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { | 
                                                        
| 2798 | 2798 | //Product category  | 
                                                        
| 2799 | - $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie  | 
                                                        |
| 2800 | - FROM " . $this->db->prefix() . "categorie_product  | 
                                                        |
| 2801 | - WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid  | 
                                                        |
| 2799 | + $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie  | 
                                                        |
| 2800 | + FROM " . $this->db->prefix()."categorie_product  | 
                                                        |
| 2801 | + WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid  | 
                                                        |
| 2802 | 2802 | LIMIT 1  | 
                                                        
| 2803 | 2803 | ) AS categorie_product_id ";  | 
                                                        
| 2804 | 2804 | }  | 
                                                        
@@ -2824,15 +2824,15 @@ discard block  | 
                                                    ||
| 2824 | 2824 | }  | 
                                                        
| 2825 | 2825 | // Price by quantity  | 
                                                        
| 2826 | 2826 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2827 | - $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2827 | + $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2828 | 2828 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2829 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2829 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2830 | 2830 | }  | 
                                                        
| 2831 | 2831 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2832 | 2832 | $sql .= " DESC LIMIT 1) as price_rowid";  | 
                                                        
| 2833 | - $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  | 
                                                        |
| 2833 | + $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  | 
                                                        |
| 2834 | 2834 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2835 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2835 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2836 | 2836 | }  | 
                                                        
| 2837 | 2837 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2838 | 2838 | $sql .= " DESC LIMIT 1) as price_by_qty";  | 
                                                        
@@ -2841,58 +2841,58 @@ discard block  | 
                                                    ||
| 2841 | 2841 | |
| 2842 | 2842 | $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        
| 2843 | 2843 | // Add from (left join) from hooks  | 
                                                        
| 2844 | - $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2844 | + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2845 | 2845 |  		$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook | 
                                                        
| 2846 | 2846 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 2847 | 2847 | |
| 2848 | 2848 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2849 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2850 | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; | 
                                                        |
| 2851 | -			$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. | 
                                                        |
| 2849 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2850 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; | 
                                                        |
| 2851 | +			$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. | 
                                                        |
| 2852 | 2852 | }  | 
                                                        
| 2853 | 2853 | |
| 2854 | 2854 | // include search in supplier ref  | 
                                                        
| 2855 | 2855 |  		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2856 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2856 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2857 | 2857 | }  | 
                                                        
| 2858 | 2858 | |
| 2859 | 2859 | //Price by customer  | 
                                                        
| 2860 | 2860 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2861 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2861 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2862 | 2862 | }  | 
                                                        
| 2863 | 2863 | // Units  | 
                                                        
| 2864 | 2864 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 2865 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 2865 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 2866 | 2866 | }  | 
                                                        
| 2867 | 2867 | // Multilang : we add translation  | 
                                                        
| 2868 | 2868 |  		if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2869 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 2869 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 2870 | 2870 |  			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { | 
                                                        
| 2871 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 2871 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 2872 | 2872 | $soc = new Societe($this->db);  | 
                                                        
| 2873 | 2873 | $result = $soc->fetch($socid);  | 
                                                        
| 2874 | 2874 |  				if ($result > 0 && !empty($soc->default_lang)) { | 
                                                        
| 2875 | - $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";  | 
                                                        |
| 2875 | + $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";  | 
                                                        |
| 2876 | 2876 |  				} else { | 
                                                        
| 2877 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 2877 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 2878 | 2878 | }  | 
                                                        
| 2879 | 2879 |  			} else { | 
                                                        
| 2880 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 2880 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 2881 | 2881 | }  | 
                                                        
| 2882 | 2882 | }  | 
                                                        
| 2883 | 2883 | |
| 2884 | 2884 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 2885 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 2885 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 2886 | 2886 | }  | 
                                                        
| 2887 | 2887 | |
| 2888 | -		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; | 
                                                        |
| 2888 | +		$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; | 
                                                        |
| 2889 | 2889 | |
| 2890 | 2890 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 2891 | 2891 | $sql .= " AND pac.rowid IS NULL";  | 
                                                        
| 2892 | 2892 | }  | 
                                                        
| 2893 | 2893 | |
| 2894 | 2894 |  		if ($finished == 0) { | 
                                                        
| 2895 | - $sql .= " AND p.finished = " . ((int) $finished);  | 
                                                        |
| 2895 | + $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        |
| 2896 | 2896 |  		} elseif ($finished == 1) { | 
                                                        
| 2897 | 2897 | $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        
| 2898 | 2898 | }  | 
                                                        
@@ -2900,18 +2900,18 @@ discard block  | 
                                                    ||
| 2900 | 2900 | $sql .= " AND p.tosell = ".((int) $status);  | 
                                                        
| 2901 | 2901 | }  | 
                                                        
| 2902 | 2902 |  		if ($status_purchase >= 0) { | 
                                                        
| 2903 | - $sql .= " AND p.tobuy = " . ((int) $status_purchase);  | 
                                                        |
| 2903 | + $sql .= " AND p.tobuy = ".((int) $status_purchase);  | 
                                                        |
| 2904 | 2904 | }  | 
                                                        
| 2905 | 2905 | // Filter by product type  | 
                                                        
| 2906 | 2906 |  		if (strval($filtertype) != '') { | 
                                                        
| 2907 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 2907 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 2908 | 2908 |  		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only | 
                                                        
| 2909 | 2909 | $sql .= " AND p.fk_product_type = 1";  | 
                                                        
| 2910 | 2910 |  		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only | 
                                                        
| 2911 | 2911 | $sql .= " AND p.fk_product_type = 0";  | 
                                                        
| 2912 | 2912 | }  | 
                                                        
| 2913 | 2913 | // Add where from hooks  | 
                                                        
| 2914 | - $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2914 | + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2915 | 2915 |  		$reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook | 
                                                        
| 2916 | 2916 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 2917 | 2917 | // Add criteria on ref/label  | 
                                                        
@@ -2928,21 +2928,21 @@ discard block  | 
                                                    ||
| 2928 | 2928 |  				if ($i > 0) { | 
                                                        
| 2929 | 2929 | $sql .= " AND ";  | 
                                                        
| 2930 | 2930 | }  | 
                                                        
| 2931 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2931 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2932 | 2932 |  				if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2933 | - $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2933 | + $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2934 | 2934 | }  | 
                                                        
| 2935 | 2935 |  				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2936 | - $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2936 | + $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2937 | 2937 | }  | 
                                                        
| 2938 | 2938 |  				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { | 
                                                        
| 2939 | - $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2939 | + $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2940 | 2940 |  					if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2941 | - $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2941 | + $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2942 | 2942 | }  | 
                                                        
| 2943 | 2943 | }  | 
                                                        
| 2944 | 2944 |  				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2945 | - $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2945 | + $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2946 | 2946 | }  | 
                                                        
| 2947 | 2947 | $sql .= ")";  | 
                                                        
| 2948 | 2948 | $i++;  | 
                                                        
@@ -2951,12 +2951,12 @@ discard block  | 
                                                    ||
| 2951 | 2951 | $sql .= ")";  | 
                                                        
| 2952 | 2952 | }  | 
                                                        
| 2953 | 2953 |  			if (isModEnabled('barcode')) { | 
                                                        
| 2954 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 2954 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 2955 | 2955 | }  | 
                                                        
| 2956 | 2956 | $sql .= ')';  | 
                                                        
| 2957 | 2957 | }  | 
                                                        
| 2958 | 2958 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2959 | - $sql .= " GROUP BY " . $selectFields;  | 
                                                        |
| 2959 | + $sql .= " GROUP BY ".$selectFields;  | 
                                                        |
| 2960 | 2960 | }  | 
                                                        
| 2961 | 2961 | |
| 2962 | 2962 | //Sort by category  | 
                                                        
@@ -2971,23 +2971,23 @@ discard block  | 
                                                    ||
| 2971 | 2971 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 2972 | 2972 | |
| 2973 | 2973 | // Build output string  | 
                                                        
| 2974 | - dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 2974 | + dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 2975 | 2975 | $result = $this->db->query($sql);  | 
                                                        
| 2976 | 2976 |  		if ($result) { | 
                                                        
| 2977 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2978 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 2979 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 2977 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2978 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 2979 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 2980 | 2980 | |
| 2981 | 2981 | $num = $this->db->num_rows($result);  | 
                                                        
| 2982 | 2982 | |
| 2983 | 2983 | $events = array();  | 
                                                        
| 2984 | 2984 | |
| 2985 | 2985 |  			if (!$forcecombo) { | 
                                                        
| 2986 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2986 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2987 | 2987 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2988 | 2988 | }  | 
                                                        
| 2989 | 2989 | |
| 2990 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2990 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2991 | 2991 | |
| 2992 | 2992 | $textifempty = '';  | 
                                                        
| 2993 | 2993 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -3004,7 +3004,7 @@ discard block  | 
                                                    ||
| 3004 | 3004 | }  | 
                                                        
| 3005 | 3005 | }  | 
                                                        
| 3006 | 3006 |  			if ($showempty) { | 
                                                        
| 3007 | - $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>';  | 
                                                        |
| 3007 | + $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>';  | 
                                                        |
| 3008 | 3008 | }  | 
                                                        
| 3009 | 3009 | |
| 3010 | 3010 | $i = 0;  | 
                                                        
@@ -3015,11 +3015,11 @@ discard block  | 
                                                    ||
| 3015 | 3015 | |
| 3016 | 3016 |  				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 | 
                                                        
| 3017 | 3017 | $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";  | 
                                                        
| 3018 | - $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";  | 
                                                        |
| 3019 | - $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);  | 
                                                        |
| 3018 | + $sql .= " FROM ".$this->db->prefix()."product_price_by_qty";  | 
                                                        |
| 3019 | + $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);  | 
                                                        |
| 3020 | 3020 | $sql .= " ORDER BY quantity ASC";  | 
                                                        
| 3021 | 3021 | |
| 3022 | - dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 3022 | + dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 3023 | 3023 | $result2 = $this->db->query($sql);  | 
                                                        
| 3024 | 3024 |  					if ($result2) { | 
                                                        
| 3025 | 3025 | $nb_prices = $this->db->num_rows($result2);  | 
                                                        
@@ -3057,7 +3057,7 @@ discard block  | 
                                                    ||
| 3057 | 3057 | $price_product = new Product($this->db);  | 
                                                        
| 3058 | 3058 | $price_product->fetch($objp->rowid, '', '', 1);  | 
                                                        
| 3059 | 3059 | |
| 3060 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3060 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3061 | 3061 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3062 | 3062 | $price_result = $priceparser->parseProduct($price_product);  | 
                                                        
| 3063 | 3063 |  						if ($price_result >= 0) { | 
                                                        
@@ -3141,7 +3141,7 @@ discard block  | 
                                                    ||
| 3141 | 3141 | $label = $objp->label_translated;  | 
                                                        
| 3142 | 3142 | }  | 
                                                        
| 3143 | 3143 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3144 | -			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3144 | +			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3145 | 3145 | }  | 
                                                        
| 3146 | 3146 | |
| 3147 | 3147 | $outkey = $objp->rowid;  | 
                                                        
@@ -3162,32 +3162,32 @@ discard block  | 
                                                    ||
| 3162 | 3162 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';  | 
                                                        
| 3163 | 3163 | |
| 3164 | 3164 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3165 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 3165 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 3166 | 3166 | }  | 
                                                        
| 3167 | 3167 | |
| 3168 | 3168 | // Units  | 
                                                        
| 3169 | 3169 | $outvalUnits = '';  | 
                                                        
| 3170 | 3170 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3171 | 3171 |  			if (!empty($objp->unit_short)) { | 
                                                        
| 3172 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3172 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3173 | 3173 | }  | 
                                                        
| 3174 | 3174 | }  | 
                                                        
| 3175 | 3175 |  		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { | 
                                                        
| 3176 | 3176 |  			if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3177 | 3177 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3178 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3178 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3179 | 3179 | }  | 
                                                        
| 3180 | 3180 |  			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3181 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3182 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3181 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3182 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3183 | 3183 | }  | 
                                                        
| 3184 | 3184 |  			if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3185 | 3185 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3186 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3186 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3187 | 3187 | }  | 
                                                        
| 3188 | 3188 |  			if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3189 | 3189 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3190 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3190 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3191 | 3191 | }  | 
                                                        
| 3192 | 3192 | }  | 
                                                        
| 3193 | 3193 |  		if ($outdurationvalue && $outdurationunit) { | 
                                                        
@@ -3199,14 +3199,14 @@ discard block  | 
                                                    ||
| 3199 | 3199 |  				'y' => $langs->trans('Year') | 
                                                        
| 3200 | 3200 | );  | 
                                                        
| 3201 | 3201 |  			if (isset($da[$outdurationunit])) { | 
                                                        
| 3202 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3202 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3203 | 3203 | }  | 
                                                        
| 3204 | 3204 | }  | 
                                                        
| 3205 | 3205 | |
| 3206 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 3206 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 3207 | 3207 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 3208 | 3208 |  		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { | 
                                                        
| 3209 | - $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 . '"';  | 
                                                        |
| 3209 | + $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.'"';  | 
                                                        |
| 3210 | 3210 | }  | 
                                                        
| 3211 | 3211 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3212 | 3212 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
@@ -3218,36 +3218,36 @@ discard block  | 
                                                    ||
| 3218 | 3218 | }  | 
                                                        
| 3219 | 3219 | }  | 
                                                        
| 3220 | 3220 |  		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { | 
                                                        
| 3221 | - $opt .= ' data-labeltrans="' . $outlabel_translated . '"';  | 
                                                        |
| 3222 | - $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';  | 
                                                        |
| 3221 | + $opt .= ' data-labeltrans="'.$outlabel_translated.'"';  | 
                                                        |
| 3222 | + $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';  | 
                                                        |
| 3223 | 3223 | }  | 
                                                        
| 3224 | 3224 | $opt .= '>';  | 
                                                        
| 3225 | 3225 | $opt .= $objp->ref;  | 
                                                        
| 3226 | 3226 |  		if (!empty($objp->custref)) { | 
                                                        
| 3227 | -			$opt .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3227 | +			$opt .= ' ('.$objp->custref.')'; | 
                                                        |
| 3228 | 3228 | }  | 
                                                        
| 3229 | 3229 |  		if ($outbarcode) { | 
                                                        
| 3230 | -			$opt .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3230 | +			$opt .= ' ('.$outbarcode.')'; | 
                                                        |
| 3231 | 3231 | }  | 
                                                        
| 3232 | - $opt .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3232 | + $opt .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3233 | 3233 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3234 | -			$opt .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3234 | +			$opt .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3235 | 3235 | }  | 
                                                        
| 3236 | 3236 | |
| 3237 | 3237 | $objRef = $objp->ref;  | 
                                                        
| 3238 | 3238 |  		if (!empty($objp->custref)) { | 
                                                        
| 3239 | -			$objRef .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3239 | +			$objRef .= ' ('.$objp->custref.')'; | 
                                                        |
| 3240 | 3240 | }  | 
                                                        
| 3241 | 3241 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3242 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3242 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3243 | 3243 | }  | 
                                                        
| 3244 | 3244 | $outval .= $objRef;  | 
                                                        
| 3245 | 3245 |  		if ($outbarcode) { | 
                                                        
| 3246 | -			$outval .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3246 | +			$outval .= ' ('.$outbarcode.')'; | 
                                                        |
| 3247 | 3247 | }  | 
                                                        
| 3248 | - $outval .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3248 | + $outval .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3249 | 3249 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3250 | -			$outval .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3250 | +			$outval .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3251 | 3251 | }  | 
                                                        
| 3252 | 3252 | |
| 3253 | 3253 | // Units  | 
                                                        
@@ -3260,35 +3260,35 @@ discard block  | 
                                                    ||
| 3260 | 3260 | // If we need a particular price level (from 1 to n)  | 
                                                        
| 3261 | 3261 |  		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { | 
                                                        
| 3262 | 3262 | $sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";  | 
                                                        
| 3263 | - $sql .= " FROM " . $this->db->prefix() . "product_price";  | 
                                                        |
| 3264 | - $sql .= " WHERE fk_product = " . ((int) $objp->rowid);  | 
                                                        |
| 3265 | -			$sql .= " AND entity IN (" . getEntity('productprice') . ")"; | 
                                                        |
| 3266 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 3263 | + $sql .= " FROM ".$this->db->prefix()."product_price";  | 
                                                        |
| 3264 | + $sql .= " WHERE fk_product = ".((int) $objp->rowid);  | 
                                                        |
| 3265 | +			$sql .= " AND entity IN (".getEntity('productprice').")"; | 
                                                        |
| 3266 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 3267 | 3267 | $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.  | 
                                                        
| 3268 | 3268 | $sql .= " LIMIT 1";  | 
                                                        
| 3269 | 3269 | |
| 3270 | - dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);  | 
                                                        |
| 3270 | + dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);  | 
                                                        |
| 3271 | 3271 | $result2 = $this->db->query($sql);  | 
                                                        
| 3272 | 3272 |  			if ($result2) { | 
                                                        
| 3273 | 3273 | $objp2 = $this->db->fetch_object($result2);  | 
                                                        
| 3274 | 3274 |  				if ($objp2) { | 
                                                        
| 3275 | 3275 | $found = 1;  | 
                                                        
| 3276 | 3276 |  					if ($objp2->price_base_type == 'HT') { | 
                                                        
| 3277 | -						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3278 | -						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3277 | +						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3278 | +						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3279 | 3279 |  					} else { | 
                                                        
| 3280 | -						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3281 | -						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3280 | +						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3281 | +						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3282 | 3282 | }  | 
                                                        
| 3283 | 3283 | $outprice_ht = price($objp2->price);  | 
                                                        
| 3284 | 3284 | $outprice_ttc = price($objp2->price_ttc);  | 
                                                        
| 3285 | 3285 | $outpricebasetype = $objp2->price_base_type;  | 
                                                        
| 3286 | 3286 |  					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility | 
                                                        
| 3287 | - $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3288 | - $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3287 | + $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3288 | + $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3289 | 3289 |  					} else { | 
                                                        
| 3290 | - $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3291 | - $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3290 | + $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3291 | + $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3292 | 3292 | }  | 
                                                        
| 3293 | 3293 | }  | 
                                                        
| 3294 | 3294 |  			} else { | 
                                                        
@@ -3302,13 +3302,13 @@ discard block  | 
                                                    ||
| 3302 | 3302 | $outqty = $objp->quantity;  | 
                                                        
| 3303 | 3303 | $outdiscount = $objp->remise_percent;  | 
                                                        
| 3304 | 3304 |  			if ($objp->quantity == 1) { | 
                                                        
| 3305 | - $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3306 | - $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3305 | + $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3306 | + $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3307 | 3307 |  				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3308 | 3308 |  				$outval .= $langs->transnoentities("Unit"); | 
                                                        
| 3309 | 3309 |  			} else { | 
                                                        
| 3310 | - $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3311 | - $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3310 | + $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3311 | + $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3312 | 3312 |  				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3313 | 3313 |  				$outval .= $langs->transnoentities("Units"); | 
                                                        
| 3314 | 3314 | }  | 
                                                        
@@ -3316,16 +3316,16 @@ discard block  | 
                                                    ||
| 3316 | 3316 | $outprice_ht = price($objp->unitprice);  | 
                                                        
| 3317 | 3317 | $outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));  | 
                                                        
| 3318 | 3318 | $outpricebasetype = $objp->price_base_type;  | 
                                                        
| 3319 | - $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  | 
                                                        |
| 3320 | - $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  | 
                                                        |
| 3319 | + $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  | 
                                                        |
| 3320 | + $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  | 
                                                        |
| 3321 | 3321 | }  | 
                                                        
| 3322 | 3322 |  		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { | 
                                                        
| 3323 | -			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3324 | -			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3323 | +			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3324 | +			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3325 | 3325 | }  | 
                                                        
| 3326 | 3326 |  		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { | 
                                                        
| 3327 | -			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3328 | -			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3327 | +			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3328 | +			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3329 | 3329 | }  | 
                                                        
| 3330 | 3330 | |
| 3331 | 3331 | // Price by customer  | 
                                                        
@@ -3334,11 +3334,11 @@ discard block  | 
                                                    ||
| 3334 | 3334 | $found = 1;  | 
                                                        
| 3335 | 3335 | |
| 3336 | 3336 |  				if ($objp->custprice_base_type == 'HT') { | 
                                                        
| 3337 | -					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3338 | -					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3337 | +					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3338 | +					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3339 | 3339 |  				} else { | 
                                                        
| 3340 | -					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3341 | -					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3340 | +					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3341 | +					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3342 | 3342 | }  | 
                                                        
| 3343 | 3343 | |
| 3344 | 3344 | $outprice_ht = price($objp->custprice);  | 
                                                        
@@ -3352,11 +3352,11 @@ discard block  | 
                                                    ||
| 3352 | 3352 | // If level no defined or multiprice not found, we used the default price  | 
                                                        
| 3353 | 3353 |  		if (empty($hidepriceinlabel) && !$found) { | 
                                                        
| 3354 | 3354 |  			if ($objp->price_base_type == 'HT') { | 
                                                        
| 3355 | -				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3356 | -				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3355 | +				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3356 | +				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3357 | 3357 |  			} else { | 
                                                        
| 3358 | -				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3359 | -				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3358 | +				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3359 | +				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3360 | 3360 | }  | 
                                                        
| 3361 | 3361 | $outprice_ht = price($objp->price);  | 
                                                        
| 3362 | 3362 | $outprice_ttc = price($objp->price_ttc);  | 
                                                        
@@ -3367,14 +3367,14 @@ discard block  | 
                                                    ||
| 3367 | 3367 | |
| 3368 | 3368 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3369 | 3369 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3370 | -				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3370 | +				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3371 | 3371 | |
| 3372 | 3372 |  				if ($objp->stock > 0) { | 
                                                        
| 3373 | 3373 | $outval .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3374 | 3374 |  				} elseif ($objp->stock <= 0) { | 
                                                        
| 3375 | 3375 | $outval .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3376 | 3376 | }  | 
                                                        
| 3377 | -				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3377 | +				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3378 | 3378 | $outval .= '</span>';  | 
                                                        
| 3379 | 3379 |  				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3380 | 3380 |  					$langs->load("stocks"); | 
                                                        
@@ -3384,9 +3384,9 @@ discard block  | 
                                                    ||
| 3384 | 3384 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3385 | 3385 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3386 | 3386 | |
| 3387 | -					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3387 | +					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3388 | 3388 | |
| 3389 | -					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3389 | +					$outval .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3390 | 3390 |  					if ($virtualstock > 0) { | 
                                                        
| 3391 | 3391 | $outval .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3392 | 3392 |  					} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3464,7 +3464,7 @@ discard block  | 
                                                    ||
| 3464 | 3464 | $selected_input_value = '';  | 
                                                        
| 3465 | 3465 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { | 
                                                        
| 3466 | 3466 |  			if ($selected > 0) { | 
                                                        
| 3467 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 3467 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 3468 | 3468 | $producttmpselect = new Product($this->db);  | 
                                                        
| 3469 | 3469 | $producttmpselect->fetch($selected);  | 
                                                        
| 3470 | 3470 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -3472,10 +3472,10 @@ discard block  | 
                                                    ||
| 3472 | 3472 | }  | 
                                                        
| 3473 | 3473 | |
| 3474 | 3474 | // mode=2 means suppliers products  | 
                                                        
| 3475 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;  | 
                                                        |
| 3476 | - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 3475 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;  | 
                                                        |
| 3476 | + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 3477 | 3477 | |
| 3478 | -			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; | 
                                                        |
| 3478 | +			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; | 
                                                        |
| 3479 | 3479 |  		} else { | 
                                                        
| 3480 | 3480 | print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);  | 
                                                        
| 3481 | 3481 | }  | 
                                                        
@@ -3535,25 +3535,25 @@ discard block  | 
                                                    ||
| 3535 | 3535 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3536 | 3536 | $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";  | 
                                                        
| 3537 | 3537 | }  | 
                                                        
| 3538 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3539 | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; | 
                                                        |
| 3538 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3539 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; | 
                                                        |
| 3540 | 3540 |  		if ($socid > 0) { | 
                                                        
| 3541 | - $sql .= " AND pfp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 3541 | + $sql .= " AND pfp.fk_soc = ".((int) $socid);  | 
                                                        |
| 3542 | 3542 | }  | 
                                                        
| 3543 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3543 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3544 | 3544 | // Units  | 
                                                        
| 3545 | 3545 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3546 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3546 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3547 | 3547 | }  | 
                                                        
| 3548 | -		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; | 
                                                        |
| 3548 | +		$sql .= " WHERE p.entity IN (".getEntity('product').")"; | 
                                                        |
| 3549 | 3549 |  		if ($statut != -1) { | 
                                                        
| 3550 | - $sql .= " AND p.tobuy = " . ((int) $statut);  | 
                                                        |
| 3550 | + $sql .= " AND p.tobuy = ".((int) $statut);  | 
                                                        |
| 3551 | 3551 | }  | 
                                                        
| 3552 | 3552 |  		if (strval($filtertype) != '') { | 
                                                        
| 3553 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 3553 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 3554 | 3554 | }  | 
                                                        
| 3555 | 3555 |  		if (!empty($filtre)) { | 
                                                        
| 3556 | - $sql .= " " . $filtre;  | 
                                                        |
| 3556 | + $sql .= " ".$filtre;  | 
                                                        |
| 3557 | 3557 | }  | 
                                                        
| 3558 | 3558 | // Add where from hooks  | 
                                                        
| 3559 | 3559 | $parameters = array();  | 
                                                        
@@ -3573,9 +3573,9 @@ discard block  | 
                                                    ||
| 3573 | 3573 |  				if ($i > 0) { | 
                                                        
| 3574 | 3574 | $sql .= " AND ";  | 
                                                        
| 3575 | 3575 | }  | 
                                                        
| 3576 | - $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) . "%'";  | 
                                                        |
| 3576 | + $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)."%'";  | 
                                                        |
| 3577 | 3577 |  				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { | 
                                                        
| 3578 | - $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3578 | + $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3579 | 3579 | }  | 
                                                        
| 3580 | 3580 | $sql .= ")";  | 
                                                        
| 3581 | 3581 | $i++;  | 
                                                        
@@ -3584,8 +3584,8 @@ discard block  | 
                                                    ||
| 3584 | 3584 | $sql .= ")";  | 
                                                        
| 3585 | 3585 | }  | 
                                                        
| 3586 | 3586 |  			if (isModEnabled('barcode')) { | 
                                                        
| 3587 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3588 | - $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3587 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3588 | + $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3589 | 3589 | }  | 
                                                        
| 3590 | 3590 | $sql .= ')';  | 
                                                        
| 3591 | 3591 | }  | 
                                                        
@@ -3594,20 +3594,20 @@ discard block  | 
                                                    ||
| 3594 | 3594 | |
| 3595 | 3595 | // Build output string  | 
                                                        
| 3596 | 3596 | |
| 3597 | - dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3597 | + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3598 | 3598 | $result = $this->db->query($sql);  | 
                                                        
| 3599 | 3599 |  		if ($result) { | 
                                                        
| 3600 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3601 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 3600 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3601 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 3602 | 3602 | |
| 3603 | 3603 | $num = $this->db->num_rows($result);  | 
                                                        
| 3604 | 3604 | |
| 3605 | 3605 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax  | 
                                                        
| 3606 | - $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3606 | + $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3607 | 3607 |  			if (!$selected) { | 
                                                        
| 3608 | - $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3608 | + $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3609 | 3609 |  			} else { | 
                                                        
| 3610 | - $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3610 | + $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3611 | 3611 | }  | 
                                                        
| 3612 | 3612 | |
| 3613 | 3613 | $i = 0;  | 
                                                        
@@ -3622,7 +3622,7 @@ discard block  | 
                                                    ||
| 3622 | 3622 | |
| 3623 | 3623 | $outkey = $objp->idprodfournprice; // id in table of price  | 
                                                        
| 3624 | 3624 |  				if (!$outkey && $alsoproductwithnosupplierprice) { | 
                                                        
| 3625 | - $outkey = 'idprod_' . $objp->rowid; // id of product  | 
                                                        |
| 3625 | + $outkey = 'idprod_'.$objp->rowid; // id of product  | 
                                                        |
| 3626 | 3626 | }  | 
                                                        
| 3627 | 3627 | |
| 3628 | 3628 | $outref = $objp->ref;  | 
                                                        
@@ -3637,23 +3637,23 @@ discard block  | 
                                                    ||
| 3637 | 3637 | $outvalUnits = '';  | 
                                                        
| 3638 | 3638 |  				if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3639 | 3639 |  					if (!empty($objp->unit_short)) { | 
                                                        
| 3640 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3640 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3641 | 3641 | }  | 
                                                        
| 3642 | 3642 |  					if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3643 | 3643 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3644 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3644 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3645 | 3645 | }  | 
                                                        
| 3646 | 3646 |  					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3647 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3648 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3647 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3648 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3649 | 3649 | }  | 
                                                        
| 3650 | 3650 |  					if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3651 | 3651 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3652 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3652 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3653 | 3653 | }  | 
                                                        
| 3654 | 3654 |  					if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3655 | 3655 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3656 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3656 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3657 | 3657 | }  | 
                                                        
| 3658 | 3658 |  					if ($outdurationvalue && $outdurationunit) { | 
                                                        
| 3659 | 3659 | $da = array(  | 
                                                        
@@ -3664,22 +3664,22 @@ discard block  | 
                                                    ||
| 3664 | 3664 |  							'y' => $langs->trans('Year') | 
                                                        
| 3665 | 3665 | );  | 
                                                        
| 3666 | 3666 |  						if (isset($da[$outdurationunit])) { | 
                                                        
| 3667 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3667 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3668 | 3668 | }  | 
                                                        
| 3669 | 3669 | }  | 
                                                        
| 3670 | 3670 | }  | 
                                                        
| 3671 | 3671 | |
| 3672 | 3672 | $objRef = $objp->ref;  | 
                                                        
| 3673 | 3673 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3674 | -					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3674 | +					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3675 | 3675 | }  | 
                                                        
| 3676 | 3676 | $objRefFourn = $objp->ref_fourn;  | 
                                                        
| 3677 | 3677 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3678 | -					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3678 | +					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3679 | 3679 | }  | 
                                                        
| 3680 | 3680 | $label = $objp->label;  | 
                                                        
| 3681 | 3681 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3682 | -					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3682 | +					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3683 | 3683 | }  | 
                                                        
| 3684 | 3684 | |
| 3685 | 3685 |  				switch ($objp->fk_product_type) { | 
                                                        
@@ -3702,21 +3702,21 @@ discard block  | 
                                                    ||
| 3702 | 3702 | |
| 3703 | 3703 | $optlabel .= $objp->ref;  | 
                                                        
| 3704 | 3704 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3705 | -					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; | 
                                                        |
| 3705 | +					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; | 
                                                        |
| 3706 | 3706 | }  | 
                                                        
| 3707 | 3707 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3708 | -					$optlabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3708 | +					$optlabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3709 | 3709 | }  | 
                                                        
| 3710 | - $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3710 | + $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3711 | 3711 | |
| 3712 | 3712 | $outvallabel = $objRef;  | 
                                                        
| 3713 | 3713 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3714 | -					$outvallabel .= ' (' . $objRefFourn . ')'; | 
                                                        |
| 3714 | +					$outvallabel .= ' ('.$objRefFourn.')'; | 
                                                        |
| 3715 | 3715 | }  | 
                                                        
| 3716 | 3716 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3717 | -					$outvallabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3717 | +					$outvallabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3718 | 3718 | }  | 
                                                        
| 3719 | - $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3719 | + $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3720 | 3720 | |
| 3721 | 3721 | // Units  | 
                                                        
| 3722 | 3722 | $optlabel .= $outvalUnits;  | 
                                                        
@@ -3733,7 +3733,7 @@ discard block  | 
                                                    ||
| 3733 | 3733 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 3734 | 3734 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 3735 | 3735 | |
| 3736 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3736 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3737 | 3737 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3738 | 3738 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 3739 | 3739 |  						if ($price_result >= 0) { | 
                                                        
@@ -3744,57 +3744,57 @@ discard block  | 
                                                    ||
| 3744 | 3744 | }  | 
                                                        
| 3745 | 3745 | }  | 
                                                        
| 3746 | 3746 |  					if ($objp->quantity == 1) { | 
                                                        
| 3747 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3748 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3747 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3748 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3749 | 3749 |  						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3750 | 3750 |  						$outvallabel .= $langs->transnoentities("Unit"); | 
                                                        
| 3751 | 3751 |  					} else { | 
                                                        
| 3752 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3753 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3754 | -						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3755 | -						$outvallabel .= ' ' . $langs->transnoentities("Units"); | 
                                                        |
| 3752 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3753 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3754 | +						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3755 | +						$outvallabel .= ' '.$langs->transnoentities("Units"); | 
                                                        |
| 3756 | 3756 | }  | 
                                                        
| 3757 | 3757 | |
| 3758 | 3758 |  					if ($objp->quantity > 1) { | 
                                                        
| 3759 | -						$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 | 
                                                        |
| 3760 | -						$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 | 
                                                        |
| 3759 | +						$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 | 
                                                        |
| 3760 | +						$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 | 
                                                        |
| 3761 | 3761 | }  | 
                                                        
| 3762 | 3762 |  					if ($objp->remise_percent >= 1) { | 
                                                        
| 3763 | -						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3764 | -						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3763 | +						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3764 | +						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3765 | 3765 | }  | 
                                                        
| 3766 | 3766 |  					if ($objp->duration) { | 
                                                        
| 3767 | - $optlabel .= " - " . $objp->duration;  | 
                                                        |
| 3768 | - $outvallabel .= " - " . $objp->duration;  | 
                                                        |
| 3767 | + $optlabel .= " - ".$objp->duration;  | 
                                                        |
| 3768 | + $outvallabel .= " - ".$objp->duration;  | 
                                                        |
| 3769 | 3769 | }  | 
                                                        
| 3770 | 3770 |  					if (!$socid) { | 
                                                        
| 3771 | - $optlabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3772 | - $outvallabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3771 | + $optlabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3772 | + $outvallabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3773 | 3773 | }  | 
                                                        
| 3774 | 3774 |  					if ($objp->supplier_reputation) { | 
                                                        
| 3775 | 3775 | //TODO dictionary  | 
                                                        
| 3776 | 3776 |  						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); | 
                                                        
| 3777 | 3777 | |
| 3778 | - $optlabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3779 | - $outvallabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3778 | + $optlabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3779 | + $outvallabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3780 | 3780 | }  | 
                                                        
| 3781 | 3781 |  				} else { | 
                                                        
| 3782 | -					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                        |
| 3783 | -					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3782 | +					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                        |
| 3783 | +					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3784 | 3784 | }  | 
                                                        
| 3785 | 3785 | |
| 3786 | 3786 |  				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3787 | 3787 | $novirtualstock = ($showstockinlist == 2);  | 
                                                        
| 3788 | 3788 | |
| 3789 | 3789 |  					if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3790 | -						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3790 | +						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3791 | 3791 | |
| 3792 | 3792 |  						if ($objp->stock > 0) { | 
                                                        
| 3793 | 3793 | $optlabel .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3794 | 3794 |  						} elseif ($objp->stock <= 0) { | 
                                                        
| 3795 | 3795 | $optlabel .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3796 | 3796 | }  | 
                                                        
| 3797 | -						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3797 | +						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3798 | 3798 | $optlabel .= '</span>';  | 
                                                        
| 3799 | 3799 |  						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3800 | 3800 |  							$langs->load("stocks"); | 
                                                        
@@ -3804,9 +3804,9 @@ discard block  | 
                                                    ||
| 3804 | 3804 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3805 | 3805 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3806 | 3806 | |
| 3807 | -							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3807 | +							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3808 | 3808 | |
| 3809 | -							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3809 | +							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3810 | 3810 |  							if ($virtualstock > 0) { | 
                                                        
| 3811 | 3811 | $optlabel .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3812 | 3812 |  							} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3820,7 +3820,7 @@ discard block  | 
                                                    ||
| 3820 | 3820 | }  | 
                                                        
| 3821 | 3821 | }  | 
                                                        
| 3822 | 3822 | |
| 3823 | - $optstart = '<option value="' . $outkey . '"';  | 
                                                        |
| 3823 | + $optstart = '<option value="'.$outkey.'"';  | 
                                                        |
| 3824 | 3824 |  				if ($selected && $selected == $objp->idprodfournprice) { | 
                                                        
| 3825 | 3825 | $optstart .= ' selected';  | 
                                                        
| 3826 | 3826 | }  | 
                                                        
@@ -3829,31 +3829,31 @@ discard block  | 
                                                    ||
| 3829 | 3829 | }  | 
                                                        
| 3830 | 3830 | |
| 3831 | 3831 |  				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { | 
                                                        
| 3832 | - $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';  | 
                                                        |
| 3833 | - $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';  | 
                                                        |
| 3834 | - $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';  | 
                                                        |
| 3835 | - $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';  | 
                                                        |
| 3836 | - $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';  | 
                                                        |
| 3837 | - $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';  | 
                                                        |
| 3838 | - $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';  | 
                                                        |
| 3839 | - $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';  | 
                                                        |
| 3840 | - $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';  | 
                                                        |
| 3841 | - $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';  | 
                                                        |
| 3832 | + $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';  | 
                                                        |
| 3833 | + $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';  | 
                                                        |
| 3834 | + $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';  | 
                                                        |
| 3835 | + $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';  | 
                                                        |
| 3836 | + $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';  | 
                                                        |
| 3837 | + $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';  | 
                                                        |
| 3838 | + $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';  | 
                                                        |
| 3839 | + $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';  | 
                                                        |
| 3840 | + $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';  | 
                                                        |
| 3841 | + $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';  | 
                                                        |
| 3842 | 3842 |  					if (isModEnabled('multicurrency')) { | 
                                                        
| 3843 | - $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';  | 
                                                        |
| 3844 | - $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';  | 
                                                        |
| 3843 | + $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';  | 
                                                        |
| 3844 | + $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';  | 
                                                        |
| 3845 | 3845 | }  | 
                                                        
| 3846 | 3846 | }  | 
                                                        
| 3847 | - $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';  | 
                                                        |
| 3847 | + $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';  | 
                                                        |
| 3848 | 3848 | |
| 3849 | 3849 | $outarrayentry = array(  | 
                                                        
| 3850 | 3850 | 'key' => $outkey,  | 
                                                        
| 3851 | 3851 | 'value' => $outref,  | 
                                                        
| 3852 | 3852 | 'label' => $outvallabel,  | 
                                                        
| 3853 | 3853 | 'qty' => $outqty,  | 
                                                        
| 3854 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3855 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3856 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3854 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3855 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3856 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3857 | 3857 | 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),  | 
                                                        
| 3858 | 3858 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 3859 | 3859 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -3882,17 +3882,17 @@ discard block  | 
                                                    ||
| 3882 | 3882 | // Add new entry  | 
                                                        
| 3883 | 3883 | // "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  | 
                                                        
| 3884 | 3884 | // "label" value of json key array is used by jQuery automatically as text for combo box  | 
                                                        
| 3885 | - $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";  | 
                                                        |
| 3885 | + $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";  | 
                                                        |
| 3886 | 3886 | $outarraypush = array(  | 
                                                        
| 3887 | 3887 | 'key' => $outkey,  | 
                                                        
| 3888 | 3888 | 'value' => $outref,  | 
                                                        
| 3889 | 3889 | 'label' => $outvallabel,  | 
                                                        
| 3890 | 3890 | 'qty' => $outqty,  | 
                                                        
| 3891 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3891 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3892 | 3892 | 'price_qty_ht_locale' => price($objp->fprice),  | 
                                                        
| 3893 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3893 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3894 | 3894 | 'price_unit_ht_locale' => price($objp->unitprice),  | 
                                                        
| 3895 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3895 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3896 | 3896 | 'tva_tx_formated' => price($objp->tva_tx),  | 
                                                        
| 3897 | 3897 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 3898 | 3898 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -3924,7 +3924,7 @@ discard block  | 
                                                    ||
| 3924 | 3924 | |
| 3925 | 3925 | $this->db->free($result);  | 
                                                        
| 3926 | 3926 | |
| 3927 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 3927 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 3928 | 3928 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 3929 | 3929 |  		} else { | 
                                                        
| 3930 | 3930 | dol_print_error($this->db);  | 
                                                        
@@ -3956,43 +3956,43 @@ discard block  | 
                                                    ||
| 3956 | 3956 | $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";  | 
                                                        
| 3957 | 3957 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";  | 
                                                        
| 3958 | 3958 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";  | 
                                                        
| 3959 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3960 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 3961 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3962 | -		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; | 
                                                        |
| 3959 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3960 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 3961 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3962 | +		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; | 
                                                        |
| 3963 | 3963 | $sql .= " AND p.tobuy = 1";  | 
                                                        
| 3964 | 3964 | $sql .= " AND s.fournisseur = 1";  | 
                                                        
| 3965 | - $sql .= " AND p.rowid = " . ((int) $productid);  | 
                                                        |
| 3965 | + $sql .= " AND p.rowid = ".((int) $productid);  | 
                                                        |
| 3966 | 3966 |  		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { | 
                                                        
| 3967 | 3967 | $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";  | 
                                                        
| 3968 | 3968 |  		} else { | 
                                                        
| 3969 | 3969 | $sql .= " ORDER BY pfp.unitprice ASC";  | 
                                                        
| 3970 | 3970 | }  | 
                                                        
| 3971 | 3971 | |
| 3972 | - dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 3972 | + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 3973 | 3973 | $result = $this->db->query($sql);  | 
                                                        
| 3974 | 3974 | |
| 3975 | 3975 |  		if ($result) { | 
                                                        
| 3976 | 3976 | $num = $this->db->num_rows($result);  | 
                                                        
| 3977 | 3977 | |
| 3978 | - $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3978 | + $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3979 | 3979 | |
| 3980 | 3980 |  			if (!$num) { | 
                                                        
| 3981 | -				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; | 
                                                        |
| 3981 | +				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; | 
                                                        |
| 3982 | 3982 |  			} else { | 
                                                        
| 3983 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3983 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3984 | 3984 | $form .= '<option value="0"> </option>';  | 
                                                        
| 3985 | 3985 | |
| 3986 | 3986 | $i = 0;  | 
                                                        
| 3987 | 3987 |  				while ($i < $num) { | 
                                                        
| 3988 | 3988 | $objp = $this->db->fetch_object($result);  | 
                                                        
| 3989 | 3989 | |
| 3990 | - $opt = '<option value="' . $objp->idprodfournprice . '"';  | 
                                                        |
| 3990 | + $opt = '<option value="'.$objp->idprodfournprice.'"';  | 
                                                        |
| 3991 | 3991 | //if there is only one supplier, preselect it  | 
                                                        
| 3992 | 3992 |  					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { | 
                                                        
| 3993 | 3993 | $opt .= ' selected';  | 
                                                        
| 3994 | 3994 | }  | 
                                                        
| 3995 | - $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';  | 
                                                        |
| 3995 | + $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';  | 
                                                        |
| 3996 | 3996 | |
| 3997 | 3997 |  					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { | 
                                                        
| 3998 | 3998 | $prod_supplier = new ProductFournisseur($this->db);  | 
                                                        
@@ -4002,7 +4002,7 @@ discard block  | 
                                                    ||
| 4002 | 4002 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 4003 | 4003 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 4004 | 4004 | |
| 4005 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 4005 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 4006 | 4006 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 4007 | 4007 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 4008 | 4008 |  						if ($price_result >= 0) { | 
                                                        
@@ -4013,10 +4013,10 @@ discard block  | 
                                                    ||
| 4013 | 4013 | }  | 
                                                        
| 4014 | 4014 | }  | 
                                                        
| 4015 | 4015 |  					if ($objp->quantity == 1) { | 
                                                        
| 4016 | -						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 4016 | +						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 4017 | 4017 | }  | 
                                                        
| 4018 | 4018 | |
| 4019 | - $opt .= $objp->quantity . ' ';  | 
                                                        |
| 4019 | + $opt .= $objp->quantity.' ';  | 
                                                        |
| 4020 | 4020 | |
| 4021 | 4021 |  					if ($objp->quantity == 1) { | 
                                                        
| 4022 | 4022 |  						$opt .= $langs->trans("Unit"); | 
                                                        
@@ -4025,10 +4025,10 @@ discard block  | 
                                                    ||
| 4025 | 4025 | }  | 
                                                        
| 4026 | 4026 |  					if ($objp->quantity > 1) { | 
                                                        
| 4027 | 4027 | $opt .= " - ";  | 
                                                        
| 4028 | -						$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"); | 
                                                        |
| 4028 | +						$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"); | 
                                                        |
| 4029 | 4029 | }  | 
                                                        
| 4030 | 4030 |  					if ($objp->duration) { | 
                                                        
| 4031 | - $opt .= " - " . $objp->duration;  | 
                                                        |
| 4031 | + $opt .= " - ".$objp->duration;  | 
                                                        |
| 4032 | 4032 | }  | 
                                                        
| 4033 | 4033 | $opt .= "</option>\n";  | 
                                                        
| 4034 | 4034 | |
@@ -4066,8 +4066,8 @@ discard block  | 
                                                    ||
| 4066 | 4066 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 4067 | 4067 | |
| 4068 | 4068 | $sql = "SELECT rowid, code, libelle as label, deposit_percent";  | 
                                                        
| 4069 | - $sql .= " FROM " . $this->db->prefix() . 'c_payment_term';  | 
                                                        |
| 4070 | -		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; | 
                                                        |
| 4069 | + $sql .= " FROM ".$this->db->prefix().'c_payment_term';  | 
                                                        |
| 4070 | +		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; | 
                                                        |
| 4071 | 4071 | $sql .= " AND active > 0";  | 
                                                        
| 4072 | 4072 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4073 | 4073 | |
@@ -4079,7 +4079,7 @@ discard block  | 
                                                    ||
| 4079 | 4079 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4080 | 4080 | |
| 4081 | 4081 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4082 | -				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4082 | +				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4083 | 4083 | $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4084 | 4084 | $this->cache_conditions_paiements[$obj->rowid]['label'] = $label;  | 
                                                        
| 4085 | 4085 | $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;  | 
                                                        
@@ -4107,7 +4107,7 @@ discard block  | 
                                                    ||
| 4107 | 4107 | // phpcs:enable  | 
                                                        
| 4108 | 4108 | global $langs;  | 
                                                        
| 4109 | 4109 | |
| 4110 | - $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4110 | + $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4111 | 4111 |  		if ($num > 0) { | 
                                                        
| 4112 | 4112 | return 0; // Cache already loaded  | 
                                                        
| 4113 | 4113 | }  | 
                                                        
@@ -4117,7 +4117,7 @@ discard block  | 
                                                    ||
| 4117 | 4117 |  		$langs->load('propal'); | 
                                                        
| 4118 | 4118 | |
| 4119 | 4119 | $sql = "SELECT rowid, code, label, position";  | 
                                                        
| 4120 | - $sql .= " FROM " . $this->db->prefix() . 'c_availability';  | 
                                                        |
| 4120 | + $sql .= " FROM ".$this->db->prefix().'c_availability';  | 
                                                        |
| 4121 | 4121 | $sql .= " WHERE active > 0";  | 
                                                        
| 4122 | 4122 | |
| 4123 | 4123 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4128,7 +4128,7 @@ discard block  | 
                                                    ||
| 4128 | 4128 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4129 | 4129 | |
| 4130 | 4130 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4131 | -				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4131 | +				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4132 | 4132 | $this->cache_availability[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4133 | 4133 | $this->cache_availability[$obj->rowid]['label'] = $label;  | 
                                                        
| 4134 | 4134 | $this->cache_availability[$obj->rowid]['position'] = $obj->position;  | 
                                                        
@@ -4160,17 +4160,17 @@ discard block  | 
                                                    ||
| 4160 | 4160 | |
| 4161 | 4161 | $this->load_cache_availability();  | 
                                                        
| 4162 | 4162 | |
| 4163 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4163 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4164 | 4164 | |
| 4165 | - print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4165 | + print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4166 | 4166 |  		if ($addempty) { | 
                                                        
| 4167 | 4167 | print '<option value="0"> </option>';  | 
                                                        
| 4168 | 4168 | }  | 
                                                        
| 4169 | 4169 |  		foreach ($this->cache_availability as $id => $arrayavailability) { | 
                                                        
| 4170 | 4170 |  			if ($selected == $id) { | 
                                                        
| 4171 | - print '<option value="' . $id . '" selected>';  | 
                                                        |
| 4171 | + print '<option value="'.$id.'" selected>';  | 
                                                        |
| 4172 | 4172 |  			} else { | 
                                                        
| 4173 | - print '<option value="' . $id . '">';  | 
                                                        |
| 4173 | + print '<option value="'.$id.'">';  | 
                                                        |
| 4174 | 4174 | }  | 
                                                        
| 4175 | 4175 | print dol_escape_htmltag($arrayavailability['label']);  | 
                                                        
| 4176 | 4176 | print '</option>';  | 
                                                        
@@ -4191,13 +4191,13 @@ discard block  | 
                                                    ||
| 4191 | 4191 |  	{ | 
                                                        
| 4192 | 4192 | global $langs;  | 
                                                        
| 4193 | 4193 | |
| 4194 | - $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4194 | + $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4195 | 4195 |  		if ($num > 0) { | 
                                                        
| 4196 | 4196 | return 0; // Cache already loaded  | 
                                                        
| 4197 | 4197 | }  | 
                                                        
| 4198 | 4198 | |
| 4199 | 4199 | $sql = "SELECT rowid, code, label";  | 
                                                        
| 4200 | - $sql .= " FROM " . $this->db->prefix() . 'c_input_reason';  | 
                                                        |
| 4200 | + $sql .= " FROM ".$this->db->prefix().'c_input_reason';  | 
                                                        |
| 4201 | 4201 | $sql .= " WHERE active > 0";  | 
                                                        
| 4202 | 4202 | |
| 4203 | 4203 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4210,8 +4210,8 @@ discard block  | 
                                                    ||
| 4210 | 4210 | |
| 4211 | 4211 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4212 | 4212 | $label = ($obj->label != '-' ? $obj->label : '');  | 
                                                        
| 4213 | -				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { | 
                                                        |
| 4214 | -					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4213 | +				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { | 
                                                        |
| 4214 | +					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4215 | 4215 | }  | 
                                                        
| 4216 | 4216 |  				if ($langs->trans($obj->code) != $obj->code) { | 
                                                        
| 4217 | 4217 | $label = $langs->trans($obj->code); // So translation key SRC_XXX will work  | 
                                                        
@@ -4251,9 +4251,9 @@ discard block  | 
                                                    ||
| 4251 | 4251 | |
| 4252 | 4252 | $this->loadCacheInputReason();  | 
                                                        
| 4253 | 4253 | |
| 4254 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4254 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4255 | 4255 |  		if ($addempty) { | 
                                                        
| 4256 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 4256 | + print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 4257 | 4257 | }  | 
                                                        
| 4258 | 4258 |  		foreach ($this->cache_demand_reason as $id => $arraydemandreason) { | 
                                                        
| 4259 | 4259 |  			if ($arraydemandreason['code'] == $exclude) { | 
                                                        
@@ -4261,9 +4261,9 @@ discard block  | 
                                                    ||
| 4261 | 4261 | }  | 
                                                        
| 4262 | 4262 | |
| 4263 | 4263 |  			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { | 
                                                        
| 4264 | - print '<option value="' . $arraydemandreason['id'] . '" selected>';  | 
                                                        |
| 4264 | + print '<option value="'.$arraydemandreason['id'].'" selected>';  | 
                                                        |
| 4265 | 4265 |  			} else { | 
                                                        
| 4266 | - print '<option value="' . $arraydemandreason['id'] . '">';  | 
                                                        |
| 4266 | + print '<option value="'.$arraydemandreason['id'].'">';  | 
                                                        |
| 4267 | 4267 | }  | 
                                                        
| 4268 | 4268 | $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason  | 
                                                        
| 4269 | 4269 | print $langs->trans($label);  | 
                                                        
@@ -4273,7 +4273,7 @@ discard block  | 
                                                    ||
| 4273 | 4273 |  		if ($user->admin && empty($notooltip)) { | 
                                                        
| 4274 | 4274 |  			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4275 | 4275 | }  | 
                                                        
| 4276 | -		print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4276 | +		print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4277 | 4277 | }  | 
                                                        
| 4278 | 4278 | |
| 4279 | 4279 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        
@@ -4288,7 +4288,7 @@ discard block  | 
                                                    ||
| 4288 | 4288 | // phpcs:enable  | 
                                                        
| 4289 | 4289 | global $langs;  | 
                                                        
| 4290 | 4290 | |
| 4291 | - $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4291 | + $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4292 | 4292 |  		if ($num > 0) { | 
                                                        
| 4293 | 4293 | return $num; // Cache already loaded  | 
                                                        
| 4294 | 4294 | }  | 
                                                        
@@ -4298,8 +4298,8 @@ discard block  | 
                                                    ||
| 4298 | 4298 | $this->cache_types_paiements = array();  | 
                                                        
| 4299 | 4299 | |
| 4300 | 4300 | $sql = "SELECT id, code, libelle as label, type, active";  | 
                                                        
| 4301 | - $sql .= " FROM " . $this->db->prefix() . "c_paiement";  | 
                                                        |
| 4302 | -		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; | 
                                                        |
| 4301 | + $sql .= " FROM ".$this->db->prefix()."c_paiement";  | 
                                                        |
| 4302 | +		$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; | 
                                                        |
| 4303 | 4303 | |
| 4304 | 4304 | $resql = $this->db->query($sql);  | 
                                                        
| 4305 | 4305 |  		if ($resql) { | 
                                                        
@@ -4309,7 +4309,7 @@ discard block  | 
                                                    ||
| 4309 | 4309 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4310 | 4310 | |
| 4311 | 4311 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4312 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4312 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4313 | 4313 | $this->cache_types_paiements[$obj->id]['id'] = $obj->id;  | 
                                                        
| 4314 | 4314 | $this->cache_types_paiements[$obj->id]['code'] = $obj->code;  | 
                                                        
| 4315 | 4315 | $this->cache_types_paiements[$obj->id]['label'] = $label;  | 
                                                        
@@ -4381,17 +4381,17 @@ discard block  | 
                                                    ||
| 4381 | 4381 | global $langs, $user, $conf;  | 
                                                        
| 4382 | 4382 | |
| 4383 | 4383 | $out = '';  | 
                                                        
| 4384 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4384 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4385 | 4385 | |
| 4386 | 4386 | $this->load_cache_conditions_paiements();  | 
                                                        
| 4387 | 4387 | |
| 4388 | 4388 | // Set default value if not already set by caller  | 
                                                        
| 4389 | 4389 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { | 
                                                        
| 4390 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4390 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4391 | 4391 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); | 
                                                        
| 4392 | 4392 | }  | 
                                                        
| 4393 | 4393 | |
| 4394 | - $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4394 | + $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4395 | 4395 |  		if ($addempty) { | 
                                                        
| 4396 | 4396 | $out .= '<option value="0"> </option>';  | 
                                                        
| 4397 | 4397 | }  | 
                                                        
@@ -4405,9 +4405,9 @@ discard block  | 
                                                    ||
| 4405 | 4405 | |
| 4406 | 4406 |  			if ($selected == $id) { | 
                                                        
| 4407 | 4407 | $selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];  | 
                                                        
| 4408 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';  | 
                                                        |
| 4408 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';  | 
                                                        |
| 4409 | 4409 |  			} else { | 
                                                        
| 4410 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';  | 
                                                        |
| 4410 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';  | 
                                                        |
| 4411 | 4411 | }  | 
                                                        
| 4412 | 4412 | $label = $arrayconditions['label'];  | 
                                                        
| 4413 | 4413 | |
@@ -4425,21 +4425,21 @@ discard block  | 
                                                    ||
| 4425 | 4425 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 4426 | 4426 | |
| 4427 | 4427 |  		if ($deposit_percent >= 0) { | 
                                                        
| 4428 | - $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';  | 
                                                        |
| 4429 | -			$out .= $langs->trans('DepositPercent') . ' : '; | 
                                                        |
| 4430 | - $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';  | 
                                                        |
| 4428 | + $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';  | 
                                                        |
| 4429 | +			$out .= $langs->trans('DepositPercent').' : '; | 
                                                        |
| 4430 | + $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';  | 
                                                        |
| 4431 | 4431 | $out .= '</span>';  | 
                                                        
| 4432 | 4432 | $out .= '  | 
                                                        
| 4433 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 4433 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 4434 | 4434 |  					$(document).ready(function () { | 
                                                        
| 4435 | -						$("#' . $htmlname . '").change(function () { | 
                                                        |
| 4435 | +						$("#' . $htmlname.'").change(function () { | 
                                                        |
| 4436 | 4436 |  							let $selected = $(this).find("option:selected"); | 
                                                        
| 4437 | 4437 |  							let depositPercent = $selected.attr("data-deposit_percent"); | 
                                                        
| 4438 | 4438 | |
| 4439 | 4439 |  							if (depositPercent.length > 0) { | 
                                                        
| 4440 | -								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); | 
                                                        |
| 4440 | +								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); | 
                                                        |
| 4441 | 4441 |  							} else { | 
                                                        
| 4442 | -								$("#' . $htmlname . '_deposit_percent_container").hide(); | 
                                                        |
| 4442 | +								$("#' . $htmlname.'_deposit_percent_container").hide(); | 
                                                        |
| 4443 | 4443 | }  | 
                                                        
| 4444 | 4444 | |
| 4445 | 4445 | return true;  | 
                                                        
@@ -4477,7 +4477,7 @@ discard block  | 
                                                    ||
| 4477 | 4477 | |
| 4478 | 4478 | $out = '';  | 
                                                        
| 4479 | 4479 | |
| 4480 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4480 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4481 | 4481 | |
| 4482 | 4482 | $filterarray = array();  | 
                                                        
| 4483 | 4483 |  		if ($filtertype == 'CRDT') { | 
                                                        
@@ -4492,11 +4492,11 @@ discard block  | 
                                                    ||
| 4492 | 4492 | |
| 4493 | 4493 | // Set default value if not already set by caller  | 
                                                        
| 4494 | 4494 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { | 
                                                        
| 4495 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4495 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4496 | 4496 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); | 
                                                        
| 4497 | 4497 | }  | 
                                                        
| 4498 | 4498 | |
| 4499 | - $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4499 | + $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4500 | 4500 |  		if ($empty) { | 
                                                        
| 4501 | 4501 | $out .= '<option value=""> </option>';  | 
                                                        
| 4502 | 4502 | }  | 
                                                        
@@ -4517,13 +4517,13 @@ discard block  | 
                                                    ||
| 4517 | 4517 | }  | 
                                                        
| 4518 | 4518 | |
| 4519 | 4519 |  			if ($format == 0) { | 
                                                        
| 4520 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4520 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4521 | 4521 |  			} elseif ($format == 1) { | 
                                                        
| 4522 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4522 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4523 | 4523 |  			} elseif ($format == 2) { | 
                                                        
| 4524 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4524 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4525 | 4525 |  			} elseif ($format == 3) { | 
                                                        
| 4526 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4526 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4527 | 4527 | }  | 
                                                        
| 4528 | 4528 | // Print attribute selected or not  | 
                                                        
| 4529 | 4529 |  			if ($format == 1 || $format == 2) { | 
                                                        
@@ -4553,7 +4553,7 @@ discard block  | 
                                                    ||
| 4553 | 4553 |  		if ($user->admin && !$noadmininfo) { | 
                                                        
| 4554 | 4554 |  			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4555 | 4555 | }  | 
                                                        
| 4556 | -		$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4556 | +		$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4557 | 4557 | |
| 4558 | 4558 |  		if (empty($nooutput)) { | 
                                                        
| 4559 | 4559 | print $out;  | 
                                                        
@@ -4575,22 +4575,22 @@ discard block  | 
                                                    ||
| 4575 | 4575 |  	{ | 
                                                        
| 4576 | 4576 | global $langs;  | 
                                                        
| 4577 | 4577 | |
| 4578 | - $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4578 | + $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4579 | 4579 | $options = array(  | 
                                                        
| 4580 | 4580 |  			'HT' => $langs->trans("HT"), | 
                                                        
| 4581 | 4581 |  			'TTC' => $langs->trans("TTC") | 
                                                        
| 4582 | 4582 | );  | 
                                                        
| 4583 | 4583 |  		foreach ($options as $id => $value) { | 
                                                        
| 4584 | 4584 |  			if ($selected == $id) { | 
                                                        
| 4585 | - $return .= '<option value="' . $id . '" selected>' . $value;  | 
                                                        |
| 4585 | + $return .= '<option value="'.$id.'" selected>'.$value;  | 
                                                        |
| 4586 | 4586 |  			} else { | 
                                                        
| 4587 | - $return .= '<option value="' . $id . '">' . $value;  | 
                                                        |
| 4587 | + $return .= '<option value="'.$id.'">'.$value;  | 
                                                        |
| 4588 | 4588 | }  | 
                                                        
| 4589 | 4589 | $return .= '</option>';  | 
                                                        
| 4590 | 4590 | }  | 
                                                        
| 4591 | 4591 | $return .= '</select>';  | 
                                                        
| 4592 | 4592 |  		if ($addjscombo) { | 
                                                        
| 4593 | -			$return .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4593 | +			$return .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4594 | 4594 | }  | 
                                                        
| 4595 | 4595 | |
| 4596 | 4596 | return $return;  | 
                                                        
@@ -4608,7 +4608,7 @@ discard block  | 
                                                    ||
| 4608 | 4608 | // phpcs:enable  | 
                                                        
| 4609 | 4609 | global $langs;  | 
                                                        
| 4610 | 4610 | |
| 4611 | - $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4611 | + $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4612 | 4612 |  		if ($num > 0) { | 
                                                        
| 4613 | 4613 | return $num; // Cache already loaded  | 
                                                        
| 4614 | 4614 | }  | 
                                                        
@@ -4618,8 +4618,8 @@ discard block  | 
                                                    ||
| 4618 | 4618 | $this->cache_transport_mode = array();  | 
                                                        
| 4619 | 4619 | |
| 4620 | 4620 | $sql = "SELECT rowid, code, label, active";  | 
                                                        
| 4621 | - $sql .= " FROM " . $this->db->prefix() . "c_transport_mode";  | 
                                                        |
| 4622 | -		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; | 
                                                        |
| 4621 | + $sql .= " FROM ".$this->db->prefix()."c_transport_mode";  | 
                                                        |
| 4622 | +		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; | 
                                                        |
| 4623 | 4623 | |
| 4624 | 4624 | $resql = $this->db->query($sql);  | 
                                                        
| 4625 | 4625 |  		if ($resql) { | 
                                                        
@@ -4629,7 +4629,7 @@ discard block  | 
                                                    ||
| 4629 | 4629 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4630 | 4630 | |
| 4631 | 4631 | // If traduction exist, we use it else we take the default label  | 
                                                        
| 4632 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4632 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4633 | 4633 | $this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 4634 | 4634 | $this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4635 | 4635 | $this->cache_transport_mode[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -4663,11 +4663,11 @@ discard block  | 
                                                    ||
| 4663 | 4663 |  	{ | 
                                                        
| 4664 | 4664 | global $langs, $user;  | 
                                                        
| 4665 | 4665 | |
| 4666 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4666 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4667 | 4667 | |
| 4668 | 4668 | $this->load_cache_transport_mode();  | 
                                                        
| 4669 | 4669 | |
| 4670 | - print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4670 | + print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4671 | 4671 |  		if ($empty) { | 
                                                        
| 4672 | 4672 | print '<option value=""> </option>';  | 
                                                        
| 4673 | 4673 | }  | 
                                                        
@@ -4683,13 +4683,13 @@ discard block  | 
                                                    ||
| 4683 | 4683 | }  | 
                                                        
| 4684 | 4684 | |
| 4685 | 4685 |  			if ($format == 0) { | 
                                                        
| 4686 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4686 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4687 | 4687 |  			} elseif ($format == 1) { | 
                                                        
| 4688 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4688 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4689 | 4689 |  			} elseif ($format == 2) { | 
                                                        
| 4690 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4690 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4691 | 4691 |  			} elseif ($format == 3) { | 
                                                        
| 4692 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4692 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4693 | 4693 | }  | 
                                                        
| 4694 | 4694 | // If text is selected, we compare with code, else with id  | 
                                                        
| 4695 | 4695 |  			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { | 
                                                        
@@ -4737,31 +4737,31 @@ discard block  | 
                                                    ||
| 4737 | 4737 |  		$langs->load("deliveries"); | 
                                                        
| 4738 | 4738 | |
| 4739 | 4739 | $sql = "SELECT rowid, code, libelle as label";  | 
                                                        
| 4740 | - $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";  | 
                                                        |
| 4740 | + $sql .= " FROM ".$this->db->prefix()."c_shipment_mode";  | 
                                                        |
| 4741 | 4741 | $sql .= " WHERE active > 0";  | 
                                                        
| 4742 | 4742 |  		if ($filtre) { | 
                                                        
| 4743 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4743 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4744 | 4744 | }  | 
                                                        
| 4745 | 4745 | $sql .= " ORDER BY libelle ASC";  | 
                                                        
| 4746 | 4746 | |
| 4747 | - dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4747 | + dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4748 | 4748 | $result = $this->db->query($sql);  | 
                                                        
| 4749 | 4749 |  		if ($result) { | 
                                                        
| 4750 | 4750 | $num = $this->db->num_rows($result);  | 
                                                        
| 4751 | 4751 | $i = 0;  | 
                                                        
| 4752 | 4752 |  			if ($num) { | 
                                                        
| 4753 | - print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4753 | + print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4754 | 4754 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4755 | 4755 | print '<option value="-1"> </option>';  | 
                                                        
| 4756 | 4756 | }  | 
                                                        
| 4757 | 4757 |  				while ($i < $num) { | 
                                                        
| 4758 | 4758 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4759 | 4759 |  					if ($selected == $obj->rowid) { | 
                                                        
| 4760 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 4760 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 4761 | 4761 |  					} else { | 
                                                        
| 4762 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 4762 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 4763 | 4763 | }  | 
                                                        
| 4764 | -					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4764 | +					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4765 | 4765 | print '</option>';  | 
                                                        
| 4766 | 4766 | $i++;  | 
                                                        
| 4767 | 4767 | }  | 
                                                        
@@ -4770,7 +4770,7 @@ discard block  | 
                                                    ||
| 4770 | 4770 |  					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4771 | 4771 | }  | 
                                                        
| 4772 | 4772 | |
| 4773 | -				print ajax_combobox('select' . $htmlname); | 
                                                        |
| 4773 | +				print ajax_combobox('select'.$htmlname); | 
                                                        |
| 4774 | 4774 |  			} else { | 
                                                        
| 4775 | 4775 |  				print $langs->trans("NoShippingMethodDefined"); | 
                                                        
| 4776 | 4776 | }  | 
                                                        
@@ -4795,16 +4795,16 @@ discard block  | 
                                                    ||
| 4795 | 4795 |  		$langs->load("deliveries"); | 
                                                        
| 4796 | 4796 | |
| 4797 | 4797 |  		if ($htmlname != "none") { | 
                                                        
| 4798 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 4798 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 4799 | 4799 | print '<input type="hidden" name="action" value="setshippingmethod">';  | 
                                                        
| 4800 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 4800 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 4801 | 4801 | $this->selectShippingMethod($selected, $htmlname, '', $addempty);  | 
                                                        
| 4802 | -			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 4802 | +			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 4803 | 4803 | print '</form>';  | 
                                                        
| 4804 | 4804 |  		} else { | 
                                                        
| 4805 | 4805 |  			if ($selected) { | 
                                                        
| 4806 | 4806 | $code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');  | 
                                                        
| 4807 | -				print $langs->trans("SendingMethod" . strtoupper($code)); | 
                                                        |
| 4807 | +				print $langs->trans("SendingMethod".strtoupper($code)); | 
                                                        |
| 4808 | 4808 |  			} else { | 
                                                        
| 4809 | 4809 | print " ";  | 
                                                        
| 4810 | 4810 | }  | 
                                                        
@@ -4827,10 +4827,10 @@ discard block  | 
                                                    ||
| 4827 | 4827 | |
| 4828 | 4828 | $opt = '<option value="" selected></option>';  | 
                                                        
| 4829 | 4829 | $sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";  | 
                                                        
| 4830 | - $sql .= ' FROM ' . $this->db->prefix() . 'facture';  | 
                                                        |
| 4831 | -		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; | 
                                                        |
| 4830 | + $sql .= ' FROM '.$this->db->prefix().'facture';  | 
                                                        |
| 4831 | +		$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; | 
                                                        |
| 4832 | 4832 | $sql .= ' AND situation_counter >= 1';  | 
                                                        
| 4833 | - $sql .= ' AND fk_soc = ' . (int) $socid;  | 
                                                        |
| 4833 | + $sql .= ' AND fk_soc = '.(int) $socid;  | 
                                                        |
| 4834 | 4834 | $sql .= ' AND type <> 2';  | 
                                                        
| 4835 | 4835 | $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';  | 
                                                        
| 4836 | 4836 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4848,19 +4848,19 @@ discard block  | 
                                                    ||
| 4848 | 4848 | //Not prov?  | 
                                                        
| 4849 | 4849 |  						if (substr($obj->ref, 1, 4) != 'PROV') { | 
                                                        
| 4850 | 4850 |  							if ($selected == $obj->rowid) { | 
                                                        
| 4851 | - $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';  | 
                                                        |
| 4851 | + $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';  | 
                                                        |
| 4852 | 4852 |  							} else { | 
                                                        
| 4853 | - $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';  | 
                                                        |
| 4853 | + $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';  | 
                                                        |
| 4854 | 4854 | }  | 
                                                        
| 4855 | 4855 | }  | 
                                                        
| 4856 | 4856 | }  | 
                                                        
| 4857 | 4857 | }  | 
                                                        
| 4858 | 4858 | }  | 
                                                        
| 4859 | 4859 |  		} else { | 
                                                        
| 4860 | -			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); | 
                                                        |
| 4860 | +			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); | 
                                                        |
| 4861 | 4861 | }  | 
                                                        
| 4862 | 4862 |  		if ($opt == '<option value ="" selected></option>') { | 
                                                        
| 4863 | -			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; | 
                                                        |
| 4863 | +			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; | 
                                                        |
| 4864 | 4864 | }  | 
                                                        
| 4865 | 4865 | return $opt;  | 
                                                        
| 4866 | 4866 | }  | 
                                                        
@@ -4880,12 +4880,12 @@ discard block  | 
                                                    ||
| 4880 | 4880 | |
| 4881 | 4881 |  		$langs->load('products'); | 
                                                        
| 4882 | 4882 | |
| 4883 | - $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4883 | + $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4884 | 4884 | |
| 4885 | - $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";  | 
                                                        |
| 4885 | + $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";  | 
                                                        |
| 4886 | 4886 | $sql .= ' WHERE active > 0';  | 
                                                        
| 4887 | 4887 |  		if (!empty($unit_type)) { | 
                                                        
| 4888 | - $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";  | 
                                                        |
| 4888 | + $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";  | 
                                                        |
| 4889 | 4889 | }  | 
                                                        
| 4890 | 4890 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4891 | 4891 | |
@@ -4897,14 +4897,14 @@ discard block  | 
                                                    ||
| 4897 | 4897 | |
| 4898 | 4898 |  			while ($res = $this->db->fetch_object($resql)) { | 
                                                        
| 4899 | 4899 | $unitLabel = $res->label;  | 
                                                        
| 4900 | -				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before | 
                                                        |
| 4901 | -					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; | 
                                                        |
| 4900 | +				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before | 
                                                        |
| 4901 | +					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; | 
                                                        |
| 4902 | 4902 | }  | 
                                                        
| 4903 | 4903 | |
| 4904 | 4904 |  				if ($selected == $res->rowid) { | 
                                                        
| 4905 | - $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';  | 
                                                        |
| 4905 | + $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';  | 
                                                        |
| 4906 | 4906 |  				} else { | 
                                                        
| 4907 | - $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';  | 
                                                        |
| 4907 | + $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';  | 
                                                        |
| 4908 | 4908 | }  | 
                                                        
| 4909 | 4909 | }  | 
                                                        
| 4910 | 4910 | $return .= '</select>';  | 
                                                        
@@ -4939,23 +4939,23 @@ discard block  | 
                                                    ||
| 4939 | 4939 | $num = 0;  | 
                                                        
| 4940 | 4940 | |
| 4941 | 4941 | $sql = "SELECT rowid, label, bank, clos as status, currency_code";  | 
                                                        
| 4942 | - $sql .= " FROM " . $this->db->prefix() . "bank_account";  | 
                                                        |
| 4943 | -		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; | 
                                                        |
| 4942 | + $sql .= " FROM ".$this->db->prefix()."bank_account";  | 
                                                        |
| 4943 | +		$sql .= " WHERE entity IN (".getEntity('bank_account').")"; | 
                                                        |
| 4944 | 4944 |  		if ($status != 2) { | 
                                                        
| 4945 | - $sql .= " AND clos = " . (int) $status;  | 
                                                        |
| 4945 | + $sql .= " AND clos = ".(int) $status;  | 
                                                        |
| 4946 | 4946 | }  | 
                                                        
| 4947 | 4947 |  		if ($filtre) {	// TODO Support USF | 
                                                        
| 4948 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4948 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4949 | 4949 | }  | 
                                                        
| 4950 | 4950 | $sql .= " ORDER BY label";  | 
                                                        
| 4951 | 4951 | |
| 4952 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);  | 
                                                        |
| 4952 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);  | 
                                                        |
| 4953 | 4953 | $result = $this->db->query($sql);  | 
                                                        
| 4954 | 4954 |  		if ($result) { | 
                                                        
| 4955 | 4955 | $num = $this->db->num_rows($result);  | 
                                                        
| 4956 | 4956 | $i = 0;  | 
                                                        
| 4957 | 4957 |  			if ($num) { | 
                                                        
| 4958 | - $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4958 | + $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4959 | 4959 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4960 | 4960 | $out .= '<option value="-1"> </option>';  | 
                                                        
| 4961 | 4961 | }  | 
                                                        
@@ -4963,27 +4963,27 @@ discard block  | 
                                                    ||
| 4963 | 4963 |  				while ($i < $num) { | 
                                                        
| 4964 | 4964 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4965 | 4965 |  					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                        
| 4966 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';  | 
                                                        |
| 4966 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';  | 
                                                        |
| 4967 | 4967 |  					} else { | 
                                                        
| 4968 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';  | 
                                                        |
| 4968 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';  | 
                                                        |
| 4969 | 4969 | }  | 
                                                        
| 4970 | 4970 | $out .= trim($obj->label);  | 
                                                        
| 4971 | 4971 |  					if ($showcurrency) { | 
                                                        
| 4972 | -						$out .= ' (' . $obj->currency_code . ')'; | 
                                                        |
| 4972 | +						$out .= ' ('.$obj->currency_code.')'; | 
                                                        |
| 4973 | 4973 | }  | 
                                                        
| 4974 | 4974 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 4975 | -						$out .= ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 4975 | +						$out .= ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 4976 | 4976 | }  | 
                                                        
| 4977 | 4977 | $out .= '</option>';  | 
                                                        
| 4978 | 4978 | $i++;  | 
                                                        
| 4979 | 4979 | }  | 
                                                        
| 4980 | 4980 | $out .= "</select>";  | 
                                                        
| 4981 | -				$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4981 | +				$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4982 | 4982 |  			} else { | 
                                                        
| 4983 | 4983 |  				if ($status == 0) { | 
                                                        
| 4984 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; | 
                                                        |
| 4984 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; | 
                                                        |
| 4985 | 4985 |  				} else { | 
                                                        
| 4986 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; | 
                                                        |
| 4986 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; | 
                                                        |
| 4987 | 4987 | }  | 
                                                        
| 4988 | 4988 | }  | 
                                                        
| 4989 | 4989 |  		} else { | 
                                                        
@@ -5019,23 +5019,23 @@ discard block  | 
                                                    ||
| 5019 | 5019 | $num = 0;  | 
                                                        
| 5020 | 5020 | |
| 5021 | 5021 | $sql = "SELECT rowid, name, fk_country, status, entity";  | 
                                                        
| 5022 | - $sql .= " FROM " . $this->db->prefix() . "establishment";  | 
                                                        |
| 5022 | + $sql .= " FROM ".$this->db->prefix()."establishment";  | 
                                                        |
| 5023 | 5023 | $sql .= " WHERE 1=1";  | 
                                                        
| 5024 | 5024 |  		if ($status != 2) { | 
                                                        
| 5025 | - $sql .= " AND status = " . (int) $status;  | 
                                                        |
| 5025 | + $sql .= " AND status = ".(int) $status;  | 
                                                        |
| 5026 | 5026 | }  | 
                                                        
| 5027 | 5027 |  		if ($filtre) {	// TODO Support USF | 
                                                        
| 5028 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 5028 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 5029 | 5029 | }  | 
                                                        
| 5030 | 5030 | $sql .= " ORDER BY name";  | 
                                                        
| 5031 | 5031 | |
| 5032 | - dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);  | 
                                                        |
| 5032 | + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);  | 
                                                        |
| 5033 | 5033 | $result = $this->db->query($sql);  | 
                                                        
| 5034 | 5034 |  		if ($result) { | 
                                                        
| 5035 | 5035 | $num = $this->db->num_rows($result);  | 
                                                        
| 5036 | 5036 | $i = 0;  | 
                                                        
| 5037 | 5037 |  			if ($num) { | 
                                                        
| 5038 | - print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 5038 | + print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 5039 | 5039 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5040 | 5040 | print '<option value="-1"> </option>';  | 
                                                        
| 5041 | 5041 | }  | 
                                                        
@@ -5043,13 +5043,13 @@ discard block  | 
                                                    ||
| 5043 | 5043 |  				while ($i < $num) { | 
                                                        
| 5044 | 5044 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 5045 | 5045 |  					if ($selected == $obj->rowid) { | 
                                                        
| 5046 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 5046 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 5047 | 5047 |  					} else { | 
                                                        
| 5048 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 5048 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 5049 | 5049 | }  | 
                                                        
| 5050 | 5050 | print trim($obj->name);  | 
                                                        
| 5051 | 5051 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 5052 | -						print ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 5052 | +						print ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 5053 | 5053 | }  | 
                                                        
| 5054 | 5054 | print '</option>';  | 
                                                        
| 5055 | 5055 | $i++;  | 
                                                        
@@ -5057,9 +5057,9 @@ discard block  | 
                                                    ||
| 5057 | 5057 | print "</select>";  | 
                                                        
| 5058 | 5058 |  			} else { | 
                                                        
| 5059 | 5059 |  				if ($status == 0) { | 
                                                        
| 5060 | -					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; | 
                                                        |
| 5060 | +					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; | 
                                                        |
| 5061 | 5061 |  				} else { | 
                                                        
| 5062 | -					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; | 
                                                        |
| 5062 | +					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; | 
                                                        |
| 5063 | 5063 | }  | 
                                                        
| 5064 | 5064 | }  | 
                                                        
| 5065 | 5065 | |
@@ -5083,20 +5083,20 @@ discard block  | 
                                                    ||
| 5083 | 5083 |  	{ | 
                                                        
| 5084 | 5084 | global $langs;  | 
                                                        
| 5085 | 5085 |  		if ($htmlname != "none") { | 
                                                        
| 5086 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5086 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5087 | 5087 | print '<input type="hidden" name="action" value="setbankaccount">';  | 
                                                        
| 5088 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5088 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5089 | 5089 |  			print img_picto('', 'bank_account', 'class="pictofixedwidth"'); | 
                                                        
| 5090 | 5090 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);  | 
                                                        
| 5091 | 5091 |  			if ($nbaccountfound > 0) { | 
                                                        
| 5092 | -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5092 | +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5093 | 5093 | }  | 
                                                        
| 5094 | 5094 | print '</form>';  | 
                                                        
| 5095 | 5095 |  		} else { | 
                                                        
| 5096 | 5096 |  			$langs->load('banks'); | 
                                                        
| 5097 | 5097 | |
| 5098 | 5098 |  			if ($selected) { | 
                                                        
| 5099 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';  | 
                                                        |
| 5099 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';  | 
                                                        |
| 5100 | 5100 | $bankstatic = new Account($this->db);  | 
                                                        
| 5101 | 5101 | $result = $bankstatic->fetch($selected);  | 
                                                        
| 5102 | 5102 |  				if ($result) { | 
                                                        
@@ -5135,19 +5135,19 @@ discard block  | 
                                                    ||
| 5135 | 5135 | global $conf, $langs;  | 
                                                        
| 5136 | 5136 |  		$langs->load("categories"); | 
                                                        
| 5137 | 5137 | |
| 5138 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 5138 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 5139 | 5139 | |
| 5140 | 5140 | // For backward compatibility  | 
                                                        
| 5141 | 5141 |  		if (is_numeric($type)) { | 
                                                        
| 5142 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5142 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5143 | 5143 | }  | 
                                                        
| 5144 | 5144 | |
| 5145 | 5145 |  		if ($type === Categorie::TYPE_BANK_LINE) { | 
                                                        
| 5146 | 5146 | // TODO Move this into common category feature  | 
                                                        
| 5147 | 5147 | $cate_arbo = array();  | 
                                                        
| 5148 | 5148 | $sql = "SELECT c.label, c.rowid";  | 
                                                        
| 5149 | - $sql .= " FROM " . $this->db->prefix() . "bank_categ as c";  | 
                                                        |
| 5150 | - $sql .= " WHERE entity = " . $conf->entity;  | 
                                                        |
| 5149 | + $sql .= " FROM ".$this->db->prefix()."bank_categ as c";  | 
                                                        |
| 5150 | + $sql .= " WHERE entity = ".$conf->entity;  | 
                                                        |
| 5151 | 5151 | $sql .= " ORDER BY c.label";  | 
                                                        
| 5152 | 5152 | $result = $this->db->query($sql);  | 
                                                        
| 5153 | 5153 |  			if ($result) { | 
                                                        
@@ -5173,12 +5173,12 @@ discard block  | 
                                                    ||
| 5173 | 5173 | $outarrayrichhtml = array();  | 
                                                        
| 5174 | 5174 | |
| 5175 | 5175 | |
| 5176 | - $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 5176 | + $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 5177 | 5177 |  		if (is_array($cate_arbo)) { | 
                                                        
| 5178 | 5178 | $num = count($cate_arbo);  | 
                                                        
| 5179 | 5179 | |
| 5180 | 5180 |  			if (!$num) { | 
                                                        
| 5181 | -				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; | 
                                                        |
| 5181 | +				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; | 
                                                        |
| 5182 | 5182 |  			} else { | 
                                                        
| 5183 | 5183 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5184 | 5184 | $output .= '<option value="-1"> </option>';  | 
                                                        
@@ -5190,15 +5190,15 @@ discard block  | 
                                                    ||
| 5190 | 5190 | $add = '';  | 
                                                        
| 5191 | 5191 | }  | 
                                                        
| 5192 | 5192 | |
| 5193 | -					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); | 
                                                        |
| 5193 | +					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); | 
                                                        |
| 5194 | 5194 | $labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5195 | 5195 | |
| 5196 | 5196 | $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];  | 
                                                        
| 5197 | 5197 | |
| 5198 | 5198 | $outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;  | 
                                                        
| 5199 | 5199 | |
| 5200 | - $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';  | 
                                                        |
| 5201 | - $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';  | 
                                                        |
| 5200 | + $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';  | 
                                                        |
| 5201 | + $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';  | 
                                                        |
| 5202 | 5202 | $output .= '>';  | 
                                                        
| 5203 | 5203 | $output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5204 | 5204 | $output .= '</option>';  | 
                                                        
@@ -5240,7 +5240,7 @@ discard block  | 
                                                    ||
| 5240 | 5240 | public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)  | 
                                                        
| 5241 | 5241 |  	{ | 
                                                        
| 5242 | 5242 | // phpcs:enable  | 
                                                        
| 5243 | - dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5243 | + dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5244 | 5244 | print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);  | 
                                                        
| 5245 | 5245 | }  | 
                                                        
| 5246 | 5246 | |
@@ -5275,7 +5275,7 @@ discard block  | 
                                                    ||
| 5275 | 5275 |  	{ | 
                                                        
| 5276 | 5276 | global $langs, $conf;  | 
                                                        
| 5277 | 5277 | |
| 5278 | - $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';  | 
                                                        |
| 5278 | + $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';  | 
                                                        |
| 5279 | 5279 | $formconfirm = '';  | 
                                                        
| 5280 | 5280 | $inputok = array();  | 
                                                        
| 5281 | 5281 | $inputko = array();  | 
                                                        
@@ -5299,27 +5299,27 @@ discard block  | 
                                                    ||
| 5299 | 5299 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5300 | 5300 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5301 | 5301 |  					if ($input['type'] == 'hidden') { | 
                                                        
| 5302 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5303 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5302 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5303 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5304 | 5304 | |
| 5305 | - $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";  | 
                                                        |
| 5305 | + $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";  | 
                                                        |
| 5306 | 5306 | }  | 
                                                        
| 5307 | 5307 | }  | 
                                                        
| 5308 | 5308 | }  | 
                                                        
| 5309 | 5309 | |
| 5310 | 5310 | // Now add questions  | 
                                                        
| 5311 | 5311 | $moreonecolumn = '';  | 
                                                        
| 5312 | - $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";  | 
                                                        |
| 5312 | + $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";  | 
                                                        |
| 5313 | 5313 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5314 | 5314 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5315 | - $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5316 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5317 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5315 | + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5316 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5317 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5318 | 5318 | |
| 5319 | 5319 |  					if ($input['type'] == 'text') { | 
                                                        
| 5320 | -						$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"; | 
                                                        |
| 5320 | +						$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"; | 
                                                        |
| 5321 | 5321 |  					} elseif ($input['type'] == 'password') { | 
                                                        
| 5322 | -						$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"; | 
                                                        |
| 5322 | +						$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"; | 
                                                        |
| 5323 | 5323 |  					} elseif ($input['type'] == 'textarea') { | 
                                                        
| 5324 | 5324 |  						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; | 
                                                        
| 5325 | 5325 | $more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        
@@ -5327,8 +5327,8 @@ discard block  | 
                                                    ||
| 5327 | 5327 | $more .= '</textarea>';  | 
                                                        
| 5328 | 5328 | $more .= '</div></div>'."\n";*/  | 
                                                        
| 5329 | 5329 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5330 | - $moreonecolumn .= $input['label'] . '<br>';  | 
                                                        |
| 5331 | - $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';  | 
                                                        |
| 5330 | + $moreonecolumn .= $input['label'].'<br>';  | 
                                                        |
| 5331 | + $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        |
| 5332 | 5332 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5333 | 5333 | $moreonecolumn .= '</textarea>';  | 
                                                        
| 5334 | 5334 | $moreonecolumn .= '</div>';  | 
                                                        
@@ -5345,20 +5345,20 @@ discard block  | 
                                                    ||
| 5345 | 5345 | $disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;  | 
                                                        
| 5346 | 5346 | $sort = isset($input['select_sort']) ? $input['select_sort'] : '';  | 
                                                        
| 5347 | 5347 | |
| 5348 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; | 
                                                        |
| 5348 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        |
| 5349 | 5349 |  						if (!empty($input['label'])) { | 
                                                        
| 5350 | - $more .= $input['label'] . '</div><div class="tagtd left">';  | 
                                                        |
| 5350 | + $more .= $input['label'].'</div><div class="tagtd left">';  | 
                                                        |
| 5351 | 5351 | }  | 
                                                        
| 5352 | 5352 |  						if ($input['type'] == 'select') { | 
                                                        
| 5353 | 5353 | $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);  | 
                                                        
| 5354 | 5354 |  						} else { | 
                                                        
| 5355 | 5355 | $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);  | 
                                                        
| 5356 | 5356 | }  | 
                                                        
| 5357 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5357 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5358 | 5358 |  					} elseif ($input['type'] == 'checkbox') { | 
                                                        
| 5359 | 5359 | $more .= '<div class="tagtr">';  | 
                                                        
| 5360 | -						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; | 
                                                        |
| 5361 | - $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;  | 
                                                        |
| 5360 | +						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; | 
                                                        |
| 5361 | + $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;  | 
                                                        |
| 5362 | 5362 |  						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { | 
                                                        
| 5363 | 5363 | $more .= ' checked';  | 
                                                        
| 5364 | 5364 | }  | 
                                                        
@@ -5369,19 +5369,19 @@ discard block  | 
                                                    ||
| 5369 | 5369 | $more .= ' disabled';  | 
                                                        
| 5370 | 5370 | }  | 
                                                        
| 5371 | 5371 | $more .= ' /></div>';  | 
                                                        
| 5372 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5372 | + $more .= '</div>'."\n";  | 
                                                        |
| 5373 | 5373 |  					} elseif ($input['type'] == 'radio') { | 
                                                        
| 5374 | 5374 | $i = 0;  | 
                                                        
| 5375 | 5375 |  						foreach ($input['values'] as $selkey => $selval) { | 
                                                        
| 5376 | 5376 | $more .= '<div class="tagtr">';  | 
                                                        
| 5377 | 5377 |  							if (isset($input['label'])) { | 
                                                        
| 5378 | 5378 |  								if ($i == 0) { | 
                                                        
| 5379 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5379 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5380 | 5380 |  								} else { | 
                                                        
| 5381 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; | 
                                                        |
| 5381 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; | 
                                                        |
| 5382 | 5382 | }  | 
                                                        
| 5383 | 5383 | }  | 
                                                        
| 5384 | - $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;  | 
                                                        |
| 5384 | + $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;  | 
                                                        |
| 5385 | 5385 |  							if (!empty($input['disabled'])) { | 
                                                        
| 5386 | 5386 | $more .= ' disabled';  | 
                                                        
| 5387 | 5387 | }  | 
                                                        
@@ -5389,12 +5389,12 @@ discard block  | 
                                                    ||
| 5389 | 5389 | $more .= ' checked="checked"';  | 
                                                        
| 5390 | 5390 | }  | 
                                                        
| 5391 | 5391 | $more .= ' /> ';  | 
                                                        
| 5392 | - $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';  | 
                                                        |
| 5393 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5392 | + $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';  | 
                                                        |
| 5393 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5394 | 5394 | $i++;  | 
                                                        
| 5395 | 5395 | }  | 
                                                        
| 5396 | 5396 |  					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { | 
                                                        
| 5397 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5397 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5398 | 5398 | $more .= '<div class="tagtd">';  | 
                                                        
| 5399 | 5399 | $addnowlink = (empty($input['datenow']) ? 0 : 1);  | 
                                                        
| 5400 | 5400 | $h = $m = 0;  | 
                                                        
@@ -5412,24 +5412,24 @@ discard block  | 
                                                    ||
| 5412 | 5412 |  					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not | 
                                                        
| 5413 | 5413 |  						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        
| 5414 | 5414 |  						if (!empty($input['label'])) { | 
                                                        
| 5415 | - $more .= $input['label'] . '</div><div class="tagtd">';  | 
                                                        |
| 5415 | + $more .= $input['label'].'</div><div class="tagtd">';  | 
                                                        |
| 5416 | 5416 | }  | 
                                                        
| 5417 | 5417 | $more .= $input['value'];  | 
                                                        
| 5418 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5418 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5419 | 5419 |  					} elseif ($input['type'] == 'onecolumn') { | 
                                                        
| 5420 | 5420 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5421 | 5421 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5422 | - $moreonecolumn .= '</div>' . "\n";  | 
                                                        |
| 5422 | + $moreonecolumn .= '</div>'."\n";  | 
                                                        |
| 5423 | 5423 |  					} elseif ($input['type'] == 'hidden') { | 
                                                        
| 5424 | 5424 | // Do nothing more, already added by a previous loop  | 
                                                        
| 5425 | 5425 |  					} elseif ($input['type'] == 'separator') { | 
                                                        
| 5426 | 5426 | $more .= '<br>';  | 
                                                        
| 5427 | 5427 |  					} else { | 
                                                        
| 5428 | - $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';  | 
                                                        |
| 5428 | + $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';  | 
                                                        |
| 5429 | 5429 | }  | 
                                                        
| 5430 | 5430 | }  | 
                                                        
| 5431 | 5431 | }  | 
                                                        
| 5432 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5432 | + $more .= '</div>'."\n";  | 
                                                        |
| 5433 | 5433 | $more .= $moreonecolumn;  | 
                                                        
| 5434 | 5434 | }  | 
                                                        
| 5435 | 5435 | |
@@ -5451,10 +5451,10 @@ discard block  | 
                                                    ||
| 5451 | 5451 | $button = $useajax;  | 
                                                        
| 5452 | 5452 | $useajax = 1;  | 
                                                        
| 5453 | 5453 | $autoOpen = false;  | 
                                                        
| 5454 | - $dialogconfirm .= '-' . $button;  | 
                                                        |
| 5454 | + $dialogconfirm .= '-'.$button;  | 
                                                        |
| 5455 | 5455 | }  | 
                                                        
| 5456 | -			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; | 
                                                        |
| 5457 | -			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); | 
                                                        |
| 5456 | +			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; | 
                                                        |
| 5457 | +			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); | 
                                                        |
| 5458 | 5458 | |
| 5459 | 5459 | // Add input fields into list of fields to read during submit (inputok and inputko)  | 
                                                        
| 5460 | 5460 |  			if (is_array($formquestion)) { | 
                                                        
@@ -5477,24 +5477,24 @@ discard block  | 
                                                    ||
| 5477 | 5477 | }  | 
                                                        
| 5478 | 5478 | |
| 5479 | 5479 | // Show JQuery confirm box.  | 
                                                        
| 5480 | - $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';  | 
                                                        |
| 5480 | + $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';  | 
                                                        |
| 5481 | 5481 |  			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5482 | - $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";  | 
                                                        |
| 5482 | + $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";  | 
                                                        |
| 5483 | 5483 | }  | 
                                                        
| 5484 | 5484 |  			if (!empty($more)) { | 
                                                        
| 5485 | - $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";  | 
                                                        |
| 5485 | + $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";  | 
                                                        |
| 5486 | 5486 | }  | 
                                                        
| 5487 | - $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');  | 
                                                        |
| 5488 | - $formconfirm .= '</div>' . "\n";  | 
                                                        |
| 5487 | + $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');  | 
                                                        |
| 5488 | + $formconfirm .= '</div>'."\n";  | 
                                                        |
| 5489 | 5489 | |
| 5490 | - $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";  | 
                                                        |
| 5491 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5490 | + $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";  | 
                                                        |
| 5491 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5492 | 5492 |  			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; | 
                                                        
| 5493 | 5493 |  			$formconfirm .= 'jQuery(document).ready(function() { | 
                                                        
| 5494 | 5494 |              $(function() { | 
                                                        
| 5495 | - $( "#' . $dialogconfirm . '" ).dialog(  | 
                                                        |
| 5495 | + $( "#' . $dialogconfirm.'" ).dialog(  | 
                                                        |
| 5496 | 5496 |              	{ | 
                                                        
| 5497 | - autoOpen: ' . ($autoOpen ? "true" : "false") . ',';  | 
                                                        |
| 5497 | + autoOpen: ' . ($autoOpen ? "true" : "false").',';  | 
                                                        |
| 5498 | 5498 |  			if ($newselectedchoice == 'no') { | 
                                                        
| 5499 | 5499 | $formconfirm .= '  | 
                                                        
| 5500 | 5500 |  						open: function() { | 
                                                        
@@ -5504,24 +5504,24 @@ discard block  | 
                                                    ||
| 5504 | 5504 | |
| 5505 | 5505 | $jsforcursor = '';  | 
                                                        
| 5506 | 5506 |  			if ($useajax == 1) { | 
                                                        
| 5507 | - $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";  | 
                                                        |
| 5508 | -				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; | 
                                                        |
| 5507 | + $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";  | 
                                                        |
| 5508 | +				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; | 
                                                        |
| 5509 | 5509 | }  | 
                                                        
| 5510 | 5510 | |
| 5511 | 5511 | $postconfirmas = 'GET';  | 
                                                        
| 5512 | 5512 | |
| 5513 | 5513 | $formconfirm .= '  | 
                                                        
| 5514 | 5514 | resizable: false,  | 
                                                        
| 5515 | - height: "' . $height . '",  | 
                                                        |
| 5516 | - width: "' . $width . '",  | 
                                                        |
| 5515 | + height: "' . $height.'",  | 
                                                        |
| 5516 | + width: "' . $width.'",  | 
                                                        |
| 5517 | 5517 | modal: true,  | 
                                                        
| 5518 | 5518 | closeOnEscape: false,  | 
                                                        
| 5519 | 5519 |                      buttons: { | 
                                                        
| 5520 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { | 
                                                        |
| 5521 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5522 | - var inputok = ' . json_encode($inputok) . '; /* List of fields into form */  | 
                                                        |
| 5523 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5524 | - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";  | 
                                                        |
| 5520 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { | 
                                                        |
| 5521 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5522 | + var inputok = ' . json_encode($inputok).'; /* List of fields into form */  | 
                                                        |
| 5523 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5524 | + var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";  | 
                                                        |
| 5525 | 5525 | |
| 5526 | 5526 |                           	if (inputok.length > 0) { | 
                                                        
| 5527 | 5527 |                           		$.each(inputok, function(i, inputname) { | 
                                                        
@@ -5555,11 +5555,11 @@ discard block  | 
                                                    ||
| 5555 | 5555 | }  | 
                                                        
| 5556 | 5556 |  	                        $(this).dialog("close"); | 
                                                        
| 5557 | 5557 | },  | 
                                                        
| 5558 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { | 
                                                        |
| 5559 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5560 | - var inputko = ' . json_encode($inputko) . '; /* List of fields into form */  | 
                                                        |
| 5561 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5562 | - var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";  | 
                                                        |
| 5558 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { | 
                                                        |
| 5559 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5560 | + var inputko = ' . json_encode($inputko).'; /* List of fields into form */  | 
                                                        |
| 5561 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5562 | + var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";  | 
                                                        |
| 5563 | 5563 |                           	if (inputko.length > 0) { | 
                                                        
| 5564 | 5564 |                           		$.each(inputko, function(i, inputname) { | 
                                                        
| 5565 | 5565 | var more = "";  | 
                                                        
@@ -5591,10 +5591,10 @@ discard block  | 
                                                    ||
| 5591 | 5591 | }  | 
                                                        
| 5592 | 5592 | );  | 
                                                        
| 5593 | 5593 | |
| 5594 | - var button = "' . $button . '";  | 
                                                        |
| 5594 | + var button = "' . $button.'";  | 
                                                        |
| 5595 | 5595 |              	if (button.length > 0) { | 
                                                        
| 5596 | 5596 |                  	$( "#" + button ).click(function() { | 
                                                        
| 5597 | -                		$("#' . $dialogconfirm . '").dialog("open"); | 
                                                        |
| 5597 | +                		$("#' . $dialogconfirm.'").dialog("open"); | 
                                                        |
| 5598 | 5598 | });  | 
                                                        
| 5599 | 5599 | }  | 
                                                        
| 5600 | 5600 | });  | 
                                                        
@@ -5602,44 +5602,44 @@ discard block  | 
                                                    ||
| 5602 | 5602 | </script>';  | 
                                                        
| 5603 | 5603 | $formconfirm .= "<!-- end ajax formconfirm -->\n";  | 
                                                        
| 5604 | 5604 |  		} else { | 
                                                        
| 5605 | - $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";  | 
                                                        |
| 5605 | + $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";  | 
                                                        |
| 5606 | 5606 | |
| 5607 | 5607 |  			if (empty($disableformtag)) { | 
                                                        
| 5608 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";  | 
                                                        |
| 5608 | + $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";  | 
                                                        |
| 5609 | 5609 | }  | 
                                                        
| 5610 | 5610 | |
| 5611 | - $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";  | 
                                                        |
| 5612 | - $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";  | 
                                                        |
| 5611 | + $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";  | 
                                                        |
| 5612 | + $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";  | 
                                                        |
| 5613 | 5613 | |
| 5614 | - $formconfirm .= '<table class="valid centpercent">' . "\n";  | 
                                                        |
| 5614 | + $formconfirm .= '<table class="valid centpercent">'."\n";  | 
                                                        |
| 5615 | 5615 | |
| 5616 | 5616 | // Line title  | 
                                                        
| 5617 | 5617 | $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';  | 
                                                        
| 5618 | -			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; | 
                                                        |
| 5619 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5618 | +			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title; | 
                                                        |
| 5619 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5620 | 5620 | |
| 5621 | 5621 | // Line text  | 
                                                        
| 5622 | 5622 |  			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5623 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";  | 
                                                        |
| 5623 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";  | 
                                                        |
| 5624 | 5624 | }  | 
                                                        
| 5625 | 5625 | |
| 5626 | 5626 | // Line form fields  | 
                                                        
| 5627 | 5627 |  			if ($more) { | 
                                                        
| 5628 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";  | 
                                                        |
| 5628 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";  | 
                                                        |
| 5629 | 5629 | $formconfirm .= $more;  | 
                                                        
| 5630 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5630 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5631 | 5631 | }  | 
                                                        
| 5632 | 5632 | |
| 5633 | 5633 | // Line with question  | 
                                                        
| 5634 | 5634 | $formconfirm .= '<tr class="valid">';  | 
                                                        
| 5635 | - $formconfirm .= '<td class="valid">' . $question . '</td>';  | 
                                                        |
| 5635 | + $formconfirm .= '<td class="valid">'.$question.'</td>';  | 
                                                        |
| 5636 | 5636 | $formconfirm .= '<td class="valid center">';  | 
                                                        
| 5637 | 5637 |  			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); | 
                                                        
| 5638 | -			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; | 
                                                        |
| 5638 | +			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; | 
                                                        |
| 5639 | 5639 | $formconfirm .= '</td>';  | 
                                                        
| 5640 | - $formconfirm .= '</tr>' . "\n";  | 
                                                        |
| 5640 | + $formconfirm .= '</tr>'."\n";  | 
                                                        |
| 5641 | 5641 | |
| 5642 | - $formconfirm .= '</table>' . "\n";  | 
                                                        |
| 5642 | + $formconfirm .= '</table>'."\n";  | 
                                                        |
| 5643 | 5643 | |
| 5644 | 5644 |  			if (empty($disableformtag)) { | 
                                                        
| 5645 | 5645 | $formconfirm .= "</form>\n";  | 
                                                        
@@ -5648,7 +5648,7 @@ discard block  | 
                                                    ||
| 5648 | 5648 | |
| 5649 | 5649 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 5650 | 5650 | $formconfirm .= '<!-- code to disable button to avoid double clic -->';  | 
                                                        
| 5651 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5651 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5652 | 5652 | $formconfirm .= '  | 
                                                        
| 5653 | 5653 |  				$(document).ready(function () { | 
                                                        
| 5654 | 5654 |  					$(".confirmvalidatebutton").on("click", function() { | 
                                                        
@@ -5660,7 +5660,7 @@ discard block  | 
                                                    ||
| 5660 | 5660 | });  | 
                                                        
| 5661 | 5661 | });  | 
                                                        
| 5662 | 5662 | ';  | 
                                                        
| 5663 | - $formconfirm .= '</script>' . "\n";  | 
                                                        |
| 5663 | + $formconfirm .= '</script>'."\n";  | 
                                                        |
| 5664 | 5664 | }  | 
                                                        
| 5665 | 5665 | |
| 5666 | 5666 | $formconfirm .= "<!-- end formconfirm -->\n";  | 
                                                        
@@ -5692,8 +5692,8 @@ discard block  | 
                                                    ||
| 5692 | 5692 | // phpcs:enable  | 
                                                        
| 5693 | 5693 | global $langs;  | 
                                                        
| 5694 | 5694 | |
| 5695 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 5696 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 5695 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 5696 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 5697 | 5697 | |
| 5698 | 5698 | $out = '';  | 
                                                        
| 5699 | 5699 | |
@@ -5701,11 +5701,11 @@ discard block  | 
                                                    ||
| 5701 | 5701 | |
| 5702 | 5702 |  		$langs->load("project"); | 
                                                        
| 5703 | 5703 |  		if ($htmlname != "none") { | 
                                                        
| 5704 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5704 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5705 | 5705 | $out .= '<input type="hidden" name="action" value="classin">';  | 
                                                        
| 5706 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5706 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5707 | 5707 | $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);  | 
                                                        
| 5708 | -			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5708 | +			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5709 | 5709 | $out .= '</form>';  | 
                                                        
| 5710 | 5710 |  		} else { | 
                                                        
| 5711 | 5711 | $out .= '<span class="project_head_block">';  | 
                                                        
@@ -5714,7 +5714,7 @@ discard block  | 
                                                    ||
| 5714 | 5714 | $projet->fetch($selected);  | 
                                                        
| 5715 | 5715 | $out .= $projet->getNomUrl(0, '', 1);  | 
                                                        
| 5716 | 5716 |  			} else { | 
                                                        
| 5717 | - $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';  | 
                                                        |
| 5717 | + $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';  | 
                                                        |
| 5718 | 5718 | }  | 
                                                        
| 5719 | 5719 | $out .= '</span>';  | 
                                                        
| 5720 | 5720 | }  | 
                                                        
@@ -5751,14 +5751,14 @@ discard block  | 
                                                    ||
| 5751 | 5751 | $out = '';  | 
                                                        
| 5752 | 5752 | |
| 5753 | 5753 |  		if ($htmlname != "none") { | 
                                                        
| 5754 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5754 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5755 | 5755 | $out .= '<input type="hidden" name="action" value="setconditions">';  | 
                                                        
| 5756 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5756 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5757 | 5757 |  			if ($type) { | 
                                                        
| 5758 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5758 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5759 | 5759 | }  | 
                                                        
| 5760 | 5760 | $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);  | 
                                                        
| 5761 | -			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5761 | +			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5762 | 5762 | $out .= '</form>';  | 
                                                        
| 5763 | 5763 |  		} else { | 
                                                        
| 5764 | 5764 |  			if ($selected) { | 
                                                        
@@ -5803,12 +5803,12 @@ discard block  | 
                                                    ||
| 5803 | 5803 | // phpcs:enable  | 
                                                        
| 5804 | 5804 | global $langs;  | 
                                                        
| 5805 | 5805 |  		if ($htmlname != "none") { | 
                                                        
| 5806 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5806 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5807 | 5807 | print '<input type="hidden" name="action" value="setavailability">';  | 
                                                        
| 5808 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5808 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5809 | 5809 | $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5810 | -			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5811 | -			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 5810 | +			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5811 | +			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 5812 | 5812 | print '</form>';  | 
                                                        
| 5813 | 5813 |  		} else { | 
                                                        
| 5814 | 5814 |  			if ($selected) { | 
                                                        
@@ -5834,11 +5834,11 @@ discard block  | 
                                                    ||
| 5834 | 5834 |  	{ | 
                                                        
| 5835 | 5835 | global $langs;  | 
                                                        
| 5836 | 5836 |  		if ($htmlname != "none") { | 
                                                        
| 5837 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5837 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5838 | 5838 | print '<input type="hidden" name="action" value="setdemandreason">';  | 
                                                        
| 5839 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5839 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5840 | 5840 | $this->selectInputReason($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5841 | -			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5841 | +			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5842 | 5842 | print '</form>';  | 
                                                        
| 5843 | 5843 |  		} else { | 
                                                        
| 5844 | 5844 |  			if ($selected) { | 
                                                        
@@ -5878,17 +5878,17 @@ discard block  | 
                                                    ||
| 5878 | 5878 | $ret = '';  | 
                                                        
| 5879 | 5879 | |
| 5880 | 5880 |  		if ($htmlname != "none") { | 
                                                        
| 5881 | - $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 5882 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 5883 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5881 | + $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 5882 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 5883 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5884 | 5884 |  			if ($type) { | 
                                                        
| 5885 | - $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5885 | + $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5886 | 5886 | }  | 
                                                        
| 5887 | 5887 | $ret .= '<table class="nobordernopadding">';  | 
                                                        
| 5888 | 5888 | $ret .= '<tr><td>';  | 
                                                        
| 5889 | - $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);  | 
                                                        |
| 5889 | + $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);  | 
                                                        |
| 5890 | 5890 | $ret .= '</td>';  | 
                                                        
| 5891 | -			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 5891 | +			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 5892 | 5892 | $ret .= '</tr></table></form>';  | 
                                                        
| 5893 | 5893 |  		} else { | 
                                                        
| 5894 | 5894 |  			if ($displayhour) { | 
                                                        
@@ -5923,15 +5923,15 @@ discard block  | 
                                                    ||
| 5923 | 5923 | global $langs;  | 
                                                        
| 5924 | 5924 | |
| 5925 | 5925 |  		if ($htmlname != "none") { | 
                                                        
| 5926 | - print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 5927 | - print '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 5928 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5926 | + print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 5927 | + print '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 5928 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5929 | 5929 | print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);  | 
                                                        
| 5930 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5930 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5931 | 5931 | print '</form>';  | 
                                                        
| 5932 | 5932 |  		} else { | 
                                                        
| 5933 | 5933 |  			if ($selected) { | 
                                                        
| 5934 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';  | 
                                                        |
| 5934 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';  | 
                                                        |
| 5935 | 5935 | $theuser = new User($this->db);  | 
                                                        
| 5936 | 5936 | $theuser->fetch($selected);  | 
                                                        
| 5937 | 5937 | print $theuser->getNomUrl(1);  | 
                                                        
@@ -5964,14 +5964,14 @@ discard block  | 
                                                    ||
| 5964 | 5964 | |
| 5965 | 5965 | $out = '';  | 
                                                        
| 5966 | 5966 |  		if ($htmlname != "none") { | 
                                                        
| 5967 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5967 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5968 | 5968 | $out .= '<input type="hidden" name="action" value="setmode">';  | 
                                                        
| 5969 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5969 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5970 | 5970 |  			if ($type) { | 
                                                        
| 5971 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5971 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5972 | 5972 | }  | 
                                                        
| 5973 | 5973 | $out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);  | 
                                                        
| 5974 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5974 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5975 | 5975 | $out .= '</form>';  | 
                                                        
| 5976 | 5976 |  		} else { | 
                                                        
| 5977 | 5977 |  			if ($selected) { | 
                                                        
@@ -6004,11 +6004,11 @@ discard block  | 
                                                    ||
| 6004 | 6004 |  	{ | 
                                                        
| 6005 | 6005 | global $langs;  | 
                                                        
| 6006 | 6006 |  		if ($htmlname != "none") { | 
                                                        
| 6007 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6007 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6008 | 6008 | print '<input type="hidden" name="action" value="settransportmode">';  | 
                                                        
| 6009 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6009 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6010 | 6010 | $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);  | 
                                                        
| 6011 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6011 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6012 | 6012 | print '</form>';  | 
                                                        
| 6013 | 6013 |  		} else { | 
                                                        
| 6014 | 6014 |  			if ($selected) { | 
                                                        
@@ -6035,14 +6035,14 @@ discard block  | 
                                                    ||
| 6035 | 6035 | // phpcs:enable  | 
                                                        
| 6036 | 6036 | global $langs;  | 
                                                        
| 6037 | 6037 |  		if ($htmlname != "none") { | 
                                                        
| 6038 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6038 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6039 | 6039 | print '<input type="hidden" name="action" value="setmulticurrencycode">';  | 
                                                        
| 6040 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6040 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6041 | 6041 | print $this->selectMultiCurrency($selected, $htmlname, 0);  | 
                                                        
| 6042 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6042 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6043 | 6043 | print '</form>';  | 
                                                        
| 6044 | 6044 |  		} else { | 
                                                        
| 6045 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6045 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6046 | 6046 | print !empty($selected) ? currency_name($selected, 1) : ' ';  | 
                                                        
| 6047 | 6047 | }  | 
                                                        
| 6048 | 6048 | }  | 
                                                        
@@ -6064,21 +6064,21 @@ discard block  | 
                                                    ||
| 6064 | 6064 | global $langs, $mysoc, $conf;  | 
                                                        
| 6065 | 6065 | |
| 6066 | 6066 |  		if ($htmlname != "none") { | 
                                                        
| 6067 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6067 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6068 | 6068 | print '<input type="hidden" name="action" value="setmulticurrencyrate">';  | 
                                                        
| 6069 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6070 | - print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';  | 
                                                        |
| 6069 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6070 | + print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';  | 
                                                        |
| 6071 | 6071 | print '<select name="calculation_mode">';  | 
                                                        
| 6072 | -			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; | 
                                                        |
| 6073 | -			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; | 
                                                        |
| 6072 | +			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; | 
                                                        |
| 6073 | +			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; | 
                                                        |
| 6074 | 6074 | print '</select> ';  | 
                                                        
| 6075 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6075 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6076 | 6076 | print '</form>';  | 
                                                        
| 6077 | 6077 |  		} else { | 
                                                        
| 6078 | 6078 |  			if (!empty($rate)) { | 
                                                        
| 6079 | 6079 | print price($rate, 1, $langs, 0, 0);  | 
                                                        
| 6080 | 6080 |  				if ($currency && $rate != 1) { | 
                                                        
| 6081 | -					print '   (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; | 
                                                        |
| 6081 | +					print '   ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; | 
                                                        |
| 6082 | 6082 | }  | 
                                                        
| 6083 | 6083 |  			} else { | 
                                                        
| 6084 | 6084 | print 1;  | 
                                                        
@@ -6109,9 +6109,9 @@ discard block  | 
                                                    ||
| 6109 | 6109 | // phpcs:enable  | 
                                                        
| 6110 | 6110 | global $conf, $langs;  | 
                                                        
| 6111 | 6111 |  		if ($htmlname != "none") { | 
                                                        
| 6112 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6112 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6113 | 6113 | print '<input type="hidden" name="action" value="setabsolutediscount">';  | 
                                                        
| 6114 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6114 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6115 | 6115 | print '<div class="inline-block">';  | 
                                                        
| 6116 | 6116 |  			if (!empty($discount_type)) { | 
                                                        
| 6117 | 6117 |  				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { | 
                                                        
@@ -6149,24 +6149,24 @@ discard block  | 
                                                    ||
| 6149 | 6149 | print '</div>';  | 
                                                        
| 6150 | 6150 |  			if (empty($hidelist)) { | 
                                                        
| 6151 | 6151 | print '<div class="inline-block" style="padding-right: 10px">';  | 
                                                        
| 6152 | - $newfilter = 'discount_type=' . intval($discount_type);  | 
                                                        |
| 6152 | + $newfilter = 'discount_type='.intval($discount_type);  | 
                                                        |
| 6153 | 6153 |  				if (!empty($discount_type)) { | 
                                                        
| 6154 | 6154 | $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available  | 
                                                        
| 6155 | 6155 |  				} else { | 
                                                        
| 6156 | 6156 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available  | 
                                                        
| 6157 | 6157 | }  | 
                                                        
| 6158 | 6158 |  				if ($filter) { | 
                                                        
| 6159 | -					$newfilter .= ' AND (' . $filter . ')'; | 
                                                        |
| 6159 | +					$newfilter .= ' AND ('.$filter.')'; | 
                                                        |
| 6160 | 6160 | }  | 
                                                        
| 6161 | 6161 | // output the combo of discounts  | 
                                                        
| 6162 | 6162 | $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);  | 
                                                        
| 6163 | 6163 |  				if ($nbqualifiedlines > 0) { | 
                                                        
| 6164 | -					print '   <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; | 
                                                        |
| 6164 | +					print '   <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; | 
                                                        |
| 6165 | 6165 |  					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { | 
                                                        
| 6166 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6166 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6167 | 6167 | }  | 
                                                        
| 6168 | 6168 |  					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { | 
                                                        
| 6169 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6169 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6170 | 6170 | }  | 
                                                        
| 6171 | 6171 | |
| 6172 | 6172 | print '>';  | 
                                                        
@@ -6206,23 +6206,23 @@ discard block  | 
                                                    ||
| 6206 | 6206 | global $langs, $conf;  | 
                                                        
| 6207 | 6207 | |
| 6208 | 6208 |  		if ($htmlname != "none") { | 
                                                        
| 6209 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6209 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6210 | 6210 | print '<input type="hidden" name="action" value="set_contact">';  | 
                                                        
| 6211 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6211 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6212 | 6212 | print '<table class="nobordernopadding">';  | 
                                                        
| 6213 | 6213 | print '<tr><td>';  | 
                                                        
| 6214 | 6214 | print $this->selectcontacts($societe->id, $selected, $htmlname);  | 
                                                        
| 6215 | 6215 | $num = $this->num;  | 
                                                        
| 6216 | 6216 |  			if ($num == 0) { | 
                                                        
| 6217 | 6217 |  				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); | 
                                                        
| 6218 | - print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>';  | 
                                                        |
| 6218 | + print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>';  | 
                                                        |
| 6219 | 6219 | }  | 
                                                        
| 6220 | 6220 | print '</td>';  | 
                                                        
| 6221 | -			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 6221 | +			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 6222 | 6222 | print '</tr></table></form>';  | 
                                                        
| 6223 | 6223 |  		} else { | 
                                                        
| 6224 | 6224 |  			if ($selected) { | 
                                                        
| 6225 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 6225 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 6226 | 6226 | $contact = new Contact($this->db);  | 
                                                        
| 6227 | 6227 | $contact->fetch($selected);  | 
                                                        
| 6228 | 6228 | print $contact->getFullName($langs);  | 
                                                        
@@ -6257,20 +6257,20 @@ discard block  | 
                                                    ||
| 6257 | 6257 | |
| 6258 | 6258 | $out = '';  | 
                                                        
| 6259 | 6259 |  		if ($htmlname != "none") { | 
                                                        
| 6260 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6260 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6261 | 6261 | $out .= '<input type="hidden" name="action" value="set_thirdparty">';  | 
                                                        
| 6262 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6262 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6263 | 6263 | $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);  | 
                                                        
| 6264 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6264 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6265 | 6265 | $out .= '</form>';  | 
                                                        
| 6266 | 6266 |  		} else { | 
                                                        
| 6267 | 6267 |  			if ($selected) { | 
                                                        
| 6268 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 6268 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 6269 | 6269 | $soc = new Societe($this->db);  | 
                                                        
| 6270 | 6270 | $soc->fetch($selected);  | 
                                                        
| 6271 | 6271 | $out .= $soc->getNomUrl(0, '');  | 
                                                        
| 6272 | 6272 |  			} else { | 
                                                        
| 6273 | - $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';  | 
                                                        |
| 6273 | + $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';  | 
                                                        |
| 6274 | 6274 | }  | 
                                                        
| 6275 | 6275 | }  | 
                                                        
| 6276 | 6276 | |
@@ -6320,22 +6320,22 @@ discard block  | 
                                                    ||
| 6320 | 6320 | $selected = 'EUR'; // Pour compatibilite  | 
                                                        
| 6321 | 6321 | }  | 
                                                        
| 6322 | 6322 | |
| 6323 | - $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6323 | + $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6324 | 6324 |  		if ($useempty) { | 
                                                        
| 6325 | 6325 | $out .= '<option value="-1" selected></option>';  | 
                                                        
| 6326 | 6326 | }  | 
                                                        
| 6327 | 6327 |  		foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6328 | 6328 | $labeltoshow = $currency['label'];  | 
                                                        
| 6329 | 6329 |  			if ($mode == 1) { | 
                                                        
| 6330 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; | 
                                                        |
| 6330 | +				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; | 
                                                        |
| 6331 | 6331 |  			} else { | 
                                                        
| 6332 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; | 
                                                        |
| 6332 | +				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; | 
                                                        |
| 6333 | 6333 | }  | 
                                                        
| 6334 | 6334 | |
| 6335 | 6335 |  			if ($selected && $selected == $code_iso) { | 
                                                        
| 6336 | - $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6336 | + $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6337 | 6337 |  			} else { | 
                                                        
| 6338 | - $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6338 | + $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6339 | 6339 | }  | 
                                                        
| 6340 | 6340 | $out .= $labeltoshow;  | 
                                                        
| 6341 | 6341 | $out .= '</option>';  | 
                                                        
@@ -6346,7 +6346,7 @@ discard block  | 
                                                    ||
| 6346 | 6346 | }  | 
                                                        
| 6347 | 6347 | |
| 6348 | 6348 | // Make select dynamic  | 
                                                        
| 6349 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6349 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6350 | 6350 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6351 | 6351 | |
| 6352 | 6352 | return $out;  | 
                                                        
@@ -6372,10 +6372,10 @@ discard block  | 
                                                    ||
| 6372 | 6372 | |
| 6373 | 6373 | $TCurrency = array();  | 
                                                        
| 6374 | 6374 | |
| 6375 | - $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";  | 
                                                        |
| 6376 | -		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; | 
                                                        |
| 6375 | + $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";  | 
                                                        |
| 6376 | +		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; | 
                                                        |
| 6377 | 6377 |  		if ($filter) { | 
                                                        
| 6378 | - $sql .= " AND " . $filter;  | 
                                                        |
| 6378 | + $sql .= " AND ".$filter;  | 
                                                        |
| 6379 | 6379 | }  | 
                                                        
| 6380 | 6380 | $resql = $this->db->query($sql);  | 
                                                        
| 6381 | 6381 |  		if ($resql) { | 
                                                        
@@ -6385,7 +6385,7 @@ discard block  | 
                                                    ||
| 6385 | 6385 | }  | 
                                                        
| 6386 | 6386 | |
| 6387 | 6387 | $out = '';  | 
                                                        
| 6388 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6388 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6389 | 6389 |  		if ($useempty) { | 
                                                        
| 6390 | 6390 | $out .= '<option value=""> </option>';  | 
                                                        
| 6391 | 6391 | }  | 
                                                        
@@ -6397,13 +6397,13 @@ discard block  | 
                                                    ||
| 6397 | 6397 |  			foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6398 | 6398 |  				if (isset($TCurrency[$code_iso])) { | 
                                                        
| 6399 | 6399 |  					if (!empty($selected) && $selected == $code_iso) { | 
                                                        
| 6400 | - $out .= '<option value="' . $code_iso . '" selected="selected">';  | 
                                                        |
| 6400 | + $out .= '<option value="'.$code_iso.'" selected="selected">';  | 
                                                        |
| 6401 | 6401 |  					} else { | 
                                                        
| 6402 | - $out .= '<option value="' . $code_iso . '">';  | 
                                                        |
| 6402 | + $out .= '<option value="'.$code_iso.'">';  | 
                                                        |
| 6403 | 6403 | }  | 
                                                        
| 6404 | 6404 | |
| 6405 | 6405 | $out .= $currency['label'];  | 
                                                        
| 6406 | -					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; | 
                                                        |
| 6406 | +					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; | 
                                                        |
| 6407 | 6407 | $out .= '</option>';  | 
                                                        
| 6408 | 6408 | }  | 
                                                        
| 6409 | 6409 | }  | 
                                                        
@@ -6412,7 +6412,7 @@ discard block  | 
                                                    ||
| 6412 | 6412 | $out .= '</select>';  | 
                                                        
| 6413 | 6413 | |
| 6414 | 6414 | // Make select dynamic  | 
                                                        
| 6415 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6415 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6416 | 6416 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6417 | 6417 | |
| 6418 | 6418 | return $out;  | 
                                                        
@@ -6443,7 +6443,7 @@ discard block  | 
                                                    ||
| 6443 | 6443 | $sql .= " WHERE t.fk_pays = c.rowid";  | 
                                                        
| 6444 | 6444 | $sql .= " AND t.active > 0";  | 
                                                        
| 6445 | 6445 |  		$sql .= " AND t.entity IN (".getEntity('c_tva').")"; | 
                                                        
| 6446 | -		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; | 
                                                        |
| 6446 | +		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; | 
                                                        |
| 6447 | 6447 | $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";  | 
                                                        
| 6448 | 6448 | |
| 6449 | 6449 | $resql = $this->db->query($sql);  | 
                                                        
@@ -6455,30 +6455,30 @@ discard block  | 
                                                    ||
| 6455 | 6455 | |
| 6456 | 6456 | $tmparray = array();  | 
                                                        
| 6457 | 6457 | $tmparray['rowid'] = $obj->rowid;  | 
                                                        
| 6458 | - $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6459 | - $tmparray['code'] = $obj->code;  | 
                                                        |
| 6458 | + $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6459 | + $tmparray['code'] = $obj->code;  | 
                                                        |
| 6460 | 6460 | $tmparray['txtva'] = $obj->taux;  | 
                                                        
| 6461 | - $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6461 | + $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6462 | 6462 | $tmparray['localtax1'] = $obj->localtax1;  | 
                                                        
| 6463 | 6463 | $tmparray['localtax1_type'] = $obj->localtax1_type;  | 
                                                        
| 6464 | 6464 | $tmparray['localtax2'] = $obj->localtax2;  | 
                                                        
| 6465 | 6465 | $tmparray['localtax2_type'] = $obj->localtax1_type;  | 
                                                        
| 6466 | -					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6467 | -					$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 | 
                                                        |
| 6466 | +					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6467 | +					$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 | 
                                                        |
| 6468 | 6468 | $positiverates = '';  | 
                                                        
| 6469 | 6469 |  					if ($obj->taux) { | 
                                                        
| 6470 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux;  | 
                                                        |
| 6470 | + $positiverates .= ($positiverates ? '/' : '').$obj->taux;  | 
                                                        |
| 6471 | 6471 | }  | 
                                                        
| 6472 | 6472 |  					if ($obj->localtax1) { | 
                                                        
| 6473 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;  | 
                                                        |
| 6473 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax1;  | 
                                                        |
| 6474 | 6474 | }  | 
                                                        
| 6475 | 6475 |  					if ($obj->localtax2) { | 
                                                        
| 6476 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;  | 
                                                        |
| 6476 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax2;  | 
                                                        |
| 6477 | 6477 | }  | 
                                                        
| 6478 | 6478 |  					if (empty($positiverates)) { | 
                                                        
| 6479 | 6479 | $positiverates = '0';  | 
                                                        
| 6480 | 6480 | }  | 
                                                        
| 6481 | -					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label | 
                                                        |
| 6481 | +					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label | 
                                                        |
| 6482 | 6482 | |
| 6483 | 6483 | $this->cache_vatrates[$obj->rowid] = $tmparray;  | 
                                                        
| 6484 | 6484 | }  | 
                                                        
@@ -6498,7 +6498,7 @@ discard block  | 
                                                    ||
| 6498 | 6498 | return -1;  | 
                                                        
| 6499 | 6499 | }  | 
                                                        
| 6500 | 6500 |  		} else { | 
                                                        
| 6501 | - $this->error = '<span class="error">' . $this->db->error() . '</span>';  | 
                                                        |
| 6501 | + $this->error = '<span class="error">'.$this->db->error().'</span>';  | 
                                                        |
| 6502 | 6502 | return -2;  | 
                                                        
| 6503 | 6503 | }  | 
                                                        
| 6504 | 6504 | }  | 
                                                        
@@ -6551,9 +6551,9 @@ discard block  | 
                                                    ||
| 6551 | 6551 | // Check parameters  | 
                                                        
| 6552 | 6552 |  		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { | 
                                                        
| 6553 | 6553 |  			if ($societe_vendeuse->id == $mysoc->id) { | 
                                                        
| 6554 | -				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6554 | +				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; | 
                                                        |
| 6555 | 6555 |  			} else { | 
                                                        
| 6556 | -				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6556 | +				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; | 
                                                        |
| 6557 | 6557 | }  | 
                                                        
| 6558 | 6558 | return $return;  | 
                                                        
| 6559 | 6559 | }  | 
                                                        
@@ -6565,12 +6565,12 @@ discard block  | 
                                                    ||
| 6565 | 6565 | // Define list of countries to use to search VAT rates to show  | 
                                                        
| 6566 | 6566 | // First we defined code_country to use to find list  | 
                                                        
| 6567 | 6567 |  		if (is_object($societe_vendeuse)) { | 
                                                        
| 6568 | - $code_country = "'" . $societe_vendeuse->country_code . "'";  | 
                                                        |
| 6568 | + $code_country = "'".$societe_vendeuse->country_code."'";  | 
                                                        |
| 6569 | 6569 |  		} else { | 
                                                        
| 6570 | - $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente  | 
                                                        |
| 6570 | + $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente  | 
                                                        |
| 6571 | 6571 | }  | 
                                                        
| 6572 | 6572 |  		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on | 
                                                        
| 6573 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6573 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6574 | 6574 | // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries  | 
                                                        
| 6575 | 6575 | // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country  | 
                                                        
| 6576 | 6576 |  			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); | 
                                                        
@@ -6580,27 +6580,27 @@ discard block  | 
                                                    ||
| 6580 | 6580 |  					if ($type == 1) { // We know product is a service | 
                                                        
| 6581 | 6581 |  						switch ($selectVatComboMode) { | 
                                                        
| 6582 | 6582 | case '1':  | 
                                                        
| 6583 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6583 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6584 | 6584 | break;  | 
                                                        
| 6585 | 6585 | case '2':  | 
                                                        
| 6586 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6586 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6587 | 6587 | break;  | 
                                                        
| 6588 | 6588 | }  | 
                                                        
| 6589 | 6589 | }  | 
                                                        
| 6590 | 6590 |  				} elseif (!$idprod) {  // We don't know type of product | 
                                                        
| 6591 | 6591 |  					switch ($selectVatComboMode) { | 
                                                        
| 6592 | 6592 | case '1':  | 
                                                        
| 6593 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6593 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6594 | 6594 | break;  | 
                                                        
| 6595 | 6595 | case '2':  | 
                                                        
| 6596 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6596 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6597 | 6597 | break;  | 
                                                        
| 6598 | 6598 | }  | 
                                                        
| 6599 | 6599 |  				} else { | 
                                                        
| 6600 | 6600 | $prodstatic = new Product($this->db);  | 
                                                        
| 6601 | 6601 | $prodstatic->fetch($idprod);  | 
                                                        
| 6602 | 6602 |  					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service | 
                                                        
| 6603 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6603 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6604 | 6604 | }  | 
                                                        
| 6605 | 6605 | }  | 
                                                        
| 6606 | 6606 | }  | 
                                                        
@@ -6662,13 +6662,13 @@ discard block  | 
                                                    ||
| 6662 | 6662 | // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead  | 
                                                        
| 6663 | 6663 | // of using supplier invoices (this is a very bad idea !)  | 
                                                        
| 6664 | 6664 |  				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { | 
                                                        
| 6665 | -					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; | 
                                                        |
| 6665 | +					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; | 
                                                        |
| 6666 | 6666 | $disabled = true;  | 
                                                        
| 6667 | 6667 | }  | 
                                                        
| 6668 | 6668 | }  | 
                                                        
| 6669 | 6669 | |
| 6670 | 6670 |  			if (!$options_only) { | 
                                                        
| 6671 | - $return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';  | 
                                                        |
| 6671 | + $return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';  | 
                                                        |
| 6672 | 6672 | }  | 
                                                        
| 6673 | 6673 | |
| 6674 | 6674 | $selectedfound = false;  | 
                                                        
@@ -6682,13 +6682,13 @@ discard block  | 
                                                    ||
| 6682 | 6682 | $key = $rate['txtva'];  | 
                                                        
| 6683 | 6683 | $key .= $rate['nprtva'] ? '*' : '';  | 
                                                        
| 6684 | 6684 |  				if ($mode > 0 && $rate['code']) { | 
                                                        
| 6685 | -					$key .= ' (' . $rate['code'] . ')'; | 
                                                        |
| 6685 | +					$key .= ' ('.$rate['code'].')'; | 
                                                        |
| 6686 | 6686 | }  | 
                                                        
| 6687 | 6687 |  				if ($mode < 0) { | 
                                                        
| 6688 | 6688 | $key = $rate['rowid'];  | 
                                                        
| 6689 | 6689 | }  | 
                                                        
| 6690 | 6690 | |
| 6691 | - $return .= '<option value="' . $key . '"';  | 
                                                        |
| 6691 | + $return .= '<option value="'.$key.'"';  | 
                                                        |
| 6692 | 6692 |  				if (!$selectedfound) { | 
                                                        
| 6693 | 6693 |  					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag | 
                                                        
| 6694 | 6694 |  						if ($defaultcode == $rate['code']) { | 
                                                        
@@ -6759,7 +6759,7 @@ discard block  | 
                                                    ||
| 6759 | 6759 | 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 = '')  | 
                                                        
| 6760 | 6760 |  	{ | 
                                                        
| 6761 | 6761 | // phpcs:enable  | 
                                                        
| 6762 | - dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6762 | + dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6763 | 6763 | $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);  | 
                                                        
| 6764 | 6764 |  		if (!empty($nooutput)) { | 
                                                        
| 6765 | 6765 | return $retstring;  | 
                                                        
@@ -6788,11 +6788,11 @@ discard block  | 
                                                    ||
| 6788 | 6788 |  	{ | 
                                                        
| 6789 | 6789 | global $langs;  | 
                                                        
| 6790 | 6790 | |
| 6791 | -		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6791 | +		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6792 | 6792 |  		if ($forcenewline) { | 
                                                        
| 6793 | 6793 | $ret .= '<br>';  | 
                                                        
| 6794 | 6794 | }  | 
                                                        
| 6795 | -		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6795 | +		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6796 | 6796 | return $ret;  | 
                                                        
| 6797 | 6797 | }  | 
                                                        
| 6798 | 6798 | |
@@ -6858,7 +6858,7 @@ discard block  | 
                                                    ||
| 6858 | 6858 | $orig_set_time = $set_time;  | 
                                                        
| 6859 | 6859 | |
| 6860 | 6860 |  		if ($set_time === '' && $emptydate == 0) { | 
                                                        
| 6861 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 6861 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 6862 | 6862 |  			if ($gm == 'tzuser' || $gm == 'tzuserrel') { | 
                                                        
| 6863 | 6863 | $set_time = dol_now($gm);  | 
                                                        
| 6864 | 6864 |  			} else { | 
                                                        
@@ -6930,38 +6930,38 @@ discard block  | 
                                                    ||
| 6930 | 6930 | // Calendrier popup version eldy  | 
                                                        
| 6931 | 6931 |  				if ($usecalendar == "eldy") { | 
                                                        
| 6932 | 6932 | // Input area to enter date manually  | 
                                                        
| 6933 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';  | 
                                                        |
| 6933 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        |
| 6934 | 6934 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 6935 | -					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6935 | +					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6936 | 6936 | $retstring .= ' autocomplete="off">';  | 
                                                        
| 6937 | 6937 | |
| 6938 | 6938 | // Icon calendar  | 
                                                        
| 6939 | 6939 | $retstringbuttom = '';  | 
                                                        
| 6940 | 6940 |  					if (!$disabled) { | 
                                                        
| 6941 | - $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 6942 | - $base = DOL_URL_ROOT . '/core/';  | 
                                                        |
| 6943 | -						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; | 
                                                        |
| 6944 | -						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6941 | + $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 6942 | + $base = DOL_URL_ROOT.'/core/';  | 
                                                        |
| 6943 | +						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; | 
                                                        |
| 6944 | +						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6945 | 6945 |  					} else { | 
                                                        
| 6946 | -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6946 | +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6947 | 6947 | }  | 
                                                        
| 6948 | - $retstring = $retstringbuttom . $retstring;  | 
                                                        |
| 6948 | + $retstring = $retstringbuttom.$retstring;  | 
                                                        |
| 6949 | 6949 | |
| 6950 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 6951 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 6952 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 6950 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 6951 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 6952 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 6953 | 6953 |  				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { | 
                                                        
| 6954 | 6954 |  					if (!$disabled && $usecalendar != 'html') { | 
                                                        
| 6955 | 6955 | // Output javascript for datepicker  | 
                                                        
| 6956 | 6956 |  						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); | 
                                                        
| 6957 | 6957 |  						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); | 
                                                        
| 6958 | 6958 | |
| 6959 | - $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';  | 
                                                        |
| 6960 | -						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ | 
                                                        |
| 6961 | -							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', | 
                                                        |
| 6959 | + $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';  | 
                                                        |
| 6960 | +						$retstring .= "$(function(){ $('#".$prefix."').datepicker({ | 
                                                        |
| 6961 | +							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', | 
                                                        |
| 6962 | 6962 | autoclose: true,  | 
                                                        
| 6963 | 6963 | todayHighlight: true,  | 
                                                        
| 6964 | - yearRange: '" . $minYear . ":" . $maxYear . "',";  | 
                                                        |
| 6964 | + yearRange: '" . $minYear.":".$maxYear."',";  | 
                                                        |
| 6965 | 6965 |  						if (!empty($conf->dol_use_jmobile)) { | 
                                                        
| 6966 | 6966 | $retstring .= "  | 
                                                        
| 6967 | 6967 |  								beforeShow: function (input, datePicker) { | 
                                                        
@@ -6976,7 +6976,7 @@ discard block  | 
                                                    ||
| 6976 | 6976 |  						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { | 
                                                        
| 6977 | 6977 | $retstring .= "  | 
                                                        
| 6978 | 6978 | showOn: 'button', /* both has problem with autocompletion */  | 
                                                        
| 6979 | - buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',  | 
                                                        |
| 6979 | + buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',  | 
                                                        |
| 6980 | 6980 | buttonImageOnly: true";  | 
                                                        
| 6981 | 6981 | }  | 
                                                        
| 6982 | 6982 | $retstring .= "  | 
                                                        
@@ -6988,46 +6988,46 @@ discard block  | 
                                                    ||
| 6988 | 6988 | $retstring .= '<div class="nowraponall inline-block divfordateinput">';  | 
                                                        
| 6989 | 6989 | $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        
| 6990 | 6990 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 6991 | - $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');  | 
                                                        |
| 6992 | -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6991 | + $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');  | 
                                                        |
| 6992 | +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6993 | 6993 | $retstring .= ' autocomplete="off">';  | 
                                                        
| 6994 | 6994 | |
| 6995 | 6995 | // Icone calendrier  | 
                                                        
| 6996 | 6996 |  					if ($disabled) { | 
                                                        
| 6997 | -						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6998 | - $retstring = $retstringbutton . $retstring;  | 
                                                        |
| 6997 | +						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6998 | + $retstring = $retstringbutton.$retstring;  | 
                                                        |
| 6999 | 6999 | }  | 
                                                        
| 7000 | 7000 | |
| 7001 | 7001 | $retstring .= '</div>';  | 
                                                        
| 7002 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 7003 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 7004 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 7002 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 7003 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 7004 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 7005 | 7005 |  				} else { | 
                                                        
| 7006 | 7006 | $retstring .= "Bad value of MAIN_POPUP_CALENDAR";  | 
                                                        
| 7007 | 7007 | }  | 
                                                        
| 7008 | 7008 |  			} else { | 
                                                        
| 7009 | 7009 | // Show date with combo selects  | 
                                                        
| 7010 | 7010 | // Day  | 
                                                        
| 7011 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';  | 
                                                        |
| 7011 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';  | 
                                                        |
| 7012 | 7012 | |
| 7013 | 7013 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7014 | 7014 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 7015 | 7015 | }  | 
                                                        
| 7016 | 7016 | |
| 7017 | 7017 |  				for ($day = 1; $day <= 31; $day++) { | 
                                                        
| 7018 | - $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';  | 
                                                        |
| 7018 | + $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';  | 
                                                        |
| 7019 | 7019 | }  | 
                                                        
| 7020 | 7020 | |
| 7021 | 7021 | $retstring .= "</select>";  | 
                                                        
| 7022 | 7022 | |
| 7023 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';  | 
                                                        |
| 7023 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';  | 
                                                        |
| 7024 | 7024 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7025 | 7025 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 7026 | 7026 | }  | 
                                                        
| 7027 | 7027 | |
| 7028 | 7028 | // Month  | 
                                                        
| 7029 | 7029 |  				for ($month = 1; $month <= 12; $month++) { | 
                                                        
| 7030 | - $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';  | 
                                                        |
| 7030 | + $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';  | 
                                                        |
| 7031 | 7031 | $retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");  | 
                                                        
| 7032 | 7032 | $retstring .= "</option>";  | 
                                                        
| 7033 | 7033 | }  | 
                                                        
@@ -7035,13 +7035,13 @@ discard block  | 
                                                    ||
| 7035 | 7035 | |
| 7036 | 7036 | // Year  | 
                                                        
| 7037 | 7037 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7038 | -					$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 . '">'; | 
                                                        |
| 7038 | +					$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.'">'; | 
                                                        |
| 7039 | 7039 |  				} else { | 
                                                        
| 7040 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';  | 
                                                        |
| 7040 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';  | 
                                                        |
| 7041 | 7041 | |
| 7042 | 7042 | $syear = (int) $syear;  | 
                                                        
| 7043 | 7043 |  					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { | 
                                                        
| 7044 | - $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';  | 
                                                        |
| 7044 | + $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';  | 
                                                        |
| 7045 | 7045 | }  | 
                                                        
| 7046 | 7046 | $retstring .= "</select>\n";  | 
                                                        
| 7047 | 7047 | }  | 
                                                        
@@ -7065,15 +7065,15 @@ discard block  | 
                                                    ||
| 7065 | 7065 | }  | 
                                                        
| 7066 | 7066 | }  | 
                                                        
| 7067 | 7067 | // Show hour  | 
                                                        
| 7068 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';  | 
                                                        |
| 7068 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';  | 
                                                        |
| 7069 | 7069 |  			if ($emptyhours) { | 
                                                        
| 7070 | 7070 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7071 | 7071 | }  | 
                                                        
| 7072 | 7072 |  			for ($hour = $hourstart; $hour < $hourend; $hour++) { | 
                                                        
| 7073 | 7073 |  				if (strlen($hour) < 2) { | 
                                                        
| 7074 | - $hour = "0" . $hour;  | 
                                                        |
| 7074 | + $hour = "0".$hour;  | 
                                                        |
| 7075 | 7075 | }  | 
                                                        
| 7076 | - $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;  | 
                                                        |
| 7076 | + $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;  | 
                                                        |
| 7077 | 7077 | //$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');  | 
                                                        
| 7078 | 7078 | $retstring .= '</option>';  | 
                                                        
| 7079 | 7079 | }  | 
                                                        
@@ -7086,17 +7086,17 @@ discard block  | 
                                                    ||
| 7086 | 7086 | |
| 7087 | 7087 |  		if ($m) { | 
                                                        
| 7088 | 7088 | // Show minutes  | 
                                                        
| 7089 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';  | 
                                                        |
| 7089 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';  | 
                                                        |
| 7090 | 7090 |  			if ($emptyhours) { | 
                                                        
| 7091 | 7091 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7092 | 7092 | }  | 
                                                        
| 7093 | 7093 |  			for ($min = 0; $min < 60; $min += $stepminutes) { | 
                                                        
| 7094 | 7094 |  				$min_str = sprintf("%02d", $min); | 
                                                        
| 7095 | - $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';  | 
                                                        |
| 7095 | + $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';  | 
                                                        |
| 7096 | 7096 | }  | 
                                                        
| 7097 | 7097 | $retstring .= '</select>';  | 
                                                        
| 7098 | 7098 | |
| 7099 | - $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';  | 
                                                        |
| 7099 | + $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';  | 
                                                        |
| 7100 | 7100 | }  | 
                                                        
| 7101 | 7101 | |
| 7102 | 7102 |  		if ($d && $h) { | 
                                                        
@@ -7119,10 +7119,10 @@ discard block  | 
                                                    ||
| 7119 | 7119 | |
| 7120 | 7120 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7121 | 7121 |  			if ($addnowlink == 1) { // server time expressed in user time setup | 
                                                        
| 7122 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7123 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7124 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7125 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7122 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7123 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7124 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7125 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7126 | 7126 |  			} elseif ($addnowlink == 2) { | 
                                                        
| 7127 | 7127 | /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.  | 
                                                        
| 7128 | 7128 | * This break application for foreign languages.  | 
                                                        
@@ -7131,10 +7131,10 @@ discard block  | 
                                                    ||
| 7131 | 7131 | $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';  | 
                                                        
| 7132 | 7132 | $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';  | 
                                                        
| 7133 | 7133 | */  | 
                                                        
| 7134 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7135 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7136 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7137 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7134 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7135 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7136 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7137 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7138 | 7138 | }  | 
                                                        
| 7139 | 7139 | /*if ($usecalendar == "eldy")  | 
                                                        
| 7140 | 7140 |  			{ | 
                                                        
@@ -7154,11 +7154,11 @@ discard block  | 
                                                    ||
| 7154 | 7154 | }  | 
                                                        
| 7155 | 7155 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';  | 
                                                        
| 7156 | 7156 |  				if ($addnowlink == 1) { | 
                                                        
| 7157 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7158 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7157 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7158 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7159 | 7159 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7160 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7161 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7160 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7161 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7162 | 7162 | }  | 
                                                        
| 7163 | 7163 | |
| 7164 | 7164 |  				if ($fullday) { | 
                                                        
@@ -7172,11 +7172,11 @@ discard block  | 
                                                    ||
| 7172 | 7172 | }  | 
                                                        
| 7173 | 7173 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';  | 
                                                        
| 7174 | 7174 |  				if ($addnowlink == 1) { | 
                                                        
| 7175 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7176 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7175 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7176 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7177 | 7177 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7178 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7179 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7178 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7179 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7180 | 7180 | }  | 
                                                        
| 7181 | 7181 |  				if ($fullday) { | 
                                                        
| 7182 | 7182 | $reset_scripts .= ' } ';  | 
                                                        
@@ -7184,7 +7184,7 @@ discard block  | 
                                                    ||
| 7184 | 7184 | }  | 
                                                        
| 7185 | 7185 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7186 | 7186 |  			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { | 
                                                        
| 7187 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7187 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7188 | 7188 |  				$retstring .= $langs->trans("Now"); | 
                                                        
| 7189 | 7189 | $retstring .= '</button> ';  | 
                                                        
| 7190 | 7190 | }  | 
                                                        
@@ -7196,16 +7196,16 @@ discard block  | 
                                                    ||
| 7196 | 7196 | $reset_scripts = "";  | 
                                                        
| 7197 | 7197 | |
| 7198 | 7198 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7199 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';  | 
                                                        |
| 7200 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7201 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7202 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7199 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';  | 
                                                        |
| 7200 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7201 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7202 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7203 | 7203 | // Update the hour part  | 
                                                        
| 7204 | 7204 |  			if ($h) { | 
                                                        
| 7205 | 7205 |  				if ($fullday) { | 
                                                        
| 7206 | 7206 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7207 | 7207 | }  | 
                                                        
| 7208 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7208 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7209 | 7209 |  				if ($fullday) { | 
                                                        
| 7210 | 7210 | $reset_scripts .= ' } ';  | 
                                                        
| 7211 | 7211 | }  | 
                                                        
@@ -7215,14 +7215,14 @@ discard block  | 
                                                    ||
| 7215 | 7215 |  				if ($fullday) { | 
                                                        
| 7216 | 7216 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7217 | 7217 | }  | 
                                                        
| 7218 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7218 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7219 | 7219 |  				if ($fullday) { | 
                                                        
| 7220 | 7220 | $reset_scripts .= ' } ';  | 
                                                        
| 7221 | 7221 | }  | 
                                                        
| 7222 | 7222 | }  | 
                                                        
| 7223 | 7223 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7224 | 7224 |  			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 7225 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7225 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7226 | 7226 |  				$retstring .= $langs->trans("DateStartPlusOne"); | 
                                                        
| 7227 | 7227 | $retstring .= '</button> ';  | 
                                                        
| 7228 | 7228 | }  | 
                                                        
@@ -7280,17 +7280,17 @@ discard block  | 
                                                    ||
| 7280 | 7280 | unset($TDurationTypes[$value]);  | 
                                                        
| 7281 | 7281 | }  | 
                                                        
| 7282 | 7282 | |
| 7283 | - $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';  | 
                                                        |
| 7283 | + $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';  | 
                                                        |
| 7284 | 7284 |  		foreach ($TDurationTypes as $key => $typeduration) { | 
                                                        
| 7285 | - $retstring .= '<option value="' . $key . '"';  | 
                                                        |
| 7285 | + $retstring .= '<option value="'.$key.'"';  | 
                                                        |
| 7286 | 7286 |  			if ($key == $selected) { | 
                                                        
| 7287 | 7287 | $retstring .= " selected";  | 
                                                        
| 7288 | 7288 | }  | 
                                                        
| 7289 | - $retstring .= ">" . $typeduration . "</option>";  | 
                                                        |
| 7289 | + $retstring .= ">".$typeduration."</option>";  | 
                                                        |
| 7290 | 7290 | }  | 
                                                        
| 7291 | 7291 | $retstring .= "</select>";  | 
                                                        
| 7292 | 7292 | |
| 7293 | -		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); | 
                                                        |
| 7293 | +		$retstring .= ajax_combobox('select_'.$prefix.'type_duration'); | 
                                                        |
| 7294 | 7294 | |
| 7295 | 7295 | return $retstring;  | 
                                                        
| 7296 | 7296 | }  | 
                                                        
@@ -7322,30 +7322,30 @@ discard block  | 
                                                    ||
| 7322 | 7322 | |
| 7323 | 7323 | // Hours  | 
                                                        
| 7324 | 7324 |  		if ($iSecond != '') { | 
                                                        
| 7325 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 7325 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 7326 | 7326 | |
| 7327 | 7327 | $hourSelected = convertSecondToTime($iSecond, 'allhour');  | 
                                                        
| 7328 | 7328 | $minSelected = convertSecondToTime($iSecond, 'min');  | 
                                                        
| 7329 | 7329 | }  | 
                                                        
| 7330 | 7330 | |
| 7331 | 7331 |  		if ($typehour == 'select') { | 
                                                        
| 7332 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7332 | + $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7333 | 7333 |  			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours | 
                                                        
| 7334 | - $retstring .= '<option value="' . $hour . '"';  | 
                                                        |
| 7334 | + $retstring .= '<option value="'.$hour.'"';  | 
                                                        |
| 7335 | 7335 |  				if (is_numeric($hourSelected) && $hourSelected == $hour) { | 
                                                        
| 7336 | 7336 | $retstring .= " selected";  | 
                                                        
| 7337 | 7337 | }  | 
                                                        
| 7338 | - $retstring .= ">" . $hour . "</option>";  | 
                                                        |
| 7338 | + $retstring .= ">".$hour."</option>";  | 
                                                        |
| 7339 | 7339 | }  | 
                                                        
| 7340 | 7340 | $retstring .= "</select>";  | 
                                                        
| 7341 | 7341 |  		} elseif ($typehour == 'text' || $typehour == 'textselect') { | 
                                                        
| 7342 | -			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; | 
                                                        |
| 7342 | +			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; | 
                                                        |
| 7343 | 7343 |  		} else { | 
                                                        
| 7344 | 7344 | return 'BadValueForParameterTypeHour';  | 
                                                        
| 7345 | 7345 | }  | 
                                                        
| 7346 | 7346 | |
| 7347 | 7347 |  		if ($typehour != 'text') { | 
                                                        
| 7348 | -			$retstring .= ' ' . $langs->trans('HourShort'); | 
                                                        |
| 7348 | +			$retstring .= ' '.$langs->trans('HourShort'); | 
                                                        |
| 7349 | 7349 |  		} else { | 
                                                        
| 7350 | 7350 | $retstring .= '<span class="">:</span>';  | 
                                                        
| 7351 | 7351 | }  | 
                                                        
@@ -7360,21 +7360,21 @@ discard block  | 
                                                    ||
| 7360 | 7360 | }  | 
                                                        
| 7361 | 7361 | |
| 7362 | 7362 |  		if ($typehour == 'select' || $typehour == 'textselect') { | 
                                                        
| 7363 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7363 | + $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7364 | 7364 |  			for ($min = 0; $min <= 55; $min += 5) { | 
                                                        
| 7365 | - $retstring .= '<option value="' . $min . '"';  | 
                                                        |
| 7365 | + $retstring .= '<option value="'.$min.'"';  | 
                                                        |
| 7366 | 7366 |  				if (is_numeric($minSelected) && $minSelected == $min) { | 
                                                        
| 7367 | 7367 | $retstring .= ' selected';  | 
                                                        
| 7368 | 7368 | }  | 
                                                        
| 7369 | - $retstring .= '>' . $min . '</option>';  | 
                                                        |
| 7369 | + $retstring .= '>'.$min.'</option>';  | 
                                                        |
| 7370 | 7370 | }  | 
                                                        
| 7371 | 7371 | $retstring .= "</select>";  | 
                                                        
| 7372 | 7372 |  		} elseif ($typehour == 'text') { | 
                                                        
| 7373 | -			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; | 
                                                        |
| 7373 | +			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; | 
                                                        |
| 7374 | 7374 | }  | 
                                                        
| 7375 | 7375 | |
| 7376 | 7376 |  		if ($typehour != 'text') { | 
                                                        
| 7377 | -			$retstring .= ' ' . $langs->trans('MinuteShort'); | 
                                                        |
| 7377 | +			$retstring .= ' '.$langs->trans('MinuteShort'); | 
                                                        |
| 7378 | 7378 | }  | 
                                                        
| 7379 | 7379 | |
| 7380 | 7380 | $retstring .= "</span>";  | 
                                                        
@@ -7422,7 +7422,7 @@ discard block  | 
                                                    ||
| 7422 | 7422 | $placeholder = '';  | 
                                                        
| 7423 | 7423 | |
| 7424 | 7424 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7425 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7425 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7426 | 7426 | $tickettmpselect = new Ticket($this->db);  | 
                                                        
| 7427 | 7427 | $tickettmpselect->fetch($selected);  | 
                                                        
| 7428 | 7428 | $selected_input_value = $tickettmpselect->ref;  | 
                                                        
@@ -7430,17 +7430,17 @@ discard block  | 
                                                    ||
| 7430 | 7430 | }  | 
                                                        
| 7431 | 7431 | |
| 7432 | 7432 | $urloption = '';  | 
                                                        
| 7433 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7433 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7434 | 7434 | |
| 7435 | 7435 |  			if (empty($hidelabel)) { | 
                                                        
| 7436 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7436 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7437 | 7437 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7438 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7438 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7439 | 7439 |  				if ($hidelabel == 2) { | 
                                                        
| 7440 | 7440 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7441 | 7441 | }  | 
                                                        
| 7442 | 7442 | }  | 
                                                        
| 7443 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7443 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7444 | 7444 |  			if ($hidelabel == 3) { | 
                                                        
| 7445 | 7445 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7446 | 7446 | }  | 
                                                        
@@ -7484,8 +7484,8 @@ discard block  | 
                                                    ||
| 7484 | 7484 | |
| 7485 | 7485 | $sql = "SELECT ";  | 
                                                        
| 7486 | 7486 | $sql .= $selectFields;  | 
                                                        
| 7487 | - $sql .= " FROM " . $this->db->prefix() . "ticket as p";  | 
                                                        |
| 7488 | -		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; | 
                                                        |
| 7487 | + $sql .= " FROM ".$this->db->prefix()."ticket as p";  | 
                                                        |
| 7488 | +		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; | 
                                                        |
| 7489 | 7489 | |
| 7490 | 7490 | // Add criteria on ref/label  | 
                                                        
| 7491 | 7491 |  		if ($filterkey != '') { | 
                                                        
@@ -7501,7 +7501,7 @@ discard block  | 
                                                    ||
| 7501 | 7501 |  				if ($i > 0) { | 
                                                        
| 7502 | 7502 | $sql .= " AND ";  | 
                                                        
| 7503 | 7503 | }  | 
                                                        
| 7504 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7504 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7505 | 7505 | $sql .= ")";  | 
                                                        
| 7506 | 7506 | $i++;  | 
                                                        
| 7507 | 7507 | }  | 
                                                        
@@ -7514,22 +7514,22 @@ discard block  | 
                                                    ||
| 7514 | 7514 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7515 | 7515 | |
| 7516 | 7516 | // Build output string  | 
                                                        
| 7517 | - dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7517 | + dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7518 | 7518 | $result = $this->db->query($sql);  | 
                                                        
| 7519 | 7519 |  		if ($result) { | 
                                                        
| 7520 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7521 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';  | 
                                                        |
| 7520 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7521 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';  | 
                                                        |
| 7522 | 7522 | |
| 7523 | 7523 | $num = $this->db->num_rows($result);  | 
                                                        
| 7524 | 7524 | |
| 7525 | 7525 | $events = array();  | 
                                                        
| 7526 | 7526 | |
| 7527 | 7527 |  			if (!$forcecombo) { | 
                                                        
| 7528 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7528 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7529 | 7529 | $out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7530 | 7530 | }  | 
                                                        
| 7531 | 7531 | |
| 7532 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7532 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7533 | 7533 | |
| 7534 | 7534 | $textifempty = '';  | 
                                                        
| 7535 | 7535 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7546,7 +7546,7 @@ discard block  | 
                                                    ||
| 7546 | 7546 | }  | 
                                                        
| 7547 | 7547 | }  | 
                                                        
| 7548 | 7548 |  			if ($showempty) { | 
                                                        
| 7549 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7549 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7550 | 7550 | }  | 
                                                        
| 7551 | 7551 | |
| 7552 | 7552 | $i = 0;  | 
                                                        
@@ -7601,13 +7601,13 @@ discard block  | 
                                                    ||
| 7601 | 7601 | $outref = $objp->ref;  | 
                                                        
| 7602 | 7602 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7603 | 7603 | |
| 7604 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7604 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7605 | 7605 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7606 | 7606 | $opt .= '>';  | 
                                                        
| 7607 | 7607 | $opt .= $objp->ref;  | 
                                                        
| 7608 | 7608 | $objRef = $objp->ref;  | 
                                                        
| 7609 | 7609 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7610 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7610 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7611 | 7611 | }  | 
                                                        
| 7612 | 7612 | |
| 7613 | 7613 | $opt .= "</option>\n";  | 
                                                        
@@ -7648,7 +7648,7 @@ discard block  | 
                                                    ||
| 7648 | 7648 | $placeholder = '';  | 
                                                        
| 7649 | 7649 | |
| 7650 | 7650 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7651 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7651 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7652 | 7652 | $projecttmpselect = new Project($this->db);  | 
                                                        
| 7653 | 7653 | $projecttmpselect->fetch($selected);  | 
                                                        
| 7654 | 7654 | $selected_input_value = $projecttmpselect->ref;  | 
                                                        
@@ -7656,17 +7656,17 @@ discard block  | 
                                                    ||
| 7656 | 7656 | }  | 
                                                        
| 7657 | 7657 | |
| 7658 | 7658 | $urloption = '';  | 
                                                        
| 7659 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7659 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7660 | 7660 | |
| 7661 | 7661 |  			if (empty($hidelabel)) { | 
                                                        
| 7662 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7662 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7663 | 7663 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7664 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7664 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7665 | 7665 |  				if ($hidelabel == 2) { | 
                                                        
| 7666 | 7666 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7667 | 7667 | }  | 
                                                        
| 7668 | 7668 | }  | 
                                                        
| 7669 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7669 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7670 | 7670 |  			if ($hidelabel == 3) { | 
                                                        
| 7671 | 7671 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7672 | 7672 | }  | 
                                                        
@@ -7709,8 +7709,8 @@ discard block  | 
                                                    ||
| 7709 | 7709 | |
| 7710 | 7710 | $sql = "SELECT ";  | 
                                                        
| 7711 | 7711 | $sql .= $selectFields;  | 
                                                        
| 7712 | - $sql .= " FROM " . $this->db->prefix() . "projet as p";  | 
                                                        |
| 7713 | -		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; | 
                                                        |
| 7712 | + $sql .= " FROM ".$this->db->prefix()."projet as p";  | 
                                                        |
| 7713 | +		$sql .= ' WHERE p.entity IN ('.getEntity('project').')'; | 
                                                        |
| 7714 | 7714 | |
| 7715 | 7715 | // Add criteria on ref/label  | 
                                                        
| 7716 | 7716 |  		if ($filterkey != '') { | 
                                                        
@@ -7726,7 +7726,7 @@ discard block  | 
                                                    ||
| 7726 | 7726 |  				if ($i > 0) { | 
                                                        
| 7727 | 7727 | $sql .= " AND ";  | 
                                                        
| 7728 | 7728 | }  | 
                                                        
| 7729 | - $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7729 | + $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7730 | 7730 | $sql .= "";  | 
                                                        
| 7731 | 7731 | $i++;  | 
                                                        
| 7732 | 7732 | }  | 
                                                        
@@ -7739,22 +7739,22 @@ discard block  | 
                                                    ||
| 7739 | 7739 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7740 | 7740 | |
| 7741 | 7741 | // Build output string  | 
                                                        
| 7742 | - dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7742 | + dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7743 | 7743 | $result = $this->db->query($sql);  | 
                                                        
| 7744 | 7744 |  		if ($result) { | 
                                                        
| 7745 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7746 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 7745 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7746 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 7747 | 7747 | |
| 7748 | 7748 | $num = $this->db->num_rows($result);  | 
                                                        
| 7749 | 7749 | |
| 7750 | 7750 | $events = array();  | 
                                                        
| 7751 | 7751 | |
| 7752 | 7752 |  			if (!$forcecombo) { | 
                                                        
| 7753 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7753 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7754 | 7754 | $out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7755 | 7755 | }  | 
                                                        
| 7756 | 7756 | |
| 7757 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7757 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7758 | 7758 | |
| 7759 | 7759 | $textifempty = '';  | 
                                                        
| 7760 | 7760 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7771,7 +7771,7 @@ discard block  | 
                                                    ||
| 7771 | 7771 | }  | 
                                                        
| 7772 | 7772 | }  | 
                                                        
| 7773 | 7773 |  			if ($showempty) { | 
                                                        
| 7774 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7774 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7775 | 7775 | }  | 
                                                        
| 7776 | 7776 | |
| 7777 | 7777 | $i = 0;  | 
                                                        
@@ -7829,13 +7829,13 @@ discard block  | 
                                                    ||
| 7829 | 7829 | $outlabel = $objp->label;  | 
                                                        
| 7830 | 7830 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7831 | 7831 | |
| 7832 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7832 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7833 | 7833 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7834 | 7834 | $opt .= '>';  | 
                                                        
| 7835 | 7835 | $opt .= $objp->ref;  | 
                                                        
| 7836 | 7836 | $objRef = $objp->ref;  | 
                                                        
| 7837 | 7837 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7838 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7838 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7839 | 7839 | }  | 
                                                        
| 7840 | 7840 | |
| 7841 | 7841 | $opt .= "</option>\n";  | 
                                                        
@@ -7877,7 +7877,7 @@ discard block  | 
                                                    ||
| 7877 | 7877 | $placeholder = '';  | 
                                                        
| 7878 | 7878 | |
| 7879 | 7879 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7880 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 7880 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 7881 | 7881 | $adherenttmpselect = new Adherent($this->db);  | 
                                                        
| 7882 | 7882 | $adherenttmpselect->fetch($selected);  | 
                                                        
| 7883 | 7883 | $selected_input_value = $adherenttmpselect->ref;  | 
                                                        
@@ -7886,17 +7886,17 @@ discard block  | 
                                                    ||
| 7886 | 7886 | |
| 7887 | 7887 | $urloption = '';  | 
                                                        
| 7888 | 7888 | |
| 7889 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7889 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7890 | 7890 | |
| 7891 | 7891 |  			if (empty($hidelabel)) { | 
                                                        
| 7892 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7892 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7893 | 7893 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7894 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7894 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7895 | 7895 |  				if ($hidelabel == 2) { | 
                                                        
| 7896 | 7896 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7897 | 7897 | }  | 
                                                        
| 7898 | 7898 | }  | 
                                                        
| 7899 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7899 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7900 | 7900 |  			if ($hidelabel == 3) { | 
                                                        
| 7901 | 7901 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7902 | 7902 | }  | 
                                                        
@@ -7941,8 +7941,8 @@ discard block  | 
                                                    ||
| 7941 | 7941 | |
| 7942 | 7942 | $sql = "SELECT ";  | 
                                                        
| 7943 | 7943 | $sql .= $selectFields;  | 
                                                        
| 7944 | - $sql .= " FROM " . $this->db->prefix() . "adherent as p";  | 
                                                        |
| 7945 | -		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; | 
                                                        |
| 7944 | + $sql .= " FROM ".$this->db->prefix()."adherent as p";  | 
                                                        |
| 7945 | +		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; | 
                                                        |
| 7946 | 7946 | |
| 7947 | 7947 | // Add criteria on ref/label  | 
                                                        
| 7948 | 7948 |  		if ($filterkey != '') { | 
                                                        
@@ -7958,8 +7958,8 @@ discard block  | 
                                                    ||
| 7958 | 7958 |  				if ($i > 0) { | 
                                                        
| 7959 | 7959 | $sql .= " AND ";  | 
                                                        
| 7960 | 7960 | }  | 
                                                        
| 7961 | - $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7962 | - $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 7961 | + $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7962 | + $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 7963 | 7963 | $i++;  | 
                                                        
| 7964 | 7964 | }  | 
                                                        
| 7965 | 7965 |  			if (count($search_crit) > 1) { | 
                                                        
@@ -7968,27 +7968,27 @@ discard block  | 
                                                    ||
| 7968 | 7968 | $sql .= ')';  | 
                                                        
| 7969 | 7969 | }  | 
                                                        
| 7970 | 7970 |  		if ($status != -1) { | 
                                                        
| 7971 | - $sql .= ' AND statut = ' . ((int) $status);  | 
                                                        |
| 7971 | + $sql .= ' AND statut = '.((int) $status);  | 
                                                        |
| 7972 | 7972 | }  | 
                                                        
| 7973 | 7973 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7974 | 7974 | |
| 7975 | 7975 | // Build output string  | 
                                                        
| 7976 | - dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 7976 | + dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 7977 | 7977 | $result = $this->db->query($sql);  | 
                                                        
| 7978 | 7978 |  		if ($result) { | 
                                                        
| 7979 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 7980 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';  | 
                                                        |
| 7979 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 7980 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';  | 
                                                        |
| 7981 | 7981 | |
| 7982 | 7982 | $num = $this->db->num_rows($result);  | 
                                                        
| 7983 | 7983 | |
| 7984 | 7984 | $events = array();  | 
                                                        
| 7985 | 7985 | |
| 7986 | 7986 |  			if (!$forcecombo) { | 
                                                        
| 7987 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7987 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7988 | 7988 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); | 
                                                        
| 7989 | 7989 | }  | 
                                                        
| 7990 | 7990 | |
| 7991 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7991 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7992 | 7992 | |
| 7993 | 7993 | $textifempty = '';  | 
                                                        
| 7994 | 7994 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -8005,7 +8005,7 @@ discard block  | 
                                                    ||
| 8005 | 8005 | }  | 
                                                        
| 8006 | 8006 | }  | 
                                                        
| 8007 | 8007 |  			if ($showempty) { | 
                                                        
| 8008 | - $out .= '<option value="-1" selected>' . $textifempty . '</option>';  | 
                                                        |
| 8008 | + $out .= '<option value="-1" selected>'.$textifempty.'</option>';  | 
                                                        |
| 8009 | 8009 | }  | 
                                                        
| 8010 | 8010 | |
| 8011 | 8011 | $i = 0;  | 
                                                        
@@ -8061,11 +8061,11 @@ discard block  | 
                                                    ||
| 8061 | 8061 | $outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);  | 
                                                        
| 8062 | 8062 | $outtype = $objp->fk_adherent_type;  | 
                                                        
| 8063 | 8063 | |
| 8064 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 8064 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 8065 | 8065 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 8066 | 8066 | $opt .= '>';  | 
                                                        
| 8067 | 8067 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 8068 | -			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8068 | +			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8069 | 8069 | }  | 
                                                        
| 8070 | 8070 | $opt .= $outlabel;  | 
                                                        
| 8071 | 8071 | $opt .= "</option>\n";  | 
                                                        
@@ -8100,8 +8100,8 @@ discard block  | 
                                                    ||
| 8100 | 8100 | $objectdescorig = $objectdesc;  | 
                                                        
| 8101 | 8101 | $objecttmp = null;  | 
                                                        
| 8102 | 8102 | $InfoFieldList = array();  | 
                                                        
| 8103 | - $filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8104 | - $sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8103 | + $filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8104 | + $sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8105 | 8105 | |
| 8106 | 8106 |  		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield | 
                                                        
| 8107 | 8107 | // Example: $objectfield = 'product:options_package'  | 
                                                        
@@ -8142,9 +8142,9 @@ discard block  | 
                                                    ||
| 8142 | 8142 | $vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);  | 
                                                        
| 8143 | 8143 | $reg = array();  | 
                                                        
| 8144 | 8144 |  			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { | 
                                                        
| 8145 | - $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8145 | + $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8146 | 8146 | }  | 
                                                        
| 8147 | -			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field | 
                                                        |
| 8147 | +			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field | 
                                                        |
| 8148 | 8148 | |
| 8149 | 8149 | $classname = $InfoFieldList[0];  | 
                                                        
| 8150 | 8150 | $classpath = $InfoFieldList[1];  | 
                                                        
@@ -8175,8 +8175,8 @@ discard block  | 
                                                    ||
| 8175 | 8175 | );  | 
                                                        
| 8176 | 8176 | |
| 8177 | 8177 |  		if (!is_object($objecttmp)) { | 
                                                        
| 8178 | -			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                        |
| 8179 | - return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;  | 
                                                        |
| 8178 | +			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING); | 
                                                        |
| 8179 | + return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;  | 
                                                        |
| 8180 | 8180 | }  | 
                                                        
| 8181 | 8181 | '@phan-var-force CommonObject $objecttmp';  | 
                                                        
| 8182 | 8182 | |
@@ -8188,9 +8188,9 @@ discard block  | 
                                                    ||
| 8188 | 8188 |  		if ($prefixforautocompletemode == 'product') { | 
                                                        
| 8189 | 8189 | $prefixforautocompletemode = 'produit';  | 
                                                        
| 8190 | 8190 | }  | 
                                                        
| 8191 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8191 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8192 | 8192 | |
| 8193 | - dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);  | 
                                                        |
| 8193 | + dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);  | 
                                                        |
| 8194 | 8194 | |
| 8195 | 8195 | // Generate the combo HTML component  | 
                                                        
| 8196 | 8196 | $out = '';  | 
                                                        
@@ -8219,13 +8219,13 @@ discard block  | 
                                                    ||
| 8219 | 8219 | }  | 
                                                        
| 8220 | 8220 | |
| 8221 | 8221 | // Set url and param to call to get json of the search results  | 
                                                        
| 8222 | - $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';  | 
                                                        |
| 8223 | - $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');  | 
                                                        |
| 8222 | + $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';  | 
                                                        |
| 8223 | + $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');  | 
                                                        |
| 8224 | 8224 | |
| 8225 | 8225 | // Activate the auto complete using ajax call.  | 
                                                        
| 8226 | 8226 | $out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);  | 
                                                        
| 8227 | 8227 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 8228 | - $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) . '"' : '') . ' />';  | 
                                                        |
| 8228 | + $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).'"' : '').' />';  | 
                                                        |
| 8229 | 8229 |  		} else { | 
                                                        
| 8230 | 8230 | // Immediate load of table record.  | 
                                                        
| 8231 | 8231 | $out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);  | 
                                                        
@@ -8265,16 +8265,16 @@ discard block  | 
                                                    ||
| 8265 | 8265 |  		if ($prefixforautocompletemode == 'societe') { | 
                                                        
| 8266 | 8266 | $prefixforautocompletemode = 'company';  | 
                                                        
| 8267 | 8267 | }  | 
                                                        
| 8268 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8268 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8269 | 8269 | |
| 8270 | 8270 |  		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...) | 
                                                        
| 8271 | 8271 | $tmpfieldstoshow = '';  | 
                                                        
| 8272 | 8272 |  			foreach ($objecttmp->fields as $key => $val) { | 
                                                        
| 8273 | -				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        |
| 8273 | +				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        |
| 8274 | 8274 | continue;  | 
                                                        
| 8275 | 8275 | }  | 
                                                        
| 8276 | 8276 |  				if (!empty($val['showoncombobox'])) { | 
                                                        
| 8277 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;  | 
                                                        |
| 8277 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;  | 
                                                        |
| 8278 | 8278 | }  | 
                                                        
| 8279 | 8279 | }  | 
                                                        
| 8280 | 8280 |  			if ($tmpfieldstoshow) { | 
                                                        
@@ -8302,18 +8302,18 @@ discard block  | 
                                                    ||
| 8302 | 8302 | $num = 0;  | 
                                                        
| 8303 | 8303 | |
| 8304 | 8304 | // Search data  | 
                                                        
| 8305 | - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";  | 
                                                        |
| 8305 | + $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";  | 
                                                        |
| 8306 | 8306 |  		if (!empty($objecttmp->isextrafieldmanaged)) { | 
                                                        
| 8307 | - $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8307 | + $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8308 | 8308 | }  | 
                                                        
| 8309 | 8309 |  		if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8310 | 8310 |  			if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8311 | 8311 |  				$tmparray = explode('@', $objecttmp->ismultientitymanaged); | 
                                                        
| 8312 | - $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];  | 
                                                        |
| 8312 | + $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];  | 
                                                        |
| 8313 | 8313 | }  | 
                                                        
| 8314 | 8314 |  			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8315 | 8315 |  				if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8316 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 8316 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 8317 | 8317 | }  | 
                                                        
| 8318 | 8318 | }  | 
                                                        
| 8319 | 8319 | }  | 
                                                        
@@ -8333,21 +8333,21 @@ discard block  | 
                                                    ||
| 8333 | 8333 | $sql .= " WHERE 1=1";  | 
                                                        
| 8334 | 8334 |  			if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8335 | 8335 |  				if ($objecttmp->ismultientitymanaged == 1) { | 
                                                        
| 8336 | -					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; | 
                                                        |
| 8336 | +					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; | 
                                                        |
| 8337 | 8337 | }  | 
                                                        
| 8338 | 8338 |  				if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8339 | - $sql .= " AND parenttable.entity = t." . $tmparray[0];  | 
                                                        |
| 8339 | + $sql .= " AND parenttable.entity = t.".$tmparray[0];  | 
                                                        |
| 8340 | 8340 | }  | 
                                                        
| 8341 | 8341 |  				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { | 
                                                        
| 8342 | 8342 |  					if ($objecttmp->element == 'societe') { | 
                                                        
| 8343 | - $sql .= " AND t.rowid = " . ((int) $user->socid);  | 
                                                        |
| 8343 | + $sql .= " AND t.rowid = ".((int) $user->socid);  | 
                                                        |
| 8344 | 8344 |  					} else { | 
                                                        
| 8345 | - $sql .= " AND t.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 8345 | + $sql .= " AND t.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 8346 | 8346 | }  | 
                                                        
| 8347 | 8347 | }  | 
                                                        
| 8348 | 8348 |  				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8349 | 8349 |  					if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8350 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 8350 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 8351 | 8351 | }  | 
                                                        
| 8352 | 8352 | }  | 
                                                        
| 8353 | 8353 | }  | 
                                                        
@@ -8359,7 +8359,7 @@ discard block  | 
                                                    ||
| 8359 | 8359 | $errormessage = '';  | 
                                                        
| 8360 | 8360 | $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);  | 
                                                        
| 8361 | 8361 |  				if ($errormessage) { | 
                                                        
| 8362 | - return 'Error forging a SQL request from an universal criteria: ' . $errormessage;  | 
                                                        |
| 8362 | + return 'Error forging a SQL request from an universal criteria: '.$errormessage;  | 
                                                        |
| 8363 | 8363 | }  | 
                                                        
| 8364 | 8364 | }  | 
                                                        
| 8365 | 8365 | }  | 
                                                        
@@ -8371,7 +8371,7 @@ discard block  | 
                                                    ||
| 8371 | 8371 | $resql = $this->db->query($sql);  | 
                                                        
| 8372 | 8372 |  		if ($resql) { | 
                                                        
| 8373 | 8373 | // Construct $out and $outarray  | 
                                                        
| 8374 | - $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";  | 
                                                        |
| 8374 | + $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";  | 
                                                        |
| 8375 | 8375 | |
| 8376 | 8376 | // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4  | 
                                                        
| 8377 | 8377 | $textifempty = ' ';  | 
                                                        
@@ -8385,7 +8385,7 @@ discard block  | 
                                                    ||
| 8385 | 8385 | }  | 
                                                        
| 8386 | 8386 | }  | 
                                                        
| 8387 | 8387 |  			if ($showempty) { | 
                                                        
| 8388 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";  | 
                                                        |
| 8388 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n";  | 
                                                        |
| 8389 | 8389 | }  | 
                                                        
| 8390 | 8390 | |
| 8391 | 8391 | $num = $this->db->num_rows($resql);  | 
                                                        
@@ -8408,9 +8408,9 @@ discard block  | 
                                                    ||
| 8408 | 8408 | }  | 
                                                        
| 8409 | 8409 |  					if (empty($outputmode)) { | 
                                                        
| 8410 | 8410 |  						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { | 
                                                        
| 8411 | - $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>';  | 
                                                        |
| 8411 | + $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>';  | 
                                                        |
| 8412 | 8412 |  						} else { | 
                                                        
| 8413 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 8413 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 8414 | 8414 | }  | 
                                                        
| 8415 | 8415 |  					} else { | 
                                                        
| 8416 | 8416 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); | 
                                                        
@@ -8423,10 +8423,10 @@ discard block  | 
                                                    ||
| 8423 | 8423 | }  | 
                                                        
| 8424 | 8424 | }  | 
                                                        
| 8425 | 8425 | |
| 8426 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8426 | + $out .= '</select>'."\n";  | 
                                                        |
| 8427 | 8427 | |
| 8428 | 8428 |  			if (!$forcecombo) { | 
                                                        
| 8429 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8429 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8430 | 8430 | $out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));  | 
                                                        
| 8431 | 8431 | }  | 
                                                        
| 8432 | 8432 |  		} else { | 
                                                        
@@ -8490,8 +8490,8 @@ discard block  | 
                                                    ||
| 8490 | 8490 | }  | 
                                                        
| 8491 | 8491 | }  | 
                                                        
| 8492 | 8492 |  		$idname = str_replace(array('[', ']'), array('', ''), $htmlname); | 
                                                        
| 8493 | -		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; | 
                                                        |
| 8494 | -		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); | 
                                                        |
| 8493 | +		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; | 
                                                        |
| 8494 | +		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); | 
                                                        |
| 8495 | 8495 | $out .= '>'."\n";  | 
                                                        
| 8496 | 8496 | |
| 8497 | 8497 |  		if ($show_empty) { | 
                                                        
@@ -8502,7 +8502,7 @@ discard block  | 
                                                    ||
| 8502 | 8502 |  			if (!is_numeric($show_empty)) { | 
                                                        
| 8503 | 8503 | $textforempty = $show_empty;  | 
                                                        
| 8504 | 8504 | }  | 
                                                        
| 8505 | - $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 8505 | + $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 8506 | 8506 | }  | 
                                                        
| 8507 | 8507 |  		if (is_array($array)) { | 
                                                        
| 8508 | 8508 | // Translate  | 
                                                        
@@ -8527,7 +8527,7 @@ discard block  | 
                                                    ||
| 8527 | 8527 | $value = $tmpvalue['label'];  | 
                                                        
| 8528 | 8528 | //$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];  | 
                                                        
| 8529 | 8529 | $disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';  | 
                                                        
| 8530 | - $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';  | 
                                                        |
| 8530 | + $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';  | 
                                                        |
| 8531 | 8531 |  				} else { | 
                                                        
| 8532 | 8532 | $value = $tmpvalue;  | 
                                                        
| 8533 | 8533 | //$valuehtml = $tmpvalue;  | 
                                                        
@@ -8543,9 +8543,9 @@ discard block  | 
                                                    ||
| 8543 | 8543 | }  | 
                                                        
| 8544 | 8544 |  				if ($key_in_label) { | 
                                                        
| 8545 | 8545 |  					if (empty($nohtmlescape)) { | 
                                                        
| 8546 | - $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8546 | + $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8547 | 8547 |  					} else { | 
                                                        
| 8548 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8548 | + $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8549 | 8549 | }  | 
                                                        
| 8550 | 8550 |  				} else { | 
                                                        
| 8551 | 8551 |  					if (empty($nohtmlescape)) { | 
                                                        
@@ -8557,8 +8557,8 @@ discard block  | 
                                                    ||
| 8557 | 8557 | $selectOptionValue = ' ';  | 
                                                        
| 8558 | 8558 | }  | 
                                                        
| 8559 | 8559 | }  | 
                                                        
| 8560 | - $out .= '<option value="' . $key . '"';  | 
                                                        |
| 8561 | - $out .= $style . $disabled;  | 
                                                        |
| 8560 | + $out .= '<option value="'.$key.'"';  | 
                                                        |
| 8561 | + $out .= $style.$disabled;  | 
                                                        |
| 8562 | 8562 |  				if (is_array($id)) { | 
                                                        
| 8563 | 8563 |  					if (in_array($key, $id) && !$disabled) { | 
                                                        
| 8564 | 8564 | $out .= ' selected'; // To preselect a value  | 
                                                        
@@ -8570,7 +8570,7 @@ discard block  | 
                                                    ||
| 8570 | 8570 | }  | 
                                                        
| 8571 | 8571 | }  | 
                                                        
| 8572 | 8572 |  				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. | 
                                                        
| 8573 | - $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';  | 
                                                        |
| 8573 | + $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';  | 
                                                        |
| 8574 | 8574 | }  | 
                                                        
| 8575 | 8575 | |
| 8576 | 8576 |  				if (is_array($tmpvalue)) { | 
                                                        
@@ -8589,7 +8589,7 @@ discard block  | 
                                                    ||
| 8589 | 8589 | // Add code for jquery to use multiselect  | 
                                                        
| 8590 | 8590 |  		if ($addjscombo && $jsbeautify) { | 
                                                        
| 8591 | 8591 | // Enhance with select2  | 
                                                        
| 8592 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8592 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8593 | 8593 | $out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);  | 
                                                        
| 8594 | 8594 | }  | 
                                                        
| 8595 | 8595 | |
@@ -8617,28 +8617,28 @@ discard block  | 
                                                    ||
| 8617 | 8617 | public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)  | 
                                                        
| 8618 | 8618 |  	{ | 
                                                        
| 8619 | 8619 | global $conf, $langs;  | 
                                                        
| 8620 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8620 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8621 | 8621 | |
| 8622 | 8622 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8623 | 8623 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8624 | 8624 | return '';  | 
                                                        
| 8625 | 8625 | }  | 
                                                        
| 8626 | 8626 | |
| 8627 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';  | 
                                                        |
| 8627 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';  | 
                                                        |
| 8628 | 8628 | |
| 8629 | 8629 | $outdelayed = '';  | 
                                                        
| 8630 | 8630 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8631 | 8631 | $tmpplugin = 'select2';  | 
                                                        
| 8632 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8633 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8632 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8633 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8634 | 8634 |  		    	$(document).ready(function () { | 
                                                        
| 8635 | 8635 | |
| 8636 | - ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '  | 
                                                        |
| 8636 | + ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'  | 
                                                        |
| 8637 | 8637 | |
| 8638 | -	                $(".' . $htmlname . '").select2({ | 
                                                        |
| 8638 | +	                $(".' . $htmlname.'").select2({ | 
                                                        |
| 8639 | 8639 |  				    	ajax: { | 
                                                        
| 8640 | 8640 | dir: "ltr",  | 
                                                        
| 8641 | - url: "' . $url . '",  | 
                                                        |
| 8641 | + url: "' . $url.'",  | 
                                                        |
| 8642 | 8642 | dataType: \'json\',  | 
                                                        
| 8643 | 8643 | delay: 250,  | 
                                                        
| 8644 | 8644 |  					    	data: function (params) { | 
                                                        
@@ -8665,9 +8665,9 @@ discard block  | 
                                                    ||
| 8665 | 8665 | },  | 
                                                        
| 8666 | 8666 | language: select2arrayoflanguage,  | 
                                                        
| 8667 | 8667 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8668 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8668 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8669 | 8669 |  				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8670 | - minimumInputLength: ' . ((int) $minimumInputLength) . ',  | 
                                                        |
| 8670 | + minimumInputLength: ' . ((int) $minimumInputLength).',  | 
                                                        |
| 8671 | 8671 |  				        formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8672 | 8672 | return escapeMarkup(result.text);  | 
                                                        
| 8673 | 8673 | },  | 
                                                        
@@ -8675,10 +8675,10 @@ discard block  | 
                                                    ||
| 8675 | 8675 | |
| 8676 | 8676 | ' . ($callurlonselect ? '  | 
                                                        
| 8677 | 8677 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8678 | -	                $(".' . $htmlname . '").change(function() { | 
                                                        |
| 8679 | -				    	var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8678 | +	                $(".' . $htmlname.'").change(function() { | 
                                                        |
| 8679 | +				    	var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8680 | 8680 |  	                	console.log("We select in selectArrayAjax the entry "+selected) | 
                                                        
| 8681 | -				        $(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8681 | +				        $(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8682 | 8682 |  	    			    $.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8683 | 8683 | if (key == selected)  | 
                                                        
| 8684 | 8684 |  	    			            { | 
                                                        
@@ -8686,7 +8686,7 @@ discard block  | 
                                                    ||
| 8686 | 8686 | location.assign(value.url);  | 
                                                        
| 8687 | 8687 | }  | 
                                                        
| 8688 | 8688 | });  | 
                                                        
| 8689 | - });' : '') . '  | 
                                                        |
| 8689 | + });' : '').'  | 
                                                        |
| 8690 | 8690 | |
| 8691 | 8691 | });  | 
                                                        
| 8692 | 8692 | </script>';  | 
                                                        
@@ -8722,14 +8722,14 @@ discard block  | 
                                                    ||
| 8722 | 8722 | public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')  | 
                                                        
| 8723 | 8723 |  	{ | 
                                                        
| 8724 | 8724 | global $conf, $langs;  | 
                                                        
| 8725 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8725 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8726 | 8726 | |
| 8727 | 8727 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8728 | 8728 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8729 | 8729 | return '';  | 
                                                        
| 8730 | 8730 | }  | 
                                                        
| 8731 | 8731 | |
| 8732 | - $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8732 | + $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8733 | 8733 | |
| 8734 | 8734 | $formattedarrayresult = array();  | 
                                                        
| 8735 | 8735 | |
@@ -8744,20 +8744,20 @@ discard block  | 
                                                    ||
| 8744 | 8744 | $outdelayed = '';  | 
                                                        
| 8745 | 8745 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8746 | 8746 | $tmpplugin = 'select2';  | 
                                                        
| 8747 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8748 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8747 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8748 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8749 | 8749 |  				$(document).ready(function () { | 
                                                        
| 8750 | - var data = ' . json_encode($formattedarrayresult) . ';  | 
                                                        |
| 8750 | + var data = ' . json_encode($formattedarrayresult).';  | 
                                                        |
| 8751 | 8751 | |
| 8752 | - ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '  | 
                                                        |
| 8752 | + ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'  | 
                                                        |
| 8753 | 8753 | |
| 8754 | -					$(".' . $htmlname . '").select2({ | 
                                                        |
| 8754 | +					$(".' . $htmlname.'").select2({ | 
                                                        |
| 8755 | 8755 | data: data,  | 
                                                        
| 8756 | 8756 | language: select2arrayoflanguage,  | 
                                                        
| 8757 | 8757 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8758 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8758 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8759 | 8759 |  						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8760 | - minimumInputLength: ' . $minimumInputLength . ',  | 
                                                        |
| 8760 | + minimumInputLength: ' . $minimumInputLength.',  | 
                                                        |
| 8761 | 8761 |  						formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8762 | 8762 | return escapeMarkup(result.text);  | 
                                                        
| 8763 | 8763 | },  | 
                                                        
@@ -8796,11 +8796,11 @@ discard block  | 
                                                    ||
| 8796 | 8796 | |
| 8797 | 8797 | ' . ($callurlonselect ? '  | 
                                                        
| 8798 | 8798 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8799 | -					$(".' . $htmlname . '").change(function() { | 
                                                        |
| 8800 | -						var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8799 | +					$(".' . $htmlname.'").change(function() { | 
                                                        |
| 8800 | +						var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8801 | 8801 |  						console.log("We select "+selected) | 
                                                        
| 8802 | 8802 | |
| 8803 | -						$(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8803 | +						$(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8804 | 8804 |  						$.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8805 | 8805 | if (key == selected)  | 
                                                        
| 8806 | 8806 |  							{ | 
                                                        
@@ -8808,7 +8808,7 @@ discard block  | 
                                                    ||
| 8808 | 8808 | location.assign(value.url);  | 
                                                        
| 8809 | 8809 | }  | 
                                                        
| 8810 | 8810 | });  | 
                                                        
| 8811 | - });' : '') . '  | 
                                                        |
| 8811 | + });' : '').'  | 
                                                        |
| 8812 | 8812 | |
| 8813 | 8813 | });  | 
                                                        
| 8814 | 8814 | </script>';  | 
                                                        
@@ -8857,7 +8857,7 @@ discard block  | 
                                                    ||
| 8857 | 8857 | $useenhancedmultiselect = 0;  | 
                                                        
| 8858 | 8858 |  		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { | 
                                                        
| 8859 | 8859 |  			if ($addjscombo) { | 
                                                        
| 8860 | - $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 8860 | + $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 8861 | 8861 | }  | 
                                                        
| 8862 | 8862 | }  | 
                                                        
| 8863 | 8863 | |
@@ -8866,7 +8866,7 @@ discard block  | 
                                                    ||
| 8866 | 8866 | // submitted to nothing.  | 
                                                        
| 8867 | 8867 | $out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';  | 
                                                        
| 8868 | 8868 | // Output select component  | 
                                                        
| 8869 | -		$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"; | 
                                                        |
| 8869 | +		$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"; | 
                                                        |
| 8870 | 8870 |  		if (is_array($array) && !empty($array)) { | 
                                                        
| 8871 | 8871 |  			if ($value_as_key) { | 
                                                        
| 8872 | 8872 | $array = array_combine($array, $array);  | 
                                                        
@@ -8887,33 +8887,33 @@ discard block  | 
                                                    ||
| 8887 | 8887 | $tmplabelhtml = empty($value['labelhtml']) ? '' : $value['labelhtml'];  | 
                                                        
| 8888 | 8888 | }  | 
                                                        
| 8889 | 8889 | $newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);  | 
                                                        
| 8890 | - $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);  | 
                                                        |
| 8890 | + $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);  | 
                                                        |
| 8891 | 8891 | |
| 8892 | - $out .= '<option value="' . $tmpkey . '"';  | 
                                                        |
| 8892 | + $out .= '<option value="'.$tmpkey.'"';  | 
                                                        |
| 8893 | 8893 |  					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { | 
                                                        
| 8894 | 8894 | $out .= ' selected';  | 
                                                        
| 8895 | 8895 | }  | 
                                                        
| 8896 | 8896 |  					if (!empty($tmplabelhtml)) { | 
                                                        
| 8897 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 8897 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 8898 | 8898 |  					} else { | 
                                                        
| 8899 | -						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; | 
                                                        |
| 8900 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 8899 | +						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; | 
                                                        |
| 8900 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 8901 | 8901 | }  | 
                                                        
| 8902 | 8902 | $out .= '>';  | 
                                                        
| 8903 | 8903 | $out .= dol_htmlentitiesbr($newval);  | 
                                                        
| 8904 | - $out .= '</option>' . "\n";  | 
                                                        |
| 8904 | + $out .= '</option>'."\n";  | 
                                                        |
| 8905 | 8905 | }  | 
                                                        
| 8906 | 8906 | }  | 
                                                        
| 8907 | 8907 | }  | 
                                                        
| 8908 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8908 | + $out .= '</select>'."\n";  | 
                                                        |
| 8909 | 8909 | |
| 8910 | 8910 | // Add code for jquery to use multiselect  | 
                                                        
| 8911 | 8911 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8912 | - $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';  | 
                                                        |
| 8913 | - $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";  | 
                                                        |
| 8912 | + $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';  | 
                                                        |
| 8913 | + $out .= "\n".'<script nonce="'.getNonce().'">'."\n";  | 
                                                        |
| 8914 | 8914 |  			if ($addjscombo == 1) { | 
                                                        
| 8915 | 8915 |  				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; | 
                                                        
| 8916 | -				$out .= 'function formatResult(record, container) {' . "\n"; | 
                                                        |
| 8916 | +				$out .= 'function formatResult(record, container) {'."\n"; | 
                                                        |
| 8917 | 8917 | // If property data-html set, we decode html entities and use this.  | 
                                                        
| 8918 | 8918 | // Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.  | 
                                                        
| 8919 | 8919 |  				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; | 
                                                        
@@ -8921,26 +8921,26 @@ discard block  | 
                                                    ||
| 8921 | 8921 |  				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));'; | 
                                                        
| 8922 | 8922 | $out .= ' }'."\n";  | 
                                                        
| 8923 | 8923 | $out .= ' return record.text;';  | 
                                                        
| 8924 | - $out .= '}' . "\n";  | 
                                                        |
| 8925 | -				$out .= 'function formatSelection(record) {' . "\n"; | 
                                                        |
| 8924 | + $out .= '}'."\n";  | 
                                                        |
| 8925 | +				$out .= 'function formatSelection(record) {'."\n"; | 
                                                        |
| 8926 | 8926 |  				if ($elemtype == 'category') { | 
                                                        
| 8927 | - $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 8927 | + $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 8928 | 8928 |  				} else { | 
                                                        
| 8929 | 8929 | $out .= 'return record.text;';  | 
                                                        
| 8930 | 8930 | }  | 
                                                        
| 8931 | - $out .= '}' . "\n";  | 
                                                        |
| 8931 | + $out .= '}'."\n";  | 
                                                        |
| 8932 | 8932 |  				$out .= '$(document).ready(function () { | 
                                                        
| 8933 | -							$(\'#' . $htmlname . '\').' . $tmpplugin . '({'; | 
                                                        |
| 8933 | +							$(\'#' . $htmlname.'\').'.$tmpplugin.'({'; | 
                                                        |
| 8934 | 8934 |  				if ($placeholder) { | 
                                                        
| 8935 | 8935 | $out .= '  | 
                                                        
| 8936 | 8936 |  								placeholder: { | 
                                                        
| 8937 | 8937 | id: \'-1\',  | 
                                                        
| 8938 | - text: \'' . dol_escape_js($placeholder) . '\'  | 
                                                        |
| 8938 | + text: \'' . dol_escape_js($placeholder).'\'  | 
                                                        |
| 8939 | 8939 | },';  | 
                                                        
| 8940 | 8940 | }  | 
                                                        
| 8941 | 8941 | $out .= ' dir: \'ltr\',  | 
                                                        
| 8942 | 8942 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */  | 
                                                        
| 8943 | - dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        |
| 8943 | + dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        |
| 8944 | 8944 | // Specify format function for dropdown item  | 
                                                        
| 8945 | 8945 | formatResult: formatResult,  | 
                                                        
| 8946 | 8946 | templateResult: formatResult, /* For 4.0 */  | 
                                                        
@@ -8952,21 +8952,21 @@ discard block  | 
                                                    ||
| 8952 | 8952 | |
| 8953 | 8953 | /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set  | 
                                                        
| 8954 | 8954 | the size only if component is not hidden by default on load */  | 
                                                        
| 8955 | - $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');  | 
                                                        |
| 8955 | + $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');  | 
                                                        |
| 8956 | 8956 | });' . "\n";  | 
                                                        
| 8957 | 8957 |  			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { | 
                                                        
| 8958 | 8958 | // Add other js lib  | 
                                                        
| 8959 | 8959 | // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin  | 
                                                        
| 8960 | 8960 | // ...  | 
                                                        
| 8961 | - $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';  | 
                                                        |
| 8961 | + $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';  | 
                                                        |
| 8962 | 8962 |  				$out .= '$(document).ready(function () { | 
                                                        
| 8963 | -							$(\'#' . $htmlname . '\').multiSelect({ | 
                                                        |
| 8963 | +							$(\'#' . $htmlname.'\').multiSelect({ | 
                                                        |
| 8964 | 8964 | containerHTML: \'<div class="multi-select-container">\',  | 
                                                        
| 8965 | 8965 | menuHTML: \'<div class="multi-select-menu">\',  | 
                                                        
| 8966 | - buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',  | 
                                                        |
| 8966 | + buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',  | 
                                                        |
| 8967 | 8967 | menuItemHTML: \'<label class="multi-select-menuitem">\',  | 
                                                        
| 8968 | 8968 | activeClass: \'multi-select-container--open\',  | 
                                                        
| 8969 | - noneText: \'' . $placeholder . '\'  | 
                                                        |
| 8969 | + noneText: \'' . $placeholder.'\'  | 
                                                        |
| 8970 | 8970 | });  | 
                                                        
| 8971 | 8971 | })';  | 
                                                        
| 8972 | 8972 | }  | 
                                                        
@@ -8998,7 +8998,7 @@ discard block  | 
                                                    ||
| 8998 | 8998 | return '';  | 
                                                        
| 8999 | 8999 | }  | 
                                                        
| 9000 | 9000 | |
| 9001 | - $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show  | 
                                                        |
| 9001 | + $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show  | 
                                                        |
| 9002 | 9002 | |
| 9003 | 9003 |  		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user | 
                                                        
| 9004 | 9004 |  			$tmparray = explode(',', $user->conf->$tmpvar); | 
                                                        
@@ -9041,19 +9041,19 @@ discard block  | 
                                                    ||
| 9041 | 9041 | }  | 
                                                        
| 9042 | 9042 | |
| 9043 | 9043 | // Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset  | 
                                                        
| 9044 | -				$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>'; | 
                                                        |
| 9045 | - $listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');  | 
                                                        |
| 9044 | +				$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>'; | 
                                                        |
| 9045 | + $listcheckedstring .= (empty($val['checked']) ? '' : $key.',');  | 
                                                        |
| 9046 | 9046 | }  | 
                                                        
| 9047 | 9047 | }  | 
                                                        
| 9048 | 9048 | |
| 9049 | - $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->  | 
                                                        |
| 9049 | + $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->  | 
                                                        |
| 9050 | 9050 | |
| 9051 | 9051 | <dl class="dropdown">  | 
                                                        
| 9052 | 9052 | <dt>  | 
                                                        
| 9053 | - <a href="#' . $htmlname . '">  | 
                                                        |
| 9054 | -              ' . img_picto('', 'list') . ' | 
                                                        |
| 9053 | + <a href="#' . $htmlname.'">  | 
                                                        |
| 9054 | +              ' . img_picto('', 'list').' | 
                                                        |
| 9055 | 9055 | </a>  | 
                                                        
| 9056 | - <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">  | 
                                                        |
| 9056 | + <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">  | 
                                                        |
| 9057 | 9057 | </dt>  | 
                                                        
| 9058 | 9058 | <dd class="dropdowndd">  | 
                                                        
| 9059 | 9059 | <div class="multiselectcheckbox'.$htmlname.'">  | 
                                                        
@@ -9065,19 +9065,19 @@ discard block  | 
                                                    ||
| 9065 | 9065 | </dd>  | 
                                                        
| 9066 | 9066 | </dl>  | 
                                                        
| 9067 | 9067 | |
| 9068 | - <script nonce="' . getNonce() . '" type="text/javascript">  | 
                                                        |
| 9068 | + <script nonce="' . getNonce().'" type="text/javascript">  | 
                                                        |
| 9069 | 9069 |            jQuery(document).ready(function () { | 
                                                        
| 9070 | -              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9070 | +              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9071 | 9071 |                    console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); | 
                                                        
| 9072 | 9072 | |
| 9073 | 9073 |                    $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST | 
                                                        
| 9074 | 9074 | |
| 9075 | 9075 | var title = $(this).val() + ",";  | 
                                                        
| 9076 | 9076 |                    if ($(this).is(\':checked\')) { | 
                                                        
| 9077 | - $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());  | 
                                                        |
| 9077 | + $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());  | 
                                                        |
| 9078 | 9078 | }  | 
                                                        
| 9079 | 9079 |                    else { | 
                                                        
| 9080 | - $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )  | 
                                                        |
| 9080 | + $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )  | 
                                                        |
| 9081 | 9081 | }  | 
                                                        
| 9082 | 9082 | // Now, we submit page  | 
                                                        
| 9083 | 9083 | //$(this).parents(\'form:first\').submit();  | 
                                                        
@@ -9108,7 +9108,7 @@ discard block  | 
                                                    ||
| 9108 | 9108 | */  | 
                                                        
| 9109 | 9109 | public function showCategories($id, $type, $rendermode = 0, $nolink = 0)  | 
                                                        
| 9110 | 9110 |  	{ | 
                                                        
| 9111 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 9111 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 9112 | 9112 | |
| 9113 | 9113 | $cat = new Categorie($this->db);  | 
                                                        
| 9114 | 9114 | $categories = $cat->containing($id, $type);  | 
                                                        
@@ -9118,10 +9118,10 @@ discard block  | 
                                                    ||
| 9118 | 9118 |  			foreach ($categories as $c) { | 
                                                        
| 9119 | 9119 |  				$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                        
| 9120 | 9120 |  				foreach ($ways as $way) { | 
                                                        
| 9121 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';  | 
                                                        |
| 9121 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';  | 
                                                        |
| 9122 | 9122 | }  | 
                                                        
| 9123 | 9123 | }  | 
                                                        
| 9124 | -			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 9124 | +			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 9125 | 9125 | }  | 
                                                        
| 9126 | 9126 | |
| 9127 | 9127 |  		if ($rendermode == 0) { | 
                                                        
@@ -9169,15 +9169,15 @@ discard block  | 
                                                    ||
| 9169 | 9169 | |
| 9170 | 9170 | |
| 9171 | 9171 | print '<div class="div-table-responsive-no-min">';  | 
                                                        
| 9172 | - print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >';  | 
                                                        |
| 9172 | + print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';  | 
                                                        |
| 9173 | 9173 | |
| 9174 | 9174 | print '<tr class="liste_titre">';  | 
                                                        
| 9175 | -			print '<td>' . $langs->trans("Type") . '</td>'; | 
                                                        |
| 9176 | -			print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9175 | +			print '<td>'.$langs->trans("Type").'</td>'; | 
                                                        |
| 9176 | +			print '<td>'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9177 | 9177 | print '<td class="center"></td>';  | 
                                                        
| 9178 | -			print '<td class="center">' . $langs->trans("Date") . '</td>'; | 
                                                        |
| 9179 | -			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9180 | -			print '<td class="right">' . $langs->trans("Status") . '</td>'; | 
                                                        |
| 9178 | +			print '<td class="center">'.$langs->trans("Date").'</td>'; | 
                                                        |
| 9179 | +			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9180 | +			print '<td class="right">'.$langs->trans("Status").'</td>'; | 
                                                        |
| 9181 | 9181 | print '<td></td>';  | 
                                                        
| 9182 | 9182 | print '</tr>';  | 
                                                        
| 9183 | 9183 | |
@@ -9196,13 +9196,13 @@ discard block  | 
                                                    ||
| 9196 | 9196 |  				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { | 
                                                        
| 9197 | 9197 | $element = $regs[1];  | 
                                                        
| 9198 | 9198 | $subelement = $regs[2];  | 
                                                        
| 9199 | - $tplpath = $element . '/' . $subelement;  | 
                                                        |
| 9199 | + $tplpath = $element.'/'.$subelement;  | 
                                                        |
| 9200 | 9200 | }  | 
                                                        
| 9201 | 9201 | $tplname = 'linkedobjectblock';  | 
                                                        
| 9202 | 9202 | |
| 9203 | 9203 | // To work with non standard path  | 
                                                        
| 9204 | 9204 |  				if ($objecttype == 'facture') { | 
                                                        
| 9205 | - $tplpath = 'compta/' . $element;  | 
                                                        |
| 9205 | + $tplpath = 'compta/'.$element;  | 
                                                        |
| 9206 | 9206 |  					if (!isModEnabled('invoice')) { | 
                                                        
| 9207 | 9207 | continue; // Do not show if module disabled  | 
                                                        
| 9208 | 9208 | }  | 
                                                        
@@ -9213,7 +9213,7 @@ discard block  | 
                                                    ||
| 9213 | 9213 | continue; // Do not show if module disabled  | 
                                                        
| 9214 | 9214 | }  | 
                                                        
| 9215 | 9215 |  				} elseif ($objecttype == 'propal') { | 
                                                        
| 9216 | - $tplpath = 'comm/' . $element;  | 
                                                        |
| 9216 | + $tplpath = 'comm/'.$element;  | 
                                                        |
| 9217 | 9217 |  					if (!isModEnabled('propal')) { | 
                                                        
| 9218 | 9218 | continue; // Do not show if module disabled  | 
                                                        
| 9219 | 9219 | }  | 
                                                        
@@ -9264,7 +9264,7 @@ discard block  | 
                                                    ||
| 9264 | 9264 | $linkedObjectBlock = $objects;  | 
                                                        
| 9265 | 9265 | |
| 9266 | 9266 | // Output template part (modules that overwrite templates must declare this into descriptor)  | 
                                                        
| 9267 | -				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); | 
                                                        |
| 9267 | +				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); | 
                                                        |
| 9268 | 9268 |  				foreach ($dirtpls as $reldir) { | 
                                                        
| 9269 | 9269 | $reldir = rtrim($reldir, '/');  | 
                                                        
| 9270 | 9270 |  					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after | 
                                                        
@@ -9272,7 +9272,7 @@ discard block  | 
                                                    ||
| 9272 | 9272 | $noMoreLinkedObjectBlockAfter = 1;  | 
                                                        
| 9273 | 9273 | }  | 
                                                        
| 9274 | 9274 | |
| 9275 | - $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');  | 
                                                        |
| 9275 | + $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');  | 
                                                        |
| 9276 | 9276 |  					if ($res) { | 
                                                        
| 9277 | 9277 | $nboftypesoutput++;  | 
                                                        
| 9278 | 9278 | break;  | 
                                                        
@@ -9281,7 +9281,7 @@ discard block  | 
                                                    ||
| 9281 | 9281 | }  | 
                                                        
| 9282 | 9282 | |
| 9283 | 9283 |  			if (!$nboftypesoutput) { | 
                                                        
| 9284 | -				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; | 
                                                        |
| 9284 | +				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; | 
                                                        |
| 9285 | 9285 | }  | 
                                                        
| 9286 | 9286 | |
| 9287 | 9287 | print '</table>';  | 
                                                        
@@ -9321,14 +9321,14 @@ discard block  | 
                                                    ||
| 9321 | 9321 |  		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
| 9322 | 9322 | $listofidcompanytoscan = $object->thirdparty->id;  | 
                                                        
| 9323 | 9323 |  			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { | 
                                                        
| 9324 | - $listofidcompanytoscan .= ',' . $object->thirdparty->parent;  | 
                                                        |
| 9324 | + $listofidcompanytoscan .= ','.$object->thirdparty->parent;  | 
                                                        |
| 9325 | 9325 | }  | 
                                                        
| 9326 | 9326 |  			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { | 
                                                        
| 9327 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 9327 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 9328 | 9328 | $tmpproject = new Project($this->db);  | 
                                                        
| 9329 | 9329 | $tmpproject->fetch($object->fk_project);  | 
                                                        
| 9330 | 9330 |  				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { | 
                                                        
| 9331 | - $listofidcompanytoscan .= ',' . $tmpproject->socid;  | 
                                                        |
| 9331 | + $listofidcompanytoscan .= ','.$tmpproject->socid;  | 
                                                        |
| 9332 | 9332 | }  | 
                                                        
| 9333 | 9333 | unset($tmpproject);  | 
                                                        
| 9334 | 9334 | }  | 
                                                        
@@ -9338,63 +9338,63 @@ discard block  | 
                                                    ||
| 9338 | 9338 |  					'enabled' => isModEnabled('propal'), | 
                                                        
| 9339 | 9339 | 'perms' => 1,  | 
                                                        
| 9340 | 9340 | 'label' => 'LinkToProposal',  | 
                                                        
| 9341 | -					'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') . ')'), | 
                                                        |
| 9341 | +					'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').')'), | 
                                                        |
| 9342 | 9342 | 'shipping' => array(  | 
                                                        
| 9343 | 9343 |  					'enabled' => isModEnabled('shipping'), | 
                                                        
| 9344 | 9344 | 'perms' => 1,  | 
                                                        
| 9345 | 9345 | 'label' => 'LinkToExpedition',  | 
                                                        
| 9346 | -					'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') . ')'), | 
                                                        |
| 9346 | +					'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').')'), | 
                                                        |
| 9347 | 9347 | 'order' => array(  | 
                                                        
| 9348 | 9348 |  					'enabled' => isModEnabled('order'), | 
                                                        
| 9349 | 9349 | 'perms' => 1,  | 
                                                        
| 9350 | 9350 | 'label' => 'LinkToOrder',  | 
                                                        
| 9351 | -					'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') . ')'), | 
                                                        |
| 9351 | +					'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').')'), | 
                                                        |
| 9352 | 9352 | 'invoice' => array(  | 
                                                        
| 9353 | 9353 |  					'enabled' => isModEnabled('invoice'), | 
                                                        
| 9354 | 9354 | 'perms' => 1,  | 
                                                        
| 9355 | 9355 | 'label' => 'LinkToInvoice',  | 
                                                        
| 9356 | -					'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') . ')'), | 
                                                        |
| 9356 | +					'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').')'), | 
                                                        |
| 9357 | 9357 | 'invoice_template' => array(  | 
                                                        
| 9358 | 9358 |  					'enabled' => isModEnabled('invoice'), | 
                                                        
| 9359 | 9359 | 'perms' => 1,  | 
                                                        
| 9360 | 9360 | 'label' => 'LinkToTemplateInvoice',  | 
                                                        
| 9361 | -					'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') . ')'), | 
                                                        |
| 9361 | +					'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').')'), | 
                                                        |
| 9362 | 9362 | 'contrat' => array(  | 
                                                        
| 9363 | 9363 |  					'enabled' => isModEnabled('contract'), | 
                                                        
| 9364 | 9364 | 'perms' => 1,  | 
                                                        
| 9365 | 9365 | 'label' => 'LinkToContract',  | 
                                                        
| 9366 | 9366 | '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  | 
                                                        
| 9367 | -							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' | 
                                                        |
| 9367 | +							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' | 
                                                        |
| 9368 | 9368 | ),  | 
                                                        
| 9369 | 9369 | 'fichinter' => array(  | 
                                                        
| 9370 | 9370 |  					'enabled' => isModEnabled('intervention'), | 
                                                        
| 9371 | 9371 | 'perms' => 1,  | 
                                                        
| 9372 | 9372 | 'label' => 'LinkToIntervention',  | 
                                                        
| 9373 | -					'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') . ')'), | 
                                                        |
| 9373 | +					'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').')'), | 
                                                        |
| 9374 | 9374 | 'supplier_proposal' => array(  | 
                                                        
| 9375 | 9375 |  					'enabled' => isModEnabled('supplier_proposal'), | 
                                                        
| 9376 | 9376 | 'perms' => 1,  | 
                                                        
| 9377 | 9377 | 'label' => 'LinkToSupplierProposal',  | 
                                                        
| 9378 | -					'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') . ')'), | 
                                                        |
| 9378 | +					'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').')'), | 
                                                        |
| 9379 | 9379 | 'order_supplier' => array(  | 
                                                        
| 9380 | 9380 |  					'enabled' => isModEnabled("supplier_order"), | 
                                                        
| 9381 | 9381 | 'perms' => 1,  | 
                                                        
| 9382 | 9382 | 'label' => 'LinkToSupplierOrder',  | 
                                                        
| 9383 | -					'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') . ')'), | 
                                                        |
| 9383 | +					'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').')'), | 
                                                        |
| 9384 | 9384 | 'invoice_supplier' => array(  | 
                                                        
| 9385 | 9385 |  					'enabled' => isModEnabled("supplier_invoice"), | 
                                                        
| 9386 | 9386 | 'perms' => 1, 'label' => 'LinkToSupplierInvoice',  | 
                                                        
| 9387 | -					'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') . ')'), | 
                                                        |
| 9387 | +					'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').')'), | 
                                                        |
| 9388 | 9388 | 'ticket' => array(  | 
                                                        
| 9389 | 9389 |  					'enabled' => isModEnabled('ticket'), | 
                                                        
| 9390 | 9390 | 'perms' => 1,  | 
                                                        
| 9391 | 9391 | 'label' => 'LinkToTicket',  | 
                                                        
| 9392 | -					'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') . ')'), | 
                                                        |
| 9392 | +					'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').')'), | 
                                                        |
| 9393 | 9393 | 'mo' => array(  | 
                                                        
| 9394 | 9394 |  					'enabled' => isModEnabled('mrp'), | 
                                                        
| 9395 | 9395 | 'perms' => 1,  | 
                                                        
| 9396 | 9396 | 'label' => 'LinkToMo',  | 
                                                        
| 9397 | -					'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') . ')') | 
                                                        |
| 9397 | +					'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').')') | 
                                                        |
| 9398 | 9398 | );  | 
                                                        
| 9399 | 9399 | }  | 
                                                        
| 9400 | 9400 | |
@@ -9430,22 +9430,22 @@ discard block  | 
                                                    ||
| 9430 | 9430 | }  | 
                                                        
| 9431 | 9431 | |
| 9432 | 9432 |  			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { | 
                                                        
| 9433 | - print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';  | 
                                                        |
| 9433 | + print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';  | 
                                                        |
| 9434 | 9434 | |
| 9435 | 9435 |  				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9436 | 9436 | print '<br>'."\n";  | 
                                                        
| 9437 | 9437 | print '<!-- form to add a link from anywhere -->'."\n";  | 
                                                        
| 9438 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';  | 
                                                        |
| 9439 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9438 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';  | 
                                                        |
| 9439 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9440 | 9440 | print '<input type="hidden" name="action" value="addlinkbyref">';  | 
                                                        
| 9441 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9442 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9441 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9442 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9443 | 9443 | print '<table class="noborder">';  | 
                                                        
| 9444 | 9444 | print '<tr>';  | 
                                                        
| 9445 | 9445 |  					//print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        
| 9446 | -					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; | 
                                                        |
| 9447 | -					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; | 
                                                        |
| 9448 | -					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; | 
                                                        |
| 9446 | +					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; | 
                                                        |
| 9447 | +					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; | 
                                                        |
| 9448 | +					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; | 
                                                        |
| 9449 | 9449 | print '</tr>';  | 
                                                        
| 9450 | 9450 | print '</table>';  | 
                                                        
| 9451 | 9451 | print '</form>';  | 
                                                        
@@ -9460,48 +9460,48 @@ discard block  | 
                                                    ||
| 9460 | 9460 | |
| 9461 | 9461 | print '<br>';  | 
                                                        
| 9462 | 9462 | print '<!-- form to add a link from object to same thirdparty -->'."\n";  | 
                                                        
| 9463 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';  | 
                                                        |
| 9463 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';  | 
                                                        |
| 9464 | 9464 | print '<input type="hidden" name="action" value="addlink">';  | 
                                                        
| 9465 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9466 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9467 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9465 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9466 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9467 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9468 | 9468 | print '<table class="noborder">';  | 
                                                        
| 9469 | 9469 | print '<tr class="liste_titre">';  | 
                                                        
| 9470 | 9470 | print '<td class="nowrap"></td>';  | 
                                                        
| 9471 | -					print '<td class="center">' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9472 | -					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; | 
                                                        |
| 9473 | -					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9474 | -					print '<td class="left">' . $langs->trans("Company") . '</td>'; | 
                                                        |
| 9471 | +					print '<td class="center">'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9472 | +					print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; | 
                                                        |
| 9473 | +					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9474 | +					print '<td class="left">'.$langs->trans("Company").'</td>'; | 
                                                        |
| 9475 | 9475 | print '</tr>';  | 
                                                        
| 9476 | 9476 |  					while ($i < $num) { | 
                                                        
| 9477 | 9477 | $objp = $this->db->fetch_object($resqllist);  | 
                                                        
| 9478 | 9478 | |
| 9479 | 9479 | print '<tr class="oddeven">';  | 
                                                        
| 9480 | 9480 | print '<td class="left">';  | 
                                                        
| 9481 | - print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';  | 
                                                        |
| 9481 | + print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';  | 
                                                        |
| 9482 | 9482 | print '</td>';  | 
                                                        
| 9483 | - print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';  | 
                                                        |
| 9484 | - print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';  | 
                                                        |
| 9483 | + print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';  | 
                                                        |
| 9484 | + print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';  | 
                                                        |
| 9485 | 9485 | print '<td class="right">';  | 
                                                        
| 9486 | 9486 |  						if ($possiblelink['label'] == 'LinkToContract') { | 
                                                        
| 9487 | 9487 | $form = new Form($this->db);  | 
                                                        
| 9488 | -							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; | 
                                                        |
| 9488 | +							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; | 
                                                        |
| 9489 | 9489 | }  | 
                                                        
| 9490 | - print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';  | 
                                                        |
| 9490 | + print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';  | 
                                                        |
| 9491 | 9491 | print '</td>';  | 
                                                        
| 9492 | - print '<td>' . $objp->name . '</td>';  | 
                                                        |
| 9492 | + print '<td>'.$objp->name.'</td>';  | 
                                                        |
| 9493 | 9493 | print '</tr>';  | 
                                                        
| 9494 | 9494 | $i++;  | 
                                                        
| 9495 | 9495 | }  | 
                                                        
| 9496 | 9496 | print '</table>';  | 
                                                        
| 9497 | 9497 | print '<div class="center">';  | 
                                                        
| 9498 | 9498 |  					if ($num) { | 
                                                        
| 9499 | -						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; | 
                                                        |
| 9499 | +						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; | 
                                                        |
| 9500 | 9500 | }  | 
                                                        
| 9501 | 9501 |  					if (empty($conf->use_javascript_ajax)) { | 
                                                        
| 9502 | -						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                        |
| 9502 | +						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                        |
| 9503 | 9503 |  					} else { | 
                                                        
| 9504 | -						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>'; | 
                                                        |
| 9504 | +						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>'; | 
                                                        |
| 9505 | 9505 | }  | 
                                                        
| 9506 | 9506 | print '</form>';  | 
                                                        
| 9507 | 9507 | $this->db->free($resqllist);  | 
                                                        
@@ -9512,10 +9512,10 @@ discard block  | 
                                                    ||
| 9512 | 9512 | |
| 9513 | 9513 | //$linktoelem.=($linktoelem?'   ':'');  | 
                                                        
| 9514 | 9514 |  				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9515 | -					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; | 
                                                        |
| 9515 | +					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; | 
                                                        |
| 9516 | 9516 | // } else $linktoelem.=$langs->trans($possiblelink['label']);  | 
                                                        
| 9517 | 9517 |  				} else { | 
                                                        
| 9518 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';  | 
                                                        |
| 9518 | + $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';  | 
                                                        |
| 9519 | 9519 | }  | 
                                                        
| 9520 | 9520 | }  | 
                                                        
| 9521 | 9521 | }  | 
                                                        
@@ -9525,22 +9525,22 @@ discard block  | 
                                                    ||
| 9525 | 9525 | <dl class="dropdown" id="linktoobjectname">  | 
                                                        
| 9526 | 9526 | ';  | 
                                                        
| 9527 | 9527 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9528 | -				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; | 
                                                        |
| 9528 | +				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; | 
                                                        |
| 9529 | 9529 | }  | 
                                                        
| 9530 | 9530 | $linktoelem .= '<dd>  | 
                                                        
| 9531 | 9531 | <div class="multiselectlinkto">  | 
                                                        
| 9532 | - <ul class="ulselectedfields">' . $linktoelemlist . '  | 
                                                        |
| 9532 | + <ul class="ulselectedfields">' . $linktoelemlist.'  | 
                                                        |
| 9533 | 9533 | </ul>  | 
                                                        
| 9534 | 9534 | </div>  | 
                                                        
| 9535 | 9535 | </dd>  | 
                                                        
| 9536 | 9536 | </dl>';  | 
                                                        
| 9537 | 9537 |  		} else { | 
                                                        
| 9538 | - $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 9538 | + $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 9539 | 9539 | }  | 
                                                        
| 9540 | 9540 | |
| 9541 | 9541 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9542 | 9542 | print '<!-- Add js to show linkto box -->  | 
                                                        
| 9543 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 9543 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 9544 | 9544 |  				jQuery(document).ready(function() { | 
                                                        
| 9545 | 9545 |  					jQuery(".linkto").click(function() { | 
                                                        
| 9546 | 9546 |  						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); | 
                                                        
@@ -9581,19 +9581,19 @@ discard block  | 
                                                    ||
| 9581 | 9581 | |
| 9582 | 9582 | $disabled = ($disabled ? ' disabled' : '');  | 
                                                        
| 9583 | 9583 | |
| 9584 | - $resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";  | 
                                                        |
| 9584 | + $resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";  | 
                                                        |
| 9585 | 9585 |  		if ($useempty) { | 
                                                        
| 9586 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 9586 | + $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 9587 | 9587 | }  | 
                                                        
| 9588 | 9588 |  		if (("$value" == 'yes') || ($value == 1)) { | 
                                                        
| 9589 | - $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9590 | - $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9589 | + $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9590 | + $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9591 | 9591 |  		} else { | 
                                                        
| 9592 | 9592 | $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');  | 
                                                        
| 9593 | - $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9594 | - $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9593 | + $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9594 | + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9595 | 9595 | }  | 
                                                        
| 9596 | - $resultyesno .= '</select>' . "\n";  | 
                                                        |
| 9596 | + $resultyesno .= '</select>'."\n";  | 
                                                        |
| 9597 | 9597 | |
| 9598 | 9598 |  		if ($addjscombo) { | 
                                                        
| 9599 | 9599 | $resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);  | 
                                                        
@@ -9617,12 +9617,12 @@ discard block  | 
                                                    ||
| 9617 | 9617 |  	{ | 
                                                        
| 9618 | 9618 | // phpcs:enable  | 
                                                        
| 9619 | 9619 | $sql = "SELECT rowid, label";  | 
                                                        
| 9620 | - $sql .= " FROM " . $this->db->prefix() . "export_model";  | 
                                                        |
| 9621 | - $sql .= " WHERE type = '" . $this->db->escape($type) . "'";  | 
                                                        |
| 9620 | + $sql .= " FROM ".$this->db->prefix()."export_model";  | 
                                                        |
| 9621 | + $sql .= " WHERE type = '".$this->db->escape($type)."'";  | 
                                                        |
| 9622 | 9622 | $sql .= " ORDER BY rowid";  | 
                                                        
| 9623 | 9623 | $result = $this->db->query($sql);  | 
                                                        
| 9624 | 9624 |  		if ($result) { | 
                                                        
| 9625 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 9625 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 9626 | 9626 |  			if ($useempty) { | 
                                                        
| 9627 | 9627 | print '<option value="-1"> </option>';  | 
                                                        
| 9628 | 9628 | }  | 
                                                        
@@ -9632,9 +9632,9 @@ discard block  | 
                                                    ||
| 9632 | 9632 |  			while ($i < $num) { | 
                                                        
| 9633 | 9633 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 9634 | 9634 |  				if ($selected == $obj->rowid) { | 
                                                        
| 9635 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 9635 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 9636 | 9636 |  				} else { | 
                                                        
| 9637 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 9637 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 9638 | 9638 | }  | 
                                                        
| 9639 | 9639 | print $obj->label;  | 
                                                        
| 9640 | 9640 | print '</option>';  | 
                                                        
@@ -9725,8 +9725,8 @@ discard block  | 
                                                    ||
| 9725 | 9725 | $stringforfirstkey .= ' CTL +';  | 
                                                        
| 9726 | 9726 | }  | 
                                                        
| 9727 | 9727 | |
| 9728 | -			$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>'; | 
                                                        |
| 9729 | -			$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>'; | 
                                                        |
| 9728 | +			$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>'; | 
                                                        |
| 9729 | +			$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>'; | 
                                                        |
| 9730 | 9730 | }  | 
                                                        
| 9731 | 9731 | |
| 9732 | 9732 | //print "xx".$previous_ref."x".$next_ref;  | 
                                                        
@@ -9734,18 +9734,18 @@ discard block  | 
                                                    ||
| 9734 | 9734 | |
| 9735 | 9735 | // Right part of banner  | 
                                                        
| 9736 | 9736 |  		if ($morehtmlright) { | 
                                                        
| 9737 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';  | 
                                                        |
| 9737 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';  | 
                                                        |
| 9738 | 9738 | }  | 
                                                        
| 9739 | 9739 | |
| 9740 | 9740 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9741 | 9741 | $ret .= '<div class="pagination paginationref"><ul class="right">';  | 
                                                        
| 9742 | 9742 | }  | 
                                                        
| 9743 | 9743 |  		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { | 
                                                        
| 9744 | - $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';  | 
                                                        |
| 9744 | + $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';  | 
                                                        |
| 9745 | 9745 | }  | 
                                                        
| 9746 | 9746 |  		if ($shownav && ($previous_ref || $next_ref)) { | 
                                                        
| 9747 | - $ret .= '<li class="pagination">' . $previous_ref . '</li>';  | 
                                                        |
| 9748 | - $ret .= '<li class="pagination">' . $next_ref . '</li>';  | 
                                                        |
| 9747 | + $ret .= '<li class="pagination">'.$previous_ref.'</li>';  | 
                                                        |
| 9748 | + $ret .= '<li class="pagination">'.$next_ref.'</li>';  | 
                                                        |
| 9749 | 9749 | }  | 
                                                        
| 9750 | 9750 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9751 | 9751 | $ret .= '</ul></div>';  | 
                                                        
@@ -9760,7 +9760,7 @@ discard block  | 
                                                    ||
| 9760 | 9760 | $morehtmlstatus = $hookmanager->resPrint;  | 
                                                        
| 9761 | 9761 | }  | 
                                                        
| 9762 | 9762 |  		if ($morehtmlstatus) { | 
                                                        
| 9763 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';  | 
                                                        |
| 9763 | + $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';  | 
                                                        |
| 9764 | 9764 | }  | 
                                                        
| 9765 | 9765 | |
| 9766 | 9766 | $parameters = array();  | 
                                                        
@@ -9774,14 +9774,14 @@ discard block  | 
                                                    ||
| 9774 | 9774 | // Left part of banner  | 
                                                        
| 9775 | 9775 |  		if ($morehtmlleft) { | 
                                                        
| 9776 | 9776 |  			if ($conf->browser->layout == 'phone') { | 
                                                        
| 9777 | - $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9777 | + $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9778 | 9778 |  			} else { | 
                                                        
| 9779 | - $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9779 | + $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9780 | 9780 | }  | 
                                                        
| 9781 | 9781 | }  | 
                                                        
| 9782 | 9782 | |
| 9783 | 9783 | //if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';  | 
                                                        
| 9784 | - $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';  | 
                                                        |
| 9784 | + $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';  | 
                                                        |
| 9785 | 9785 | |
| 9786 | 9786 | // For thirdparty, contact, user, member, the ref is the id, so we show something else  | 
                                                        
| 9787 | 9787 |  		if ($object->element == 'societe') { | 
                                                        
@@ -9795,7 +9795,7 @@ discard block  | 
                                                    ||
| 9795 | 9795 | |
| 9796 | 9796 |  			if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
| 9797 | 9797 |  				if (!is_object($extralanguages)) { | 
                                                        
| 9798 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        |
| 9798 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        |
| 9799 | 9799 | $extralanguages = new ExtraLanguages($this->db);  | 
                                                        
| 9800 | 9800 | }  | 
                                                        
| 9801 | 9801 |  				$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
@@ -9810,29 +9810,29 @@ discard block  | 
                                                    ||
| 9810 | 9810 |  						if ($object->array_languages['name'][$extralangcode]) { | 
                                                        
| 9811 | 9811 | $htmltext .= $object->array_languages['name'][$extralangcode];  | 
                                                        
| 9812 | 9812 |  						} else { | 
                                                        
| 9813 | -							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; | 
                                                        |
| 9813 | +							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; | 
                                                        |
| 9814 | 9814 | }  | 
                                                        
| 9815 | 9815 | }  | 
                                                        
| 9816 | - $ret .= '<!-- Show translations of name -->' . "\n";  | 
                                                        |
| 9816 | + $ret .= '<!-- Show translations of name -->'."\n";  | 
                                                        |
| 9817 | 9817 |  					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); | 
                                                        
| 9818 | 9818 | }  | 
                                                        
| 9819 | 9819 | }  | 
                                                        
| 9820 | 9820 |  		} elseif ($object->element == 'member') { | 
                                                        
| 9821 | 9821 | '@phan-var-force Adherent $object';  | 
                                                        
| 9822 | - $ret .= $object->ref . '<br>';  | 
                                                        |
| 9822 | + $ret .= $object->ref.'<br>';  | 
                                                        |
| 9823 | 9823 | $fullname = $object->getFullName($langs);  | 
                                                        
| 9824 | 9824 |  			if ($object->morphy == 'mor' && $object->societe) { | 
                                                        
| 9825 | -				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); | 
                                                        |
| 9825 | +				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); | 
                                                        |
| 9826 | 9826 |  			} else { | 
                                                        
| 9827 | -				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); | 
                                                        |
| 9827 | +				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); | 
                                                        |
| 9828 | 9828 | }  | 
                                                        
| 9829 | 9829 |  		} elseif (in_array($object->element, array('contact', 'user'))) { | 
                                                        
| 9830 | - $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;  | 
                                                        |
| 9830 | + $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;  | 
                                                        |
| 9831 | 9831 |  		} elseif ($object->element == 'usergroup') { | 
                                                        
| 9832 | 9832 | $ret .= dol_htmlentities($object->name);  | 
                                                        
| 9833 | 9833 |  		} elseif (in_array($object->element, array('action', 'agenda'))) { | 
                                                        
| 9834 | 9834 | '@phan-var-force ActionComm $object';  | 
                                                        
| 9835 | - $ret .= $object->ref . '<br>' . $object->label;  | 
                                                        |
| 9835 | + $ret .= $object->ref.'<br>'.$object->label;  | 
                                                        |
| 9836 | 9836 |  		} elseif (in_array($object->element, array('adherent_type'))) { | 
                                                        
| 9837 | 9837 | $ret .= $object->label;  | 
                                                        
| 9838 | 9838 |  		} elseif ($object->element == 'ecm_directories') { | 
                                                        
@@ -9885,9 +9885,9 @@ discard block  | 
                                                    ||
| 9885 | 9885 | }  | 
                                                        
| 9886 | 9886 | |
| 9887 | 9887 | // Barcode image @phan-suppress-next-line PhanUndeclaredProperty  | 
                                                        
| 9888 | - $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);  | 
                                                        |
| 9889 | - $out = '<!-- url barcode = ' . $url . ' -->';  | 
                                                        |
| 9890 | - $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';  | 
                                                        |
| 9888 | + $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);  | 
                                                        |
| 9889 | + $out = '<!-- url barcode = '.$url.' -->';  | 
                                                        |
| 9890 | + $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';  | 
                                                        |
| 9891 | 9891 | |
| 9892 | 9892 | return $out;  | 
                                                        
| 9893 | 9893 | }  | 
                                                        
@@ -9914,7 +9914,7 @@ discard block  | 
                                                    ||
| 9914 | 9914 | global $conf, $langs;  | 
                                                        
| 9915 | 9915 | |
| 9916 | 9916 | $entity = (empty($object->entity) ? $conf->entity : $object->entity);  | 
                                                        
| 9917 | - $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)  | 
                                                        |
| 9917 | + $id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)  | 
                                                        |
| 9918 | 9918 | |
| 9919 | 9919 | $dir = '';  | 
                                                        
| 9920 | 9920 | $file = '';  | 
                                                        
@@ -9927,28 +9927,28 @@ discard block  | 
                                                    ||
| 9927 | 9927 |  			if (!empty($object->logo)) { | 
                                                        
| 9928 | 9928 |  				if (dolIsAllowedForPreview($object->logo)) { | 
                                                        
| 9929 | 9929 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9930 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 9930 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 9931 | 9931 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9932 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 9932 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 9933 | 9933 |  					} else { | 
                                                        
| 9934 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 9934 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 9935 | 9935 | }  | 
                                                        
| 9936 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 9936 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 9937 | 9937 | }  | 
                                                        
| 9938 | 9938 | }  | 
                                                        
| 9939 | 9939 | $email = $object->email;  | 
                                                        
| 9940 | 9940 |  		} elseif ($modulepart == 'contact') { | 
                                                        
| 9941 | - $dir = $conf->societe->multidir_output[$entity] . '/contact';  | 
                                                        |
| 9941 | + $dir = $conf->societe->multidir_output[$entity].'/contact';  | 
                                                        |
| 9942 | 9942 |  			if (!empty($object->photo)) { | 
                                                        
| 9943 | 9943 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9944 | 9944 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9945 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9945 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9946 | 9946 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9947 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9947 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9948 | 9948 |  					} else { | 
                                                        
| 9949 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 9949 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 9950 | 9950 | }  | 
                                                        
| 9951 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 9951 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 9952 | 9952 | }  | 
                                                        
| 9953 | 9953 | }  | 
                                                        
| 9954 | 9954 | $email = $object->email;  | 
                                                        
@@ -9958,17 +9958,17 @@ discard block  | 
                                                    ||
| 9958 | 9958 |  			if (!empty($object->photo)) { | 
                                                        
| 9959 | 9959 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9960 | 9960 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9961 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9961 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9962 | 9962 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9963 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9963 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9964 | 9964 |  					} else { | 
                                                        
| 9965 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 9965 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 9966 | 9966 | }  | 
                                                        
| 9967 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 9967 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 9968 | 9968 | }  | 
                                                        
| 9969 | 9969 | }  | 
                                                        
| 9970 | 9970 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9971 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9971 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9972 | 9972 | }  | 
                                                        
| 9973 | 9973 | $email = $object->email;  | 
                                                        
| 9974 | 9974 | $capture = 'user';  | 
                                                        
@@ -9977,17 +9977,17 @@ discard block  | 
                                                    ||
| 9977 | 9977 |  			if (!empty($object->photo)) { | 
                                                        
| 9978 | 9978 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9979 | 9979 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9980 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9980 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9981 | 9981 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9982 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9982 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9983 | 9983 |  					} else { | 
                                                        
| 9984 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 9984 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 9985 | 9985 | }  | 
                                                        
| 9986 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 9986 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 9987 | 9987 | }  | 
                                                        
| 9988 | 9988 | }  | 
                                                        
| 9989 | 9989 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9990 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9990 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9991 | 9991 | }  | 
                                                        
| 9992 | 9992 | $email = $object->email;  | 
                                                        
| 9993 | 9993 | $capture = 'user';  | 
                                                        
@@ -10013,35 +10013,35 @@ discard block  | 
                                                    ||
| 10013 | 10013 | $ret = '';  | 
                                                        
| 10014 | 10014 | |
| 10015 | 10015 |  		if ($dir) { | 
                                                        
| 10016 | -			if ($file && file_exists($dir . "/" . $file)) { | 
                                                        |
| 10016 | +			if ($file && file_exists($dir."/".$file)) { | 
                                                        |
| 10017 | 10017 |  				if ($addlinktofullsize) { | 
                                                        
| 10018 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 10018 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 10019 | 10019 |  					if ($urladvanced) { | 
                                                        
| 10020 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 10020 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 10021 | 10021 |  					} else { | 
                                                        
| 10022 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 10022 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 10023 | 10023 | }  | 
                                                        
| 10024 | 10024 | }  | 
                                                        
| 10025 | -				$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 . '">'; | 
                                                        |
| 10025 | +				$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.'">'; | 
                                                        |
| 10026 | 10026 |  				if ($addlinktofullsize) { | 
                                                        
| 10027 | 10027 | $ret .= '</a>';  | 
                                                        
| 10028 | 10028 | }  | 
                                                        
| 10029 | -			} elseif ($altfile && file_exists($dir . "/" . $altfile)) { | 
                                                        |
| 10029 | +			} elseif ($altfile && file_exists($dir."/".$altfile)) { | 
                                                        |
| 10030 | 10030 |  				if ($addlinktofullsize) { | 
                                                        
| 10031 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 10031 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 10032 | 10032 |  					if ($urladvanced) { | 
                                                        
| 10033 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 10033 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 10034 | 10034 |  					} else { | 
                                                        
| 10035 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 10035 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 10036 | 10036 | }  | 
                                                        
| 10037 | 10037 | }  | 
                                                        
| 10038 | -				$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 . '">'; | 
                                                        |
| 10038 | +				$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.'">'; | 
                                                        |
| 10039 | 10039 |  				if ($addlinktofullsize) { | 
                                                        
| 10040 | 10040 | $ret .= '</a>';  | 
                                                        
| 10041 | 10041 | }  | 
                                                        
| 10042 | 10042 |  			} else { | 
                                                        
| 10043 | 10043 | $nophoto = '/public/theme/common/nophoto.png';  | 
                                                        
| 10044 | - $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 10044 | + $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 10045 | 10045 |  				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found | 
                                                        
| 10046 | 10046 |  					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { | 
                                                        
| 10047 | 10047 | $nophoto = 'company';  | 
                                                        
@@ -10059,13 +10059,13 @@ discard block  | 
                                                    ||
| 10059 | 10059 |  				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { | 
                                                        
| 10060 | 10060 | // see https://gravatar.com/site/implement/images/php/  | 
                                                        
| 10061 | 10061 | $ret .= '<!-- Put link to gravatar -->';  | 
                                                        
| 10062 | - $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  | 
                                                        |
| 10062 | + $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  | 
                                                        |
| 10063 | 10063 |  				} else { | 
                                                        
| 10064 | 10064 |  					if ($nophoto == 'company') { | 
                                                        
| 10065 | -						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; | 
                                                        |
| 10065 | +						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; | 
                                                        |
| 10066 | 10066 | //$ret .= '<div class="difforspanimgright"></div>';  | 
                                                        
| 10067 | 10067 |  					} else { | 
                                                        
| 10068 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';  | 
                                                        |
| 10068 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';  | 
                                                        |
| 10069 | 10069 | }  | 
                                                        
| 10070 | 10070 | }  | 
                                                        
| 10071 | 10071 | }  | 
                                                        
@@ -10076,15 +10076,15 @@ discard block  | 
                                                    ||
| 10076 | 10076 | }  | 
                                                        
| 10077 | 10077 | $ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
| 10078 | 10078 |  				if ($object->photo) { | 
                                                        
| 10079 | -					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; | 
                                                        |
| 10079 | +					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; | 
                                                        |
| 10080 | 10080 | }  | 
                                                        
| 10081 | 10081 | $ret .= '<tr><td class="tdoverflow">';  | 
                                                        
| 10082 | 10082 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 10083 | 10083 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 10084 | 10084 |  				if ($maxmin > 0) { | 
                                                        
| 10085 | - $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10085 | + $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10086 | 10086 | }  | 
                                                        
| 10087 | - $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';  | 
                                                        |
| 10087 | + $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';  | 
                                                        |
| 10088 | 10088 | $ret .= '</td></tr>';  | 
                                                        
| 10089 | 10089 | $ret .= '</table>';  | 
                                                        
| 10090 | 10090 | }  | 
                                                        
@@ -10138,38 +10138,38 @@ discard block  | 
                                                    ||
| 10138 | 10138 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10139 | 10139 | $sql .= ", e.label";  | 
                                                        
| 10140 | 10140 | }  | 
                                                        
| 10141 | - $sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";  | 
                                                        |
| 10141 | + $sql .= " FROM ".$this->db->prefix()."usergroup as ug ";  | 
                                                        |
| 10142 | 10142 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10143 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10143 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10144 | 10144 |  			if ($force_entity) { | 
                                                        
| 10145 | - $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";  | 
                                                        |
| 10145 | + $sql .= " WHERE ug.entity IN (0, ".$force_entity.")";  | 
                                                        |
| 10146 | 10146 |  			} else { | 
                                                        
| 10147 | 10147 | $sql .= " WHERE ug.entity IS NOT NULL";  | 
                                                        
| 10148 | 10148 | }  | 
                                                        
| 10149 | 10149 |  		} else { | 
                                                        
| 10150 | - $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";  | 
                                                        |
| 10150 | + $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";  | 
                                                        |
| 10151 | 10151 | }  | 
                                                        
| 10152 | 10152 |  		if (is_array($exclude) && $excludeGroups) { | 
                                                        
| 10153 | -			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; | 
                                                        |
| 10153 | +			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; | 
                                                        |
| 10154 | 10154 | }  | 
                                                        
| 10155 | 10155 |  		if (is_array($include) && $includeGroups) { | 
                                                        
| 10156 | -			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; | 
                                                        |
| 10156 | +			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; | 
                                                        |
| 10157 | 10157 | }  | 
                                                        
| 10158 | 10158 | $sql .= " ORDER BY ug.nom ASC";  | 
                                                        
| 10159 | 10159 | |
| 10160 | - dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10160 | + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10161 | 10161 | $resql = $this->db->query($sql);  | 
                                                        
| 10162 | 10162 |  		if ($resql) { | 
                                                        
| 10163 | 10163 | // Enhance with select2  | 
                                                        
| 10164 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10164 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10165 | 10165 | |
| 10166 | - $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 10166 | + $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 10167 | 10167 | |
| 10168 | 10168 | $num = $this->db->num_rows($resql);  | 
                                                        
| 10169 | 10169 | $i = 0;  | 
                                                        
| 10170 | 10170 |  			if ($num) { | 
                                                        
| 10171 | 10171 |  				if ($show_empty && !$multiple) { | 
                                                        
| 10172 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 10172 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 10173 | 10173 | }  | 
                                                        
| 10174 | 10174 | |
| 10175 | 10175 |  				while ($i < $num) { | 
                                                        
@@ -10182,11 +10182,11 @@ discard block  | 
                                                    ||
| 10182 | 10182 | $label = $obj->name;  | 
                                                        
| 10183 | 10183 | $labelhtml = $obj->name;  | 
                                                        
| 10184 | 10184 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { | 
                                                        
| 10185 | -						$label .= " (" . $obj->label . ")"; | 
                                                        |
| 10186 | -						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; | 
                                                        |
| 10185 | +						$label .= " (".$obj->label.")"; | 
                                                        |
| 10186 | +						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; | 
                                                        |
| 10187 | 10187 | }  | 
                                                        
| 10188 | 10188 | |
| 10189 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10189 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10190 | 10190 |  					if ($disableline) { | 
                                                        
| 10191 | 10191 | $out .= ' disabled';  | 
                                                        
| 10192 | 10192 | }  | 
                                                        
@@ -10202,9 +10202,9 @@ discard block  | 
                                                    ||
| 10202 | 10202 | }  | 
                                                        
| 10203 | 10203 |  			} else { | 
                                                        
| 10204 | 10204 |  				if ($show_empty) { | 
                                                        
| 10205 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";  | 
                                                        |
| 10205 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";  | 
                                                        |
| 10206 | 10206 | }  | 
                                                        
| 10207 | -				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; | 
                                                        |
| 10207 | +				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; | 
                                                        |
| 10208 | 10208 | }  | 
                                                        
| 10209 | 10209 | $out .= '</select>';  | 
                                                        
| 10210 | 10210 | |
@@ -10248,25 +10248,25 @@ discard block  | 
                                                    ||
| 10248 | 10248 | $out = '';  | 
                                                        
| 10249 | 10249 | |
| 10250 | 10250 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10251 | - $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';  | 
                                                        |
| 10251 | + $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';  | 
                                                        |
| 10252 | 10252 | }  | 
                                                        
| 10253 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10253 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10254 | 10254 |              $(document).ready(function() { | 
                                                        
| 10255 | -                $("#' . $cssclass . 's").click(function() { | 
                                                        |
| 10255 | +                $("#' . $cssclass.'s").click(function() { | 
                                                        |
| 10256 | 10256 |                      if($(this).is(\':checked\')){ | 
                                                        
| 10257 | -                        console.log("We check all ' . $cssclass . ' and trigger the change method"); | 
                                                        |
| 10258 | -                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10257 | +                        console.log("We check all ' . $cssclass.' and trigger the change method"); | 
                                                        |
| 10258 | +                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10259 | 10259 | }  | 
                                                        
| 10260 | 10260 | else  | 
                                                        
| 10261 | 10261 |                      { | 
                                                        
| 10262 | 10262 |                          console.log("We uncheck all"); | 
                                                        
| 10263 | -                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10263 | +                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10264 | 10264 | }' . "\n";  | 
                                                        
| 10265 | 10265 |  		if ($calljsfunction) { | 
                                                        
| 10266 | -			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10266 | +			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10267 | 10267 | }  | 
                                                        
| 10268 | 10268 | $out .= ' });  | 
                                                        
| 10269 | -        	        $(".' . $cssclass . '").change(function() { | 
                                                        |
| 10269 | +        	        $(".' . $cssclass.'").change(function() { | 
                                                        |
| 10270 | 10270 |  					$(this).closest("tr").toggleClass("highlight", this.checked); | 
                                                        
| 10271 | 10271 | });  | 
                                                        
| 10272 | 10272 | });  | 
                                                        
@@ -10311,67 +10311,67 @@ discard block  | 
                                                    ||
| 10311 | 10311 | global $langs, $user;  | 
                                                        
| 10312 | 10312 | |
| 10313 | 10313 | $out = '';  | 
                                                        
| 10314 | - $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10315 | -		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; | 
                                                        |
| 10314 | + $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10315 | +		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; | 
                                                        |
| 10316 | 10316 |  		if (!empty($excludeid)) { | 
                                                        
| 10317 | -			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; | 
                                                        |
| 10317 | +			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; | 
                                                        |
| 10318 | 10318 | }  | 
                                                        
| 10319 | 10319 | $sql .= " ORDER BY label";  | 
                                                        
| 10320 | 10320 | |
| 10321 | 10321 | $resql = $this->db->query($sql);  | 
                                                        
| 10322 | 10322 |  		if ($resql) { | 
                                                        
| 10323 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10323 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10324 | 10324 |  			if ($useempty) { | 
                                                        
| 10325 | 10325 | $out .= '<option value="0"> </option>';  | 
                                                        
| 10326 | 10326 | }  | 
                                                        
| 10327 | 10327 | |
| 10328 | 10328 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10329 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';  | 
                                                        |
| 10329 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';  | 
                                                        |
| 10330 | 10330 | }  | 
                                                        
| 10331 | 10331 | $out .= '</select>';  | 
                                                        
| 10332 | -			$out .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 10332 | +			$out .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 10333 | 10333 | |
| 10334 | 10334 |  			if (!empty($htmlname) && $user->admin && $info_admin) { | 
                                                        
| 10335 | -				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10335 | +				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10336 | 10336 | }  | 
                                                        
| 10337 | 10337 | |
| 10338 | 10338 |  			if (!empty($target)) { | 
                                                        
| 10339 | - $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10339 | + $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10340 | 10340 | $resql = $this->db->query($sql);  | 
                                                        
| 10341 | 10341 |  				if ($resql) { | 
                                                        
| 10342 | 10342 |  					if ($this->db->num_rows($resql) > 0) { | 
                                                        
| 10343 | 10343 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 10344 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10344 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10345 | 10345 |  							$(function() { | 
                                                        
| 10346 | -								$("select[name=' . $target . ']").on("change", function() { | 
                                                        |
| 10346 | +								$("select[name=' . $target.']").on("change", function() { | 
                                                        |
| 10347 | 10347 | var current_val = $(this).val();  | 
                                                        
| 10348 | -									if (current_val == ' . $obj->id . ') {'; | 
                                                        |
| 10348 | +									if (current_val == ' . $obj->id.') {'; | 
                                                        |
| 10349 | 10349 |  						if (!empty($default_selected) || !empty($selected)) { | 
                                                        
| 10350 | -							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; | 
                                                        |
| 10350 | +							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; | 
                                                        |
| 10351 | 10351 | }  | 
                                                        
| 10352 | 10352 | |
| 10353 | 10353 | $out .= '  | 
                                                        
| 10354 | -										$("select[name=' . $htmlname . ']").change(); | 
                                                        |
| 10354 | +										$("select[name=' . $htmlname.']").change(); | 
                                                        |
| 10355 | 10355 | }  | 
                                                        
| 10356 | 10356 | });  | 
                                                        
| 10357 | 10357 | |
| 10358 | -								$("select[name=' . $htmlname . ']").change(function() { | 
                                                        |
| 10358 | +								$("select[name=' . $htmlname.']").change(function() { | 
                                                        |
| 10359 | 10359 | |
| 10360 | -									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { | 
                                                        |
| 10360 | +									if ($("select[name=' . $target.']").val() == '.$obj->id.') { | 
                                                        |
| 10361 | 10361 | // get price of kilometer to fill the unit price  | 
                                                        
| 10362 | 10362 |  										$.ajax({ | 
                                                        
| 10363 | 10363 | method: "POST",  | 
                                                        
| 10364 | 10364 | dataType: "json",  | 
                                                        
| 10365 | -											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, | 
                                                        |
| 10366 | -											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", | 
                                                        |
| 10365 | +											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, | 
                                                        |
| 10366 | +											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", | 
                                                        |
| 10367 | 10367 |  										}).done(function( data, textStatus, jqXHR ) { | 
                                                        
| 10368 | 10368 | console.log(data);  | 
                                                        
| 10369 | 10369 |  											if (typeof data.up != "undefined") { | 
                                                        
| 10370 | 10370 |  												$("input[name=value_unit]").val(data.up); | 
                                                        
| 10371 | -												$("select[name=' . $htmlname . ']").attr("title", data.title); | 
                                                        |
| 10371 | +												$("select[name=' . $htmlname.']").attr("title", data.title); | 
                                                        |
| 10372 | 10372 |  											} else { | 
                                                        
| 10373 | 10373 |  												$("input[name=value_unit]").val(""); | 
                                                        
| 10374 | -												$("select[name=' . $htmlname . ']").attr("title", ""); | 
                                                        |
| 10374 | +												$("select[name=' . $htmlname.']").attr("title", ""); | 
                                                        |
| 10375 | 10375 | }  | 
                                                        
| 10376 | 10376 | });  | 
                                                        
| 10377 | 10377 | }  | 
                                                        
@@ -10401,18 +10401,18 @@ discard block  | 
                                                    ||
| 10401 | 10401 | global $conf, $langs;  | 
                                                        
| 10402 | 10402 | |
| 10403 | 10403 | $out = '';  | 
                                                        
| 10404 | - $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";  | 
                                                        |
| 10405 | - $sql .= " WHERE entity = " . $conf->entity . " AND active = 1";  | 
                                                        |
| 10404 | + $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";  | 
                                                        |
| 10405 | + $sql .= " WHERE entity = ".$conf->entity." AND active = 1";  | 
                                                        |
| 10406 | 10406 | |
| 10407 | 10407 | $resql = $this->db->query($sql);  | 
                                                        
| 10408 | 10408 |  		if ($resql) { | 
                                                        
| 10409 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10409 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10410 | 10410 |  			if ($useempty) { | 
                                                        
| 10411 | 10411 | $out .= '<option value="0"></option>';  | 
                                                        
| 10412 | 10412 | }  | 
                                                        
| 10413 | 10413 | |
| 10414 | 10414 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10415 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';  | 
                                                        |
| 10415 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';  | 
                                                        |
| 10416 | 10416 | }  | 
                                                        
| 10417 | 10417 | $out .= '</select>';  | 
                                                        
| 10418 | 10418 |  		} else { | 
                                                        
@@ -10443,12 +10443,12 @@ discard block  | 
                                                    ||
| 10443 | 10443 | |
| 10444 | 10444 | $resql = $this->db->query($sql);  | 
                                                        
| 10445 | 10445 |  		if ($resql) { | 
                                                        
| 10446 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10446 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10447 | 10447 |  			if ($useempty) { | 
                                                        
| 10448 | 10448 | $out .= '<option value="0"></option>';  | 
                                                        
| 10449 | 10449 | }  | 
                                                        
| 10450 | 10450 |  			if ($allchoice) { | 
                                                        
| 10451 | -				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; | 
                                                        |
| 10451 | +				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; | 
                                                        |
| 10452 | 10452 | }  | 
                                                        
| 10453 | 10453 | |
| 10454 | 10454 | $field = 'code';  | 
                                                        
@@ -10458,7 +10458,7 @@ discard block  | 
                                                    ||
| 10458 | 10458 | |
| 10459 | 10459 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10460 | 10460 | $key = $langs->trans($obj->code);  | 
                                                        
| 10461 | -				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; | 
                                                        |
| 10461 | +				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; | 
                                                        |
| 10462 | 10462 | }  | 
                                                        
| 10463 | 10463 | $out .= '</select>';  | 
                                                        
| 10464 | 10464 | |
@@ -10492,7 +10492,7 @@ discard block  | 
                                                    ||
| 10492 | 10492 |  	{ | 
                                                        
| 10493 | 10493 | global $user, $conf, $langs;  | 
                                                        
| 10494 | 10494 | |
| 10495 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 10495 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 10496 | 10496 | |
| 10497 | 10497 |  		if (is_null($usertofilter)) { | 
                                                        
| 10498 | 10498 | $usertofilter = $user;  | 
                                                        
@@ -10516,10 +10516,10 @@ discard block  | 
                                                    ||
| 10516 | 10516 | $sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,  | 
                                                        
| 10517 | 10517 | p.title, p.fk_soc, p.fk_statut, p.public,";  | 
                                                        
| 10518 | 10518 | $sql .= ' s.nom as name';  | 
                                                        
| 10519 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p';  | 
                                                        |
| 10520 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10521 | - $sql .= ' ' . $this->db->prefix() . 'facture as f';  | 
                                                        |
| 10522 | -		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; | 
                                                        |
| 10519 | + $sql .= ' FROM '.$this->db->prefix().'projet as p';  | 
                                                        |
| 10520 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10521 | + $sql .= ' '.$this->db->prefix().'facture as f';  | 
                                                        |
| 10522 | +		$sql .= " WHERE p.entity IN (".getEntity('project').")"; | 
                                                        |
| 10523 | 10523 | $sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement  | 
                                                        
| 10524 | 10524 |  		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; | 
                                                        
| 10525 | 10525 | //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";  | 
                                                        
@@ -10530,14 +10530,14 @@ discard block  | 
                                                    ||
| 10530 | 10530 |  		if ($resql) { | 
                                                        
| 10531 | 10531 | // Use select2 selector  | 
                                                        
| 10532 | 10532 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10533 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10533 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10534 | 10534 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
| 10535 | 10535 | $out .= $comboenhancement;  | 
                                                        
| 10536 | 10536 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10537 | 10537 | }  | 
                                                        
| 10538 | 10538 | |
| 10539 | 10539 |  			if (empty($option_only)) { | 
                                                        
| 10540 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10540 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10541 | 10541 | }  | 
                                                        
| 10542 | 10542 |  			if (!empty($show_empty)) { | 
                                                        
| 10543 | 10543 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10567,33 +10567,33 @@ discard block  | 
                                                    ||
| 10567 | 10567 |  						if ($showproject == 'all') { | 
                                                        
| 10568 | 10568 | $labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref  | 
                                                        
| 10569 | 10569 |  							if ($obj->name) { | 
                                                        
| 10570 | - $labeltoshow .= ' - ' . $obj->name; // Soc name  | 
                                                        |
| 10570 | + $labeltoshow .= ' - '.$obj->name; // Soc name  | 
                                                        |
| 10571 | 10571 | }  | 
                                                        
| 10572 | 10572 | |
| 10573 | 10573 | $disabled = 0;  | 
                                                        
| 10574 | 10574 |  							if ($obj->fk_statut == Project::STATUS_DRAFT) { | 
                                                        
| 10575 | 10575 | $disabled = 1;  | 
                                                        
| 10576 | -								$labeltoshow .= ' - ' . $langs->trans("Draft"); | 
                                                        |
| 10576 | +								$labeltoshow .= ' - '.$langs->trans("Draft"); | 
                                                        |
| 10577 | 10577 |  							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { | 
                                                        
| 10578 | 10578 |  								if ($discard_closed == 2) { | 
                                                        
| 10579 | 10579 | $disabled = 1;  | 
                                                        
| 10580 | 10580 | }  | 
                                                        
| 10581 | -								$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10581 | +								$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10582 | 10582 |  							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { | 
                                                        
| 10583 | 10583 | $disabled = 1;  | 
                                                        
| 10584 | -								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10584 | +								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10585 | 10585 | }  | 
                                                        
| 10586 | 10586 | }  | 
                                                        
| 10587 | 10587 | |
| 10588 | 10588 |  						if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10589 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10589 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10590 | 10590 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10591 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10591 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10592 | 10592 |  						} else { | 
                                                        
| 10593 | 10593 |  							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10594 | 10594 | $resultat = '';  | 
                                                        
| 10595 | 10595 |  							} else { | 
                                                        
| 10596 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10596 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10597 | 10597 |  								if ($disabled) { | 
                                                        
| 10598 | 10598 | $resultat .= ' disabled';  | 
                                                        
| 10599 | 10599 | }  | 
                                                        
@@ -10645,22 +10645,22 @@ discard block  | 
                                                    ||
| 10645 | 10645 | |
| 10646 | 10646 | $sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';  | 
                                                        
| 10647 | 10647 | //$sql.= ', el.fk_source';  | 
                                                        
| 10648 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';  | 
                                                        |
| 10649 | -		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; | 
                                                        |
| 10648 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';  | 
                                                        |
| 10649 | +		$sql .= " WHERE f.entity IN (".getEntity('invoice').")"; | 
                                                        |
| 10650 | 10650 | $sql .= " ORDER BY f.titre ASC";  | 
                                                        
| 10651 | 10651 | |
| 10652 | 10652 | $resql = $this->db->query($sql);  | 
                                                        
| 10653 | 10653 |  		if ($resql) { | 
                                                        
| 10654 | 10654 | // Use select2 selector  | 
                                                        
| 10655 | 10655 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10656 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10656 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10657 | 10657 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
| 10658 | 10658 | $out .= $comboenhancement;  | 
                                                        
| 10659 | 10659 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10660 | 10660 | }  | 
                                                        
| 10661 | 10661 | |
| 10662 | 10662 |  			if (empty($option_only)) { | 
                                                        
| 10663 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10663 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10664 | 10664 | }  | 
                                                        
| 10665 | 10665 |  			if (!empty($show_empty)) { | 
                                                        
| 10666 | 10666 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10679,19 +10679,19 @@ discard block  | 
                                                    ||
| 10679 | 10679 | $disabled = 0;  | 
                                                        
| 10680 | 10680 |  					if (!empty($obj->suspended)) { | 
                                                        
| 10681 | 10681 | $disabled = 1;  | 
                                                        
| 10682 | -						$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10682 | +						$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10683 | 10683 | }  | 
                                                        
| 10684 | 10684 | |
| 10685 | 10685 | |
| 10686 | 10686 |  					if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10687 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10687 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10688 | 10688 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10689 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10689 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10690 | 10690 |  					} else { | 
                                                        
| 10691 | 10691 |  						if ($disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10692 | 10692 | $resultat = '';  | 
                                                        
| 10693 | 10693 |  						} else { | 
                                                        
| 10694 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10694 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10695 | 10695 |  							if ($disabled) { | 
                                                        
| 10696 | 10696 | $resultat .= ' disabled';  | 
                                                        
| 10697 | 10697 | }  | 
                                                        
@@ -10731,14 +10731,14 @@ discard block  | 
                                                    ||
| 10731 | 10731 | global $langs;  | 
                                                        
| 10732 | 10732 | |
| 10733 | 10733 |  		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with () | 
                                                        
| 10734 | -			$search_component_params_hidden = '(' . $search_component_params_hidden . ')'; | 
                                                        |
| 10734 | +			$search_component_params_hidden = '('.$search_component_params_hidden.')'; | 
                                                        |
| 10735 | 10735 | }  | 
                                                        
| 10736 | 10736 | |
| 10737 | 10737 | $ret = '';  | 
                                                        
| 10738 | 10738 | |
| 10739 | 10739 | $ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';  | 
                                                        
| 10740 | 10740 | $ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';  | 
                                                        
| 10741 | -		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10741 | +		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth hideonsmartphone" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10742 | 10742 | $ret .= '</a>';  | 
                                                        
| 10743 | 10743 | |
| 10744 | 10744 | $ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';  | 
                                                        
@@ -10782,29 +10782,29 @@ discard block  | 
                                                    ||
| 10782 | 10782 | $ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';  | 
                                                        
| 10783 | 10783 | }  | 
                                                        
| 10784 | 10784 | $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%')) -->";  | 
                                                        
| 10785 | - $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';  | 
                                                        |
| 10785 | + $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';  | 
                                                        |
| 10786 | 10786 | // $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";  | 
                                                        
| 10787 | 10787 | |
| 10788 | 10788 | // For compatibility with forms that show themself the search criteria in addition of this component, we output these fields  | 
                                                        
| 10789 | 10789 |  		foreach ($arrayofcriterias as $criteria) { | 
                                                        
| 10790 | 10790 |  			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { | 
                                                        
| 10791 | -				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10791 | +				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10792 | 10792 | continue;  | 
                                                        
| 10793 | 10793 | }  | 
                                                        
| 10794 | 10794 |  				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { | 
                                                        
| 10795 | 10795 | continue;  | 
                                                        
| 10796 | 10796 | }  | 
                                                        
| 10797 | 10797 |  				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { | 
                                                        
| 10798 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';  | 
                                                        |
| 10799 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';  | 
                                                        |
| 10800 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';  | 
                                                        |
| 10801 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';  | 
                                                        |
| 10802 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';  | 
                                                        |
| 10803 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';  | 
                                                        |
| 10804 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';  | 
                                                        |
| 10805 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';  | 
                                                        |
| 10798 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';  | 
                                                        |
| 10799 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';  | 
                                                        |
| 10800 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';  | 
                                                        |
| 10801 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';  | 
                                                        |
| 10802 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';  | 
                                                        |
| 10803 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';  | 
                                                        |
| 10804 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';  | 
                                                        |
| 10805 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';  | 
                                                        |
| 10806 | 10806 |  				} else { | 
                                                        
| 10807 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';  | 
                                                        |
| 10807 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';  | 
                                                        |
| 10808 | 10808 | }  | 
                                                        
| 10809 | 10809 | }  | 
                                                        
| 10810 | 10810 | }  | 
                                                        
@@ -10812,7 +10812,7 @@ discard block  | 
                                                    ||
| 10812 | 10812 | $ret .= '</div>';  | 
                                                        
| 10813 | 10813 | |
| 10814 | 10814 | $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";  | 
                                                        
| 10815 | -		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 10815 | +		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 10816 | 10816 | |
| 10817 | 10817 | $ret .= '</div>';  | 
                                                        
| 10818 | 10818 | $ret .= '</div>';  | 
                                                        
@@ -10886,7 +10886,7 @@ discard block  | 
                                                    ||
| 10886 | 10886 | |
| 10887 | 10887 | $TModels = array();  | 
                                                        
| 10888 | 10888 | |
| 10889 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 10889 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 10890 | 10890 | $formmail = new FormMail($this->db);  | 
                                                        
| 10891 | 10891 | $result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);  | 
                                                        
| 10892 | 10892 | |
@@ -10899,17 +10899,17 @@ discard block  | 
                                                    ||
| 10899 | 10899 | }  | 
                                                        
| 10900 | 10900 | }  | 
                                                        
| 10901 | 10901 | |
| 10902 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';  | 
                                                        |
| 10902 | + $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';  | 
                                                        |
| 10903 | 10903 | |
| 10904 | 10904 |  		foreach ($TModels as $id_model => $label_model) { | 
                                                        
| 10905 | - $retstring .= '<option value="' . $id_model . '"';  | 
                                                        |
| 10906 | - $retstring .= ">" . $label_model . "</option>";  | 
                                                        |
| 10905 | + $retstring .= '<option value="'.$id_model.'"';  | 
                                                        |
| 10906 | + $retstring .= ">".$label_model."</option>";  | 
                                                        |
| 10907 | 10907 | }  | 
                                                        
| 10908 | 10908 | |
| 10909 | 10909 | $retstring .= "</select>";  | 
                                                        
| 10910 | 10910 | |
| 10911 | 10911 |  		if ($addjscombo) { | 
                                                        
| 10912 | -			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); | 
                                                        |
| 10912 | +			$retstring .= ajax_combobox('select_'.$prefix.'model_mail'); | 
                                                        |
| 10913 | 10913 | }  | 
                                                        
| 10914 | 10914 | |
| 10915 | 10915 | return $retstring;  | 
                                                        
@@ -10960,16 +10960,16 @@ discard block  | 
                                                    ||
| 10960 | 10960 | |
| 10961 | 10961 |  		foreach ($buttons as $button) { | 
                                                        
| 10962 | 10962 | $addclass = empty($button['addclass']) ? '' : $button['addclass'];  | 
                                                        
| 10963 | - $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';  | 
                                                        |
| 10963 | + $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';  | 
                                                        |
| 10964 | 10964 | }  | 
                                                        
| 10965 | 10965 | $retstring .= $withoutdiv ? '' : '</div>';  | 
                                                        
| 10966 | 10966 | |
| 10967 | 10967 |  		if ($dol_openinpopup) { | 
                                                        
| 10968 | - $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";  | 
                                                        |
| 10969 | - $retstring .= '<script nonce="' . getNonce() . '">';  | 
                                                        |
| 10968 | + $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";  | 
                                                        |
| 10969 | + $retstring .= '<script nonce="'.getNonce().'">';  | 
                                                        |
| 10970 | 10970 |  			$retstring .= 'jQuery(".button-cancel").click(function(e) { | 
                                                        
| 10971 | - e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');  | 
                                                        |
| 10972 | - window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');  | 
                                                        |
| 10971 | + e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');  | 
                                                        |
| 10972 | + window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');  | 
                                                        |
| 10973 | 10973 | });';  | 
                                                        
| 10974 | 10974 | $retstring .= '</script>';  | 
                                                        
| 10975 | 10975 | }  | 
                                                        
@@ -10998,7 +10998,7 @@ discard block  | 
                                                    ||
| 10998 | 10998 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 10999 | 10999 | |
| 11000 | 11000 | $sql = "SELECT rowid, code, label as label";  | 
                                                        
| 11001 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';  | 
                                                        |
| 11001 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';  | 
                                                        |
| 11002 | 11002 | $sql .= " WHERE active = 1";  | 
                                                        
| 11003 | 11003 | |
| 11004 | 11004 | $resql = $this->db->query($sql);  | 
                                                        
@@ -11009,7 +11009,7 @@ discard block  | 
                                                    ||
| 11009 | 11009 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 11010 | 11010 | |
| 11011 | 11011 | // If translation exists, we use it, otherwise we take the default wording  | 
                                                        
| 11012 | -				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 11012 | +				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 11013 | 11013 | $this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 11014 | 11014 | $this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 11015 | 11015 | $this->cache_invoice_subtype[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -11041,18 +11041,18 @@ discard block  | 
                                                    ||
| 11041 | 11041 | global $langs, $user;  | 
                                                        
| 11042 | 11042 | |
| 11043 | 11043 | $out = '';  | 
                                                        
| 11044 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 11044 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 11045 | 11045 | |
| 11046 | 11046 | $this->load_cache_invoice_subtype();  | 
                                                        
| 11047 | 11047 | |
| 11048 | - $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 11048 | + $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 11049 | 11049 |  		if ($addempty) { | 
                                                        
| 11050 | 11050 | $out .= '<option value="0"> </option>';  | 
                                                        
| 11051 | 11051 | }  | 
                                                        
| 11052 | 11052 | |
| 11053 | 11053 |  		foreach ($this->cache_invoice_subtype as $rowid => $subtype) { | 
                                                        
| 11054 | 11054 | $label = $subtype['label'];  | 
                                                        
| 11055 | - $out .= '<option value="' . $subtype['rowid'] . '"';  | 
                                                        |
| 11055 | + $out .= '<option value="'.$subtype['rowid'].'"';  | 
                                                        |
| 11056 | 11056 |  			if ($selected == $subtype['rowid']) { | 
                                                        
| 11057 | 11057 | $out .= ' selected="selected"';  | 
                                                        
| 11058 | 11058 | }  | 
                                                        
@@ -330,7 +330,7 @@ discard block  | 
                                                    ||
| 330 | 330 |  		if ($sql) { | 
                                                        
| 331 | 331 | // Test if th SQL is allowed SQL  | 
                                                        
| 332 | 332 |  			if ($onlysqltoimportwebsite) { | 
                                                        
| 333 | -				$newsql = str_replace(array("\'"), '__BACKSLASHQUOTE__', $sql);	// Replace the \' char | 
                                                        |
| 333 | +				$newsql = str_replace(array("\'"), '__BACKSLASHQUOTE__', $sql); // Replace the \' char | 
                                                        |
| 334 | 334 | |
| 335 | 335 | // Remove all strings contents including the ' so we can analyse SQL instruction only later  | 
                                                        
| 336 | 336 | $l = strlen($newsql);  | 
                                                        
@@ -378,7 +378,7 @@ discard block  | 
                                                    ||
| 378 | 378 | $extractphpold = '';  | 
                                                        
| 379 | 379 | |
| 380 | 380 | // Security analysis  | 
                                                        
| 381 | - $errorphpcheck = checkPHPCode($extractphpold, $extractphp); // Contains the setEventMessages  | 
                                                        |
| 381 | + $errorphpcheck = checkPHPCode($extractphpold, $extractphp); // Contains the setEventMessages  | 
                                                        |
| 382 | 382 |  				if ($errorphpcheck) { | 
                                                        
| 383 | 383 | $error++;  | 
                                                        
| 384 | 384 | //print 'Request '.($i + 1)." contains non allowed instructions.<br>\n";  | 
                                                        
@@ -559,7 +559,7 @@ discard block  | 
                                                    ||
| 559 | 559 |  	if ($error == 0) { | 
                                                        
| 560 | 560 | $ok = 1;  | 
                                                        
| 561 | 561 |  	} else { | 
                                                        
| 562 | - $ok = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 562 | + $ok = 0; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 563 | 563 | }  | 
                                                        
| 564 | 564 | |
| 565 | 565 | return $ok;  | 
                                                        
@@ -1085,7 +1085,7 @@ discard block  | 
                                                    ||
| 1085 | 1085 | |
| 1086 | 1086 |  					if (preg_match('/dol_login/i', $sessValues) && // limit to dolibarr session | 
                                                        
| 1087 | 1087 |  					preg_match('/dol_entity\|s:([0-9]+):"('.$conf->entity.')"/i', $sessValues) && // limit to current entity | 
                                                        
| 1088 | -					preg_match('/dol_company\|s:([0-9]+):"(' . getDolGlobalString('MAIN_INFO_SOCIETE_NOM').')"/i', $sessValues)) { // limit to company name | 
                                                        |
| 1088 | +					preg_match('/dol_company\|s:([0-9]+):"('.getDolGlobalString('MAIN_INFO_SOCIETE_NOM').')"/i', $sessValues)) { // limit to company name | 
                                                        |
| 1089 | 1089 |  						$tmp = explode('_', $file); | 
                                                        
| 1090 | 1090 | $idsess = $tmp[1];  | 
                                                        
| 1091 | 1091 | // We remove session if it's not ourself  | 
                                                        
@@ -1889,7 +1889,7 @@ discard block  | 
                                                    ||
| 1889 | 1889 | global $conf, $langs;  | 
                                                        
| 1890 | 1890 | |
| 1891 | 1891 |  	$text = $langs->trans("OnlyFollowingModulesAreOpenedToExternalUsers"); | 
                                                        
| 1892 | -	$listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL'));	// List of modules qualified for external user management | 
                                                        |
| 1892 | +	$listofmodules = explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')); // List of modules qualified for external user management | 
                                                        |
| 1893 | 1893 | |
| 1894 | 1894 | $i = 0;  | 
                                                        
| 1895 | 1895 |  	if (!empty($modules)) { | 
                                                        
@@ -360,7 +360,7 @@ discard block  | 
                                                    ||
| 360 | 360 |  					if (getDolGlobalString('MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND') && !empty($objectobj->last_main_doc)) { | 
                                                        
| 361 | 361 | $file_check_list[] = array(  | 
                                                        
| 362 | 362 | 'name' => basename($objectobj->last_main_doc),  | 
                                                        
| 363 | - 'path' => DOL_DATA_ROOT . '/' . $objectobj->last_main_doc,  | 
                                                        |
| 363 | + 'path' => DOL_DATA_ROOT.'/'.$objectobj->last_main_doc,  | 
                                                        |
| 364 | 364 | );  | 
                                                        
| 365 | 365 | }  | 
                                                        
| 366 | 366 |  					foreach ($file_check_list as $file_check_arr) { | 
                                                        
@@ -406,7 +406,7 @@ discard block  | 
                                                    ||
| 406 | 406 |  				if ($fromtype === 'user') { | 
                                                        
| 407 | 407 |  					$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>'; | 
                                                        
| 408 | 408 |  				} elseif ($fromtype === 'company') { | 
                                                        
| 409 | -					$from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; | 
                                                        |
| 409 | +					$from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM').' <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>'; | 
                                                        |
| 410 | 410 |  				} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { | 
                                                        
| 411 | 411 |  					$tmp = explode(',', $user->email_aliases); | 
                                                        
| 412 | 412 | $from = trim($tmp[($reg[1] - 1)]);  | 
                                                        
@@ -430,25 +430,25 @@ discard block  | 
                                                    ||
| 430 | 430 | |
| 431 | 431 |  				$sendtobcc = GETPOST('sendtoccc'); | 
                                                        
| 432 | 432 |  				if ($objectclass == 'Propal') { | 
                                                        
| 433 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO'))); | 
                                                        |
| 433 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO'))); | 
                                                        |
| 434 | 434 | }  | 
                                                        
| 435 | 435 |  				if ($objectclass == 'Commande') { | 
                                                        
| 436 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO'))); | 
                                                        |
| 436 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO'))); | 
                                                        |
| 437 | 437 | }  | 
                                                        
| 438 | 438 |  				if ($objectclass == 'Facture') { | 
                                                        
| 439 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO'))); | 
                                                        |
| 439 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO'))); | 
                                                        |
| 440 | 440 | }  | 
                                                        
| 441 | 441 |  				if ($objectclass == 'SupplierProposal') { | 
                                                        
| 442 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'))); | 
                                                        |
| 442 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'))); | 
                                                        |
| 443 | 443 | }  | 
                                                        
| 444 | 444 |  				if ($objectclass == 'CommandeFournisseur') { | 
                                                        
| 445 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'))); | 
                                                        |
| 445 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'))); | 
                                                        |
| 446 | 446 | }  | 
                                                        
| 447 | 447 |  				if ($objectclass == 'FactureFournisseur') { | 
                                                        
| 448 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'))); | 
                                                        |
| 448 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'))); | 
                                                        |
| 449 | 449 | }  | 
                                                        
| 450 | 450 |  				if ($objectclass == 'Project') { | 
                                                        
| 451 | -					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO'))); | 
                                                        |
| 451 | +					$sendtobcc .= (!getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') ? '' : (($sendtobcc ? ", " : "").getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO'))); | 
                                                        |
| 452 | 452 | }  | 
                                                        
| 453 | 453 | |
| 454 | 454 | // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)  | 
                                                        
@@ -604,7 +604,7 @@ discard block  | 
                                                    ||
| 604 | 604 | $objectobj2->fk_element = $objid2;  | 
                                                        
| 605 | 605 | $objectobj2->elementtype = $objectobj2->element;  | 
                                                        
| 606 | 606 |  								if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { | 
                                                        
| 607 | - $objectobj2->actionmsg2 = $subjectreplaced; // Short text  | 
                                                        |
| 607 | + $objectobj2->actionmsg2 = $subjectreplaced; // Short text  | 
                                                        |
| 608 | 608 | }  | 
                                                        
| 609 | 609 | |
| 610 | 610 | $triggername = strtoupper(get_class($objectobj2)).'_SENTBYMAIL';  | 
                                                        
@@ -660,7 +660,7 @@ discard block  | 
                                                    ||
| 660 | 660 |  							} elseif (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) { | 
                                                        
| 661 | 661 | $resaction .= '<div class="warning">No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS</div>';  | 
                                                        
| 662 | 662 |  							} else { | 
                                                        
| 663 | -								$resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto) . '<br><div class="error">(unhandled error)</div>'; | 
                                                        |
| 663 | +								$resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto).'<br><div class="error">(unhandled error)</div>'; | 
                                                        |
| 664 | 664 | }  | 
                                                        
| 665 | 665 | }  | 
                                                        
| 666 | 666 | }  | 
                                                        
@@ -1063,7 +1063,7 @@ discard block  | 
                                                    ||
| 1063 | 1063 | continue;  | 
                                                        
| 1064 | 1064 | }  | 
                                                        
| 1065 | 1065 | |
| 1066 | -			if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) { | 
                                                        |
| 1066 | +			if ($objectclass == 'Holiday' && !in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) { | 
                                                        |
| 1067 | 1067 |  				$langs->load("errors"); | 
                                                        
| 1068 | 1068 | $nbignored++;  | 
                                                        
| 1069 | 1069 |  				$TMsg[] = '<div class="error">'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'</div><br>'; | 
                                                        
@@ -1226,7 +1226,7 @@ discard block  | 
                                                    ||
| 1226 | 1226 | //For each valid categ type set common categ  | 
                                                        
| 1227 | 1227 |  		if (!empty($to_affecttag_type_array)) { | 
                                                        
| 1228 | 1228 |  			foreach ($to_affecttag_type_array as $categ_type) { | 
                                                        
| 1229 | -				$contcats = GETPOST('contcats_' . $categ_type, 'array'); | 
                                                        |
| 1229 | +				$contcats = GETPOST('contcats_'.$categ_type, 'array'); | 
                                                        |
| 1230 | 1230 | //var_dump($toselect);exit;  | 
                                                        
| 1231 | 1231 |  				foreach ($toselect as $toselectid) { | 
                                                        
| 1232 | 1232 | $result = $object->fetch($toselectid);  | 
                                                        
@@ -1467,7 +1467,7 @@ discard block  | 
                                                    ||
| 1467 | 1467 | $db->begin();  | 
                                                        
| 1468 | 1468 | |
| 1469 | 1469 | $objecttmp = new $objectclass($db);  | 
                                                        
| 1470 | - $e = new ExtraFields($db);// fetch optionals attributes and labels  | 
                                                        |
| 1470 | + $e = new ExtraFields($db); // fetch optionals attributes and labels  | 
                                                        |
| 1471 | 1471 | $e->fetch_name_optionals_label($objecttmp->table_element);  | 
                                                        
| 1472 | 1472 | |
| 1473 | 1473 | $nbok = 0;  | 
                                                        
@@ -1605,7 +1605,7 @@ discard block  | 
                                                    ||
| 1605 | 1605 | $objecttmp->date_valid = dol_now();  | 
                                                        
| 1606 | 1606 | $objecttmp->fk_user_valid = $user->id;  | 
                                                        
| 1607 | 1607 | $objecttmp->status = Holiday::STATUS_APPROVED;  | 
                                                        
| 1608 | - $objecttmp->statut = $objecttmp->status; // deprecated  | 
                                                        |
| 1608 | + $objecttmp->statut = $objecttmp->status; // deprecated  | 
                                                        |
| 1609 | 1609 | |
| 1610 | 1610 | $verif = $objecttmp->approve($user);  | 
                                                        
| 1611 | 1611 | |
@@ -1712,7 +1712,7 @@ discard block  | 
                                                    ||
| 1712 | 1712 | $objecttmp = new $objectclass($db);  | 
                                                        
| 1713 | 1713 | $nbok = 0;  | 
                                                        
| 1714 | 1714 |  	$typeholiday = GETPOST('typeholiday', 'alpha'); | 
                                                        
| 1715 | -	$nbdaysholidays = GETPOSTFLOAT('nbdaysholidays');	// May be 1.5 | 
                                                        |
| 1715 | +	$nbdaysholidays = GETPOSTFLOAT('nbdaysholidays'); // May be 1.5 | 
                                                        |
| 1716 | 1716 | |
| 1717 | 1717 |  	if ($nbdaysholidays <= 0) { | 
                                                        
| 1718 | 1718 |  		setEventMessages($langs->trans("WrongAmount"), "", 'errors'); | 
                                                        
@@ -1772,8 +1772,8 @@ discard block  | 
                                                    ||
| 1772 | 1772 | |
| 1773 | 1773 | $defaultref = '';  | 
                                                        
| 1774 | 1774 |  		$obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; | 
                                                        
| 1775 | -		if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . ".php")) { | 
                                                        |
| 1776 | -			require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . '.php'; | 
                                                        |
| 1775 | +		if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) { | 
                                                        |
| 1776 | +			require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php'; | 
                                                        |
| 1777 | 1777 | $modTask = new $obj();  | 
                                                        
| 1778 | 1778 | $defaultref = $modTask->getNextValue(0, $clone_task);  | 
                                                        
| 1779 | 1779 | }  | 
                                                        
@@ -1814,7 +1814,7 @@ discard block  | 
                                                    ||
| 1814 | 1814 | |
| 1815 | 1815 |  	if (!$error) { | 
                                                        
| 1816 | 1816 |  		setEventMessage($langs->trans('NumberOfTasksCloned', $num)); | 
                                                        
| 1817 | -		header("Refresh: 1;URL=".DOL_URL_ROOT.'/projet/tasks.php?id=' . GETPOSTINT('projectid')); | 
                                                        |
| 1817 | +		header("Refresh: 1;URL=".DOL_URL_ROOT.'/projet/tasks.php?id='.GETPOSTINT('projectid')); | 
                                                        |
| 1818 | 1818 | }  | 
                                                        
| 1819 | 1819 | }  | 
                                                        
| 1820 | 1820 | |