@@ -142,7 +142,7 @@ discard block  | 
                                                    ||
| 142 | 142 | |
| 143 | 143 |  if ($action == 'confirm_merge' && $confirm == 'yes' && $user->hasRight('projet', 'creer')) { | 
                                                        
| 144 | 144 |  	$task_origin_id = GETPOSTINT('task_origin'); | 
                                                        
| 145 | - $task_origin = new Task($db); // The Task that we will delete  | 
                                                        |
| 145 | + $task_origin = new Task($db); // The Task that we will delete  | 
                                                        |
| 146 | 146 | |
| 147 | 147 |  	if ($task_origin_id <= 0) { | 
                                                        
| 148 | 148 |  		$langs->load('errors'); | 
                                                        
@@ -258,7 +258,7 @@ discard block  | 
                                                    ||
| 258 | 258 | |
| 259 | 259 | $title = $object->ref;  | 
                                                        
| 260 | 260 |  if (!empty($withproject)) { | 
                                                        
| 261 | -	$title .= ' | ' . $langs->trans("Project") . (!empty($projectstatic->ref) ? ': '.$projectstatic->ref : '')  ; | 
                                                        |
| 261 | +	$title .= ' | '.$langs->trans("Project").(!empty($projectstatic->ref) ? ': '.$projectstatic->ref : ''); | 
                                                        |
| 262 | 262 | }  | 
                                                        
| 263 | 263 | $help_url = '';  | 
                                                        
| 264 | 264 | |
@@ -403,11 +403,11 @@ discard block  | 
                                                    ||
| 403 | 403 | $this->planned_workload = $obj->planned_workload;  | 
                                                        
| 404 | 404 | $this->date_c = $this->db->jdate($obj->datec);  | 
                                                        
| 405 | 405 | $this->date_start = $this->db->jdate($obj->date_start);  | 
                                                        
| 406 | - $this->date_end = $this->db->jdate($obj->date_end);  | 
                                                        |
| 406 | + $this->date_end = $this->db->jdate($obj->date_end);  | 
                                                        |
| 407 | 407 | $this->fk_user_creat = $obj->fk_user_creat;  | 
                                                        
| 408 | 408 | $this->fk_user_valid = $obj->fk_user_valid;  | 
                                                        
| 409 | 409 | $this->fk_statut = $obj->status;  | 
                                                        
| 410 | - $this->status = $obj->status;  | 
                                                        |
| 410 | + $this->status = $obj->status;  | 
                                                        |
| 411 | 411 | $this->progress = $obj->progress;  | 
                                                        
| 412 | 412 | $this->budget_amount = $obj->budget_amount;  | 
                                                        
| 413 | 413 | $this->priority = $obj->priority;  | 
                                                        
@@ -530,7 +530,7 @@ discard block  | 
                                                    ||
| 530 | 530 | * @param Task $task  | 
                                                        
| 531 | 531 | * @return bool  | 
                                                        
| 532 | 532 | */  | 
                                                        
| 533 | -						static function ($allTasksCompleted, $task) { | 
                                                        |
| 533 | +						static function($allTasksCompleted, $task) { | 
                                                        |
| 534 | 534 | return $allTasksCompleted && $task->progress >= 100;  | 
                                                        
| 535 | 535 | },  | 
                                                        
| 536 | 536 | 1  | 
                                                        
@@ -1154,9 +1154,9 @@ discard block  | 
                                                    ||
| 1154 | 1154 | $tasks[$i]->billed = $obj->billed;  | 
                                                        
| 1155 | 1155 | }  | 
                                                        
| 1156 | 1156 | |
| 1157 | - $tasks[$i]->progress = $obj->progress;  | 
                                                        |
| 1157 | + $tasks[$i]->progress = $obj->progress;  | 
                                                        |
| 1158 | 1158 | $tasks[$i]->fk_statut = $obj->status;  | 
                                                        
| 1159 | - $tasks[$i]->status = $obj->status;  | 
                                                        |
| 1159 | + $tasks[$i]->status = $obj->status;  | 
                                                        |
| 1160 | 1160 | $tasks[$i]->public = $obj->public;  | 
                                                        
| 1161 | 1161 | $tasks[$i]->date_start = $this->db->jdate($obj->date_start);  | 
                                                        
| 1162 | 1162 | $tasks[$i]->date_end = $this->db->jdate($obj->date_end);  | 
                                                        
@@ -1481,7 +1481,7 @@ discard block  | 
                                                    ||
| 1481 | 1481 | }  | 
                                                        
| 1482 | 1482 | |
| 1483 | 1483 | // Update hourly rate of this time spent entry  | 
                                                        
| 1484 | -			$resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); | 
                                                        |
| 1484 | +			$resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user)); | 
                                                        |
| 1485 | 1485 |  			if (!empty($resql_thm_user)) { | 
                                                        
| 1486 | 1486 | $obj_thm_user = $this->db->fetch_object($resql_thm_user);  | 
                                                        
| 1487 | 1487 | $timespent->thm = $obj_thm_user->thm;  | 
                                                        
@@ -1575,7 +1575,7 @@ discard block  | 
                                                    ||
| 1575 | 1575 | $newobj->timespent_line_withhour = $obj->task_date_withhour;  | 
                                                        
| 1576 | 1576 | $newobj->timespent_line_duration = $obj->task_duration;  | 
                                                        
| 1577 | 1577 | $newobj->timespent_line_fk_user = $obj->fk_user;  | 
                                                        
| 1578 | - $newobj->timespent_line_thm = $obj->thm; // hourly rate  | 
                                                        |
| 1578 | + $newobj->timespent_line_thm = $obj->thm; // hourly rate  | 
                                                        |
| 1579 | 1579 | $newobj->timespent_line_note = $obj->note;  | 
                                                        
| 1580 | 1580 | |
| 1581 | 1581 | $arrayres[] = $newobj;  | 
                                                        
@@ -1811,7 +1811,7 @@ discard block  | 
                                                    ||
| 1811 | 1811 | $newobj->timespent_withhour = $obj->task_date_withhour;  | 
                                                        
| 1812 | 1812 | $newobj->timespent_duration = $obj->task_duration;  | 
                                                        
| 1813 | 1813 | $newobj->timespent_fk_user = $obj->fk_user;  | 
                                                        
| 1814 | - $newobj->timespent_thm = $obj->thm; // hourly rate  | 
                                                        |
| 1814 | + $newobj->timespent_thm = $obj->thm; // hourly rate  | 
                                                        |
| 1815 | 1815 | $newobj->timespent_note = $obj->note;  | 
                                                        
| 1816 | 1816 | |
| 1817 | 1817 | $arrayres[] = $newobj;  | 
                                                        
@@ -1909,14 +1909,14 @@ discard block  | 
                                                    ||
| 1909 | 1909 |  		if ($ret == 1 && (($this->timespent_old_duration != $this->timespent_duration) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM'))) { | 
                                                        
| 1910 | 1910 |  			if ($this->timespent_old_duration != $this->timespent_duration) { | 
                                                        
| 1911 | 1911 | // Recalculate amount of time spent for task and update denormalized field  | 
                                                        
| 1912 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task";  | 
                                                        |
| 1913 | - $sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM " . MAIN_DB_PREFIX . "element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = " . ((int) $this->id) . ")";  | 
                                                        |
| 1912 | + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";  | 
                                                        |
| 1913 | + $sql .= " SET duration_effective = (SELECT SUM(element_duration) FROM ".MAIN_DB_PREFIX."element_time as ptt where ptt.elementtype = 'task' AND ptt.fk_element = ".((int) $this->id).")";  | 
                                                        |
| 1914 | 1914 |  				if (isset($this->progress)) { | 
                                                        
| 1915 | - $sql .= ", progress = " . ((float) $this->progress); // Do not overwrite value if not provided  | 
                                                        |
| 1915 | + $sql .= ", progress = ".((float) $this->progress); // Do not overwrite value if not provided  | 
                                                        |
| 1916 | 1916 | }  | 
                                                        
| 1917 | - $sql .= " WHERE rowid = " . ((int) $this->id);  | 
                                                        |
| 1917 | + $sql .= " WHERE rowid = ".((int) $this->id);  | 
                                                        |
| 1918 | 1918 | |
| 1919 | - dol_syslog(get_class($this) . "::updateTimeSpent", LOG_DEBUG);  | 
                                                        |
| 1919 | + dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG);  | 
                                                        |
| 1920 | 1920 |  				if (!$this->db->query($sql)) { | 
                                                        
| 1921 | 1921 | $this->error = $this->db->lasterror();  | 
                                                        
| 1922 | 1922 | $this->db->rollback();  | 
                                                        
@@ -1927,7 +1927,7 @@ discard block  | 
                                                    ||
| 1927 | 1927 | // Update hourly rate of this time spent entry, but only if it was not set initially  | 
                                                        
| 1928 | 1928 | $res_update = 1;  | 
                                                        
| 1929 | 1929 |  			if (empty($timespent->thm) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM')) { | 
                                                        
| 1930 | -				$resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); | 
                                                        |
| 1930 | +				$resql_thm_user = $this->db->query("SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".((int) $timespent->fk_user)); | 
                                                        |
| 1931 | 1931 |  				if (!empty($resql_thm_user)) { | 
                                                        
| 1932 | 1932 | $obj_thm_user = $this->db->fetch_object($resql_thm_user);  | 
                                                        
| 1933 | 1933 | $timespent->thm = $obj_thm_user->thm;  | 
                                                        
@@ -2064,8 +2064,8 @@ discard block  | 
                                                    ||
| 2064 | 2064 | |
| 2065 | 2065 | $defaultref = '';  | 
                                                        
| 2066 | 2066 |  		$obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; | 
                                                        
| 2067 | -		if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { | 
                                                        |
| 2068 | -			require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php'; | 
                                                        |
| 2067 | +		if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').".php")) { | 
                                                        |
| 2068 | +			require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".getDolGlobalString('PROJECT_TASK_ADDON').'.php'; | 
                                                        |
| 2069 | 2069 | $modTask = new $obj();  | 
                                                        
| 2070 | 2070 | $defaultref = $modTask->getNextValue(0, $clone_task);  | 
                                                        
| 2071 | 2071 | }  | 
                                                        
@@ -2113,7 +2113,7 @@ discard block  | 
                                                    ||
| 2113 | 2113 | }  | 
                                                        
| 2114 | 2114 | // End  | 
                                                        
| 2115 | 2115 |  		if ($error) { | 
                                                        
| 2116 | - $clone_task_id = 0; // For static tool check  | 
                                                        |
| 2116 | + $clone_task_id = 0; // For static tool check  | 
                                                        |
| 2117 | 2117 |  		} else { | 
                                                        
| 2118 | 2118 | $clone_task_id = $clone_task->id;  | 
                                                        
| 2119 | 2119 | $clone_task_ref = $clone_task->ref;  | 
                                                        
@@ -2562,7 +2562,7 @@ discard block  | 
                                                    ||
| 2562 | 2562 | global $conf, $langs, $hookmanager, $user, $action;  | 
                                                        
| 2563 | 2563 | |
| 2564 | 2564 | $error = 0;  | 
                                                        
| 2565 | - $task_origin = new Task($this->db); // The thirdparty that we will delete  | 
                                                        |
| 2565 | + $task_origin = new Task($this->db); // The thirdparty that we will delete  | 
                                                        |
| 2566 | 2566 | |
| 2567 | 2567 |  		dol_syslog("mergeTask merge task id=".$task_origin_id." (will be deleted) into the task id=".$this->id); | 
                                                        
| 2568 | 2568 | |
@@ -54,7 +54,7 @@ discard block  | 
                                                    ||
| 54 | 54 |  $type = GETPOSTINT('type'); | 
                                                        
| 55 | 55 |  $mode = GETPOST('mode', 'alpha'); | 
                                                        
| 56 | 56 | |
| 57 | -$ext=(GETPOSTISSET('output') && in_array(GETPOST('output'), array('csv'))) ? GETPOST('output') : ''; | 
                                                        |
| 57 | +$ext = (GETPOSTISSET('output') && in_array(GETPOST('output'), array('csv'))) ? GETPOST('output') : ''; | 
                                                        |
| 58 | 58 | |
| 59 | 59 | $date = '';  | 
                                                        
| 60 | 60 | $dateendofday = '';  | 
                                                        
@@ -156,7 +156,7 @@ discard block  | 
                                                    ||
| 156 | 156 |  	if ($productid > 0) { | 
                                                        
| 157 | 157 | $sql .= " AND ps.fk_product = ".((int) $productid);  | 
                                                        
| 158 | 158 | }  | 
                                                        
| 159 | -	if (! empty($search_fk_warehouse)) { | 
                                                        |
| 159 | +	if (!empty($search_fk_warehouse)) { | 
                                                        |
| 160 | 160 |  		$sql .= " AND ps.fk_entrepot IN (".$db->sanitize(implode(",", $search_fk_warehouse)).")"; | 
                                                        
| 161 | 161 | }  | 
                                                        
| 162 | 162 |  	if ($search_ref) { | 
                                                        
@@ -247,8 +247,8 @@ discard block  | 
                                                    ||
| 247 | 247 | $movements_prod_warehouse_nb[$fk_product][$fk_entrepot] = $nbofmovement;  | 
                                                        
| 248 | 248 | |
| 249 | 249 | // Pour llx_product.stock  | 
                                                        
| 250 | - $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod)?$movements_prod[$fk_product]:0);  | 
                                                        |
| 251 | - $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb)?$movements_prod_nb[$fk_product]:0);  | 
                                                        |
| 250 | + $movements_prod[$fk_product] = $stock + (array_key_exists($fk_product, $movements_prod) ? $movements_prod[$fk_product] : 0);  | 
                                                        |
| 251 | + $movements_prod_nb[$fk_product] = $nbofmovement + (array_key_exists($fk_product, $movements_prod_nb) ? $movements_prod_nb[$fk_product] : 0);  | 
                                                        |
| 252 | 252 | |
| 253 | 253 | $i++;  | 
                                                        
| 254 | 254 | }  | 
                                                        
@@ -367,12 +367,11 @@ discard block  | 
                                                    ||
| 367 | 367 | // TODO Move this action into a separated files: We should not mix output with MIME type HTML and MIME type CSV in the same file.  | 
                                                        
| 368 | 368 |  if ($ext == 'csv') { | 
                                                        
| 369 | 369 |  	header("Content-Type: text/csv"); | 
                                                        
| 370 | -	header("Content-Disposition: attachment; filename=stock".($date?'-'.date("Y-m-d", $date):'').".csv"); | 
                                                        |
| 370 | +	header("Content-Disposition: attachment; filename=stock".($date ? '-'.date("Y-m-d", $date) : '').".csv"); | 
                                                        |
| 371 | 371 | |
| 372 | 372 | // Lines of title  | 
                                                        
| 373 | -	print implode("\t", ($mode == 'future')? | 
                                                        |
| 374 | -		array('"Product Reference"', '"Label"', '"Current Stock"', '"'.$stocklabel.'"', '"Virtual Stock"'): | 
                                                        |
| 375 | -		array('"Product Reference"', '"Label"', '"'.$stocklabel.'"', '"Estimated Stock Value"', '"Estimate Sell Value"', '"Movements"', '"Current Stock"'))."\r\n"; | 
                                                        |
| 373 | +	print implode("\t", ($mode == 'future') ? | 
                                                        |
| 374 | +		array('"Product Reference"', '"Label"', '"Current Stock"', '"'.$stocklabel.'"', '"Virtual Stock"') : array('"Product Reference"', '"Label"', '"'.$stocklabel.'"', '"Estimated Stock Value"', '"Estimate Sell Value"', '"Movements"', '"Current Stock"'))."\r\n"; | 
                                                        |
| 376 | 375 |  } else { | 
                                                        
| 377 | 376 |  	llxHeader('', $title, $helpurl, ''); | 
                                                        
| 378 | 377 | |
@@ -468,13 +467,13 @@ discard block  | 
                                                    ||
| 468 | 467 | print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table  | 
                                                        
| 469 | 468 |  	if ($num) { | 
                                                        
| 470 | 469 | print "<p><a href=\"stockatdate.php?output=csv&sortfield=$sortfield&sortorder=$sortorder&type=$type&mode=$mode".  | 
                                                        
| 471 | - (isset($productid)?"&productid=$productid":'').  | 
                                                        |
| 470 | + (isset($productid) ? "&productid=$productid" : '').  | 
                                                        |
| 472 | 471 | $param_warehouse.  | 
                                                        
| 473 | 472 | "&search_ref=".dol_escape_htmltag($search_ref).  | 
                                                        
| 474 | 473 | "&search_nom=".dol_escape_htmltag($search_nom).  | 
                                                        
| 475 | -			(GETPOSTISSET('dateday')?"&dateday=".GETPOSTINT('dateday'):''). | 
                                                        |
| 476 | -			(GETPOSTISSET('datemonth')?"&datemonth=".GETPOSTINT('datemonth'):''). | 
                                                        |
| 477 | -			(GETPOSTISSET('dateyear')?"&dateyear=".GETPOSTINT('dateyear'):''). | 
                                                        |
| 474 | +			(GETPOSTISSET('dateday') ? "&dateday=".GETPOSTINT('dateday') : ''). | 
                                                        |
| 475 | +			(GETPOSTISSET('datemonth') ? "&datemonth=".GETPOSTINT('datemonth') : ''). | 
                                                        |
| 476 | +			(GETPOSTISSET('dateyear') ? "&dateyear=".GETPOSTINT('dateyear') : ''). | 
                                                        |
| 478 | 477 | "\" title=\"Download CSV\" />Download CSV</a></p>";  | 
                                                        
| 479 | 478 | }  | 
                                                        
| 480 | 479 | print '<table class="liste centpercent">';  | 
                                                        
@@ -594,9 +593,9 @@ discard block  | 
                                                    ||
| 594 | 593 | |
| 595 | 594 |  		if ($mode == 'future') { | 
                                                        
| 596 | 595 |  			$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday); | 
                                                        
| 597 | - $stock = $prod->stock_theorique; // virtual stock at a date  | 
                                                        |
| 596 | + $stock = $prod->stock_theorique; // virtual stock at a date  | 
                                                        |
| 598 | 597 |  			$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0); | 
                                                        
| 599 | - $virtualstock = $prod->stock_theorique; // virtual stock in infinite future  | 
                                                        |
| 598 | + $virtualstock = $prod->stock_theorique; // virtual stock in infinite future  | 
                                                        |
| 600 | 599 |  		} else { | 
                                                        
| 601 | 600 | $stock = $currentstock;  | 
                                                        
| 602 | 601 | $nbofmovement = 0;  | 
                                                        
@@ -626,8 +625,8 @@ discard block  | 
                                                    ||
| 626 | 625 | '"'.$objp->ref.'"',  | 
                                                        
| 627 | 626 | '"'.$objp->label.'"',  | 
                                                        
| 628 | 627 | '"'.price(price2num($stock, 'MS')).'"',  | 
                                                        
| 629 | - price2num($stock * $objp->pmp, 'MT')?'"'.price(price2num($stock * $objp->pmp, 'MT'), 1).'"':'',  | 
                                                        |
| 630 | -					empty($conf->global->PRODUIT_MULTIPRICES)?'"'.price(price2num($stock * $objp->price, 'MT'), 1).'"':'"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"', | 
                                                        |
| 628 | + price2num($stock * $objp->pmp, 'MT') ? '"'.price(price2num($stock * $objp->pmp, 'MT'), 1).'"' : '',  | 
                                                        |
| 629 | +					empty($conf->global->PRODUIT_MULTIPRICES) ? '"'.price(price2num($stock * $objp->price, 'MT'), 1).'"' : '"'.$langs->trans("Variable").'('.$langs->trans("OptionMULTIPRICESIsOn").')"', | 
                                                        |
| 631 | 630 | "$nbofmovement",  | 
                                                        
| 632 | 631 | '"'.price(price2num($currentstock, 'MS')).'"'))."\r\n";  | 
                                                        
| 633 | 632 | $totalbuyingprice += $stock * $objp->pmp;  | 
                                                        
@@ -720,7 +719,7 @@ discard block  | 
                                                    ||
| 720 | 719 | |
| 721 | 720 |  $parameters = array('sql'=>$sql); | 
                                                        
| 722 | 721 |  $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook | 
                                                        
| 723 | -if ($ext!='csv') { | 
                                                        |
| 722 | +if ($ext != 'csv') { | 
                                                        |
| 724 | 723 | print $hookmanager->resPrint;  | 
                                                        
| 725 | 724 | }  | 
                                                        
| 726 | 725 | |
@@ -729,20 +728,19 @@ discard block  | 
                                                    ||
| 729 | 728 | $colspan++;  | 
                                                        
| 730 | 729 | }  | 
                                                        
| 731 | 730 | |
| 732 | -if ($ext=='csv') { | 
                                                        |
| 731 | +if ($ext == 'csv') { | 
                                                        |
| 733 | 732 |  	print implode("\t", | 
                                                        
| 734 | - ($mode == 'future')?array(  | 
                                                        |
| 733 | + ($mode == 'future') ? array(  | 
                                                        |
| 735 | 734 |  		'"'.$langs->trans("Totalforthispage").'"', | 
                                                        
| 736 | 735 | '',  | 
                                                        
| 737 | 736 | $productid > 0 ? price(price2num($totalcurrentstock, 'MS')) : '',  | 
                                                        
| 738 | 737 | '',  | 
                                                        
| 739 | - price(price2num($totalvirtualstock, 'MS'))):  | 
                                                        |
| 740 | - array(  | 
                                                        |
| 738 | + price(price2num($totalvirtualstock, 'MS'))) : array(  | 
                                                        |
| 741 | 739 |  		'"'.$langs->trans("Totalforthispage").'"', | 
                                                        
| 742 | 740 | '',  | 
                                                        
| 743 | 741 | '',  | 
                                                        
| 744 | 742 | '"'.price(price2num($totalbuyingprice, 'MT')).'"',  | 
                                                        
| 745 | -		!getDolGlobalString('PRODUIT_MULTIPRICES')?'"'.price(price2num($totalsellingprice, 'MT')).'"':'', | 
                                                        |
| 743 | +		!getDolGlobalString('PRODUIT_MULTIPRICES') ? '"'.price(price2num($totalsellingprice, 'MT')).'"' : '', | 
                                                        |
| 746 | 744 | '',  | 
                                                        
| 747 | 745 | $productid > 0 ? price(price2num($totalcurrentstock, 'MS')) : ''));  | 
                                                        
| 748 | 746 |  } else { | 
                                                        
@@ -34,17 +34,17 @@ discard block  | 
                                                    ||
| 34 | 34 | |
| 35 | 35 | // Load Dolibarr environment  | 
                                                        
| 36 | 36 | require '../../main.inc.php';  | 
                                                        
| 37 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php';  | 
                                                        |
| 38 | -require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';  | 
                                                        |
| 39 | -require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 40 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';  | 
                                                        |
| 37 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php';  | 
                                                        |
| 38 | +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';  | 
                                                        |
| 39 | +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 40 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';  | 
                                                        |
| 41 | 41 |  if (isModEnabled('project')) { | 
                                                        
| 42 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 42 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 43 | 43 | }  | 
                                                        
| 44 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 45 | -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';  | 
                                                        |
| 46 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';  | 
                                                        |
| 47 | -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';  | 
                                                        |
| 44 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 45 | +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';  | 
                                                        |
| 46 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';  | 
                                                        |
| 47 | +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';  | 
                                                        |
| 48 | 48 | |
| 49 | 49 | // Load translation files required by the page  | 
                                                        
| 50 | 50 |  $langs->loadLangs(array('bills', 'companies', 'compta', 'admin', 'other', 'products', 'banks', 'suppliers')); | 
                                                        
@@ -85,10 +85,10 @@ discard block  | 
                                                    ||
| 85 | 85 | $page = 0;  | 
                                                        
| 86 | 86 | } // If $page is not defined, or '' or -1  | 
                                                        
| 87 | 87 | $offset = $limit * $page;  | 
                                                        
| 88 | -if (! $sortorder) { | 
                                                        |
| 88 | +if (!$sortorder) { | 
                                                        |
| 89 | 89 | $sortorder = 'DESC';  | 
                                                        
| 90 | 90 | }  | 
                                                        
| 91 | -if (! $sortfield) { | 
                                                        |
| 91 | +if (!$sortfield) { | 
                                                        |
| 92 | 92 | $sortfield = 'f.titre';  | 
                                                        
| 93 | 93 | }  | 
                                                        
| 94 | 94 | $pageprev = $page - 1;  | 
                                                        
@@ -97,7 +97,7 @@ discard block  | 
                                                    ||
| 97 | 97 | $object = new FactureFournisseurRec($db);  | 
                                                        
| 98 | 98 |  if (($id > 0 || $title) && $action != 'create' && $action != 'add') { | 
                                                        
| 99 | 99 | $ret = $object->fetch($id, $title);  | 
                                                        
| 100 | -	if (! $ret) { | 
                                                        |
| 100 | +	if (!$ret) { | 
                                                        |
| 101 | 101 |  		setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors'); | 
                                                        
| 102 | 102 | }  | 
                                                        
| 103 | 103 | }  | 
                                                        
@@ -141,7 +141,7 @@ discard block  | 
                                                    ||
| 141 | 141 | $action = 'list';  | 
                                                        
| 142 | 142 | $massaction = '';  | 
                                                        
| 143 | 143 | }  | 
                                                        
| 144 | -if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { | 
                                                        |
| 144 | +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { | 
                                                        |
| 145 | 145 | $massaction = '';  | 
                                                        
| 146 | 146 | }  | 
                                                        
| 147 | 147 | |
@@ -157,18 +157,18 @@ discard block  | 
                                                    ||
| 157 | 157 | }  | 
                                                        
| 158 | 158 | |
| 159 | 159 | // Selection of new fields  | 
                                                        
| 160 | - include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';  | 
                                                        |
| 160 | + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';  | 
                                                        |
| 161 | 161 | |
| 162 | 162 | // Set note  | 
                                                        
| 163 | - include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once  | 
                                                        |
| 163 | + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once  | 
                                                        |
| 164 | 164 | |
| 165 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be include, not include_once  | 
                                                        |
| 165 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once  | 
                                                        |
| 166 | 166 | |
| 167 | - include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be include, not include_once  | 
                                                        |
| 167 | + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once  | 
                                                        |
| 168 | 168 | |
| 169 | 169 | // Create predefined invoice  | 
                                                        
| 170 | 170 |  	if ($action == 'add') { | 
                                                        
| 171 | -		if (! GETPOST('title', 'alphanohtml')) { | 
                                                        |
| 171 | +		if (!GETPOST('title', 'alphanohtml')) { | 
                                                        |
| 172 | 172 |  			setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); | 
                                                        
| 173 | 173 | $action = "create";  | 
                                                        
| 174 | 174 | $error++;  | 
                                                        
@@ -191,10 +191,10 @@ discard block  | 
                                                    ||
| 191 | 191 | }  | 
                                                        
| 192 | 192 | }  | 
                                                        
| 193 | 193 | |
| 194 | -		if (! $error) { | 
                                                        |
| 194 | +		if (!$error) { | 
                                                        |
| 195 | 195 |  			$object->subtype               = GETPOSTINT('subtype'); | 
                                                        
| 196 | 196 |  			$object->title                 = GETPOST('title', 'alphanohtml'); | 
                                                        
| 197 | -			$object->libelle               = GETPOST('libelle', 'alpha');	// deprecated | 
                                                        |
| 197 | +			$object->libelle               = GETPOST('libelle', 'alpha'); // deprecated | 
                                                        |
| 198 | 198 |  			$object->label                 = GETPOST('libelle', 'alpha'); | 
                                                        
| 199 | 199 |  			$object->fk_project            = GETPOSTINT('projectid'); | 
                                                        
| 200 | 200 |  			$object->ref_supplier          = GETPOST('ref_supplier', 'alphanohtml'); | 
                                                        
@@ -240,10 +240,10 @@ discard block  | 
                                                    ||
| 240 | 240 | $action = "create";  | 
                                                        
| 241 | 241 | }  | 
                                                        
| 242 | 242 | |
| 243 | -			if (! $error) { | 
                                                        |
| 243 | +			if (!$error) { | 
                                                        |
| 244 | 244 | $db->commit();  | 
                                                        
| 245 | 245 | |
| 246 | -				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id); | 
                                                        |
| 246 | +				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); | 
                                                        |
| 247 | 247 | exit;  | 
                                                        
| 248 | 248 |  			} else { | 
                                                        
| 249 | 249 | $db->rollback();  | 
                                                        
@@ -260,7 +260,7 @@ discard block  | 
                                                    ||
| 260 | 260 |  	if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && ($user->hasRight("fournisseur", "facture", "supprimer") || $user->hasRight("supplier_invoice", "supprimer"))) { | 
                                                        
| 261 | 261 | $object->delete($user);  | 
                                                        
| 262 | 262 | |
| 263 | -		header('Location: ' . DOL_URL_ROOT . '/fourn/facture/list-rec.php'); | 
                                                        |
| 263 | +		header('Location: '.DOL_URL_ROOT.'/fourn/facture/list-rec.php'); | 
                                                        |
| 264 | 264 | exit;  | 
                                                        
| 265 | 265 | }  | 
                                                        
| 266 | 266 | |
@@ -290,7 +290,7 @@ discard block  | 
                                                    ||
| 290 | 290 |  		$result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user); | 
                                                        
| 291 | 291 | |
| 292 | 292 |  		if ($result > 0) { | 
                                                        
| 293 | - $object->titre = $title; // deprecated  | 
                                                        |
| 293 | + $object->titre = $title; // deprecated  | 
                                                        |
| 294 | 294 | $object->title = $title;  | 
                                                        
| 295 | 295 | $object->ref = $object->title;  | 
                                                        
| 296 | 296 |  		} else { | 
                                                        
@@ -337,7 +337,7 @@ discard block  | 
                                                    ||
| 337 | 337 | $error++;  | 
                                                        
| 338 | 338 | }  | 
                                                        
| 339 | 339 | |
| 340 | -		if (! $error) { | 
                                                        |
| 340 | +		if (!$error) { | 
                                                        |
| 341 | 341 | $db->commit();  | 
                                                        
| 342 | 342 |  		} else { | 
                                                        
| 343 | 343 | $db->rollback();  | 
                                                        
@@ -354,7 +354,7 @@ discard block  | 
                                                    ||
| 354 | 354 | $error++;  | 
                                                        
| 355 | 355 | }  | 
                                                        
| 356 | 356 | |
| 357 | -		if (! $error) { | 
                                                        |
| 357 | +		if (!$error) { | 
                                                        |
| 358 | 358 | $db->commit();  | 
                                                        
| 359 | 359 |  		} else { | 
                                                        
| 360 | 360 | $db->rollback();  | 
                                                        
@@ -413,7 +413,7 @@ discard block  | 
                                                    ||
| 413 | 413 | $error++;  | 
                                                        
| 414 | 414 | }  | 
                                                        
| 415 | 415 | |
| 416 | -		if (! $error) { | 
                                                        |
| 416 | +		if (!$error) { | 
                                                        |
| 417 | 417 |  			$result = $object->insertExtraFields('BILLREC_MODIFY'); | 
                                                        
| 418 | 418 |  			if ($result < 0) { | 
                                                        
| 419 | 419 | setEventMessages($object->error, $object->errors, 'errors');  | 
                                                        
@@ -442,8 +442,8 @@ discard block  | 
                                                    ||
| 442 | 442 | $tva_tx = '';  | 
                                                        
| 443 | 443 | }  | 
                                                        
| 444 | 444 | |
| 445 | -		$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2); | 
                                                        |
| 446 | -		$remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2); | 
                                                        |
| 445 | +		$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); | 
                                                        |
| 446 | +		$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2); | 
                                                        |
| 447 | 447 | |
| 448 | 448 | // Extrafields  | 
                                                        
| 449 | 449 | $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);  | 
                                                        
@@ -452,7 +452,7 @@ discard block  | 
                                                    ||
| 452 | 452 |  		if (is_array($extralabelsline)) { | 
                                                        
| 453 | 453 | // Get extra fields  | 
                                                        
| 454 | 454 |  			foreach ($extralabelsline as $key => $value) { | 
                                                        
| 455 | - unset($_POST["options_" . $key . $predef]);  | 
                                                        |
| 455 | + unset($_POST["options_".$key.$predef]);  | 
                                                        |
| 456 | 456 | }  | 
                                                        
| 457 | 457 | }  | 
                                                        
| 458 | 458 | |
@@ -464,7 +464,7 @@ discard block  | 
                                                    ||
| 464 | 464 |  			setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); | 
                                                        
| 465 | 465 | $error++;  | 
                                                        
| 466 | 466 | }  | 
                                                        
| 467 | -		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not '' | 
                                                        |
| 467 | +		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not '' | 
                                                        |
| 468 | 468 |  			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); | 
                                                        
| 469 | 469 | $error++;  | 
                                                        
| 470 | 470 | }  | 
                                                        
@@ -513,7 +513,7 @@ discard block  | 
                                                    ||
| 513 | 513 | }  | 
                                                        
| 514 | 514 | }  | 
                                                        
| 515 | 515 | |
| 516 | -		if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { | 
                                                        |
| 516 | +		if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { | 
                                                        |
| 517 | 517 | $ret = $object->fetch($id);  | 
                                                        
| 518 | 518 |  			if ($ret < 0) { | 
                                                        
| 519 | 519 | dol_print_error($db, $object->error);  | 
                                                        
@@ -522,8 +522,8 @@ discard block  | 
                                                    ||
| 522 | 522 | $ret = $object->fetch_thirdparty();  | 
                                                        
| 523 | 523 | |
| 524 | 524 | // Clean parameters  | 
                                                        
| 525 | -			$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year')); | 
                                                        |
| 526 | -			$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year')); | 
                                                        |
| 525 | +			$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year')); | 
                                                        |
| 526 | +			$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); | 
                                                        |
| 527 | 527 |  			$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); | 
                                                        
| 528 | 528 | |
| 529 | 529 | // Define special_code for special lines  | 
                                                        
@@ -620,23 +620,23 @@ discard block  | 
                                                    ||
| 620 | 620 |  							$outputlangs->load('products'); | 
                                                        
| 621 | 621 | }  | 
                                                        
| 622 | 622 |  						if (!empty($prod->customcode)) { | 
                                                        
| 623 | -							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; | 
                                                        |
| 623 | +							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; | 
                                                        |
| 624 | 624 | }  | 
                                                        
| 625 | 625 |  						if (!empty($prod->customcode) && !empty($prod->country_code)) { | 
                                                        
| 626 | 626 | $tmptxt .= ' - ';  | 
                                                        
| 627 | 627 | }  | 
                                                        
| 628 | 628 |  						if (!empty($prod->country_code)) { | 
                                                        
| 629 | -							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0); | 
                                                        |
| 629 | +							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $outputlangs, 0); | 
                                                        |
| 630 | 630 | }  | 
                                                        
| 631 | 631 |  					} else { | 
                                                        
| 632 | 632 |  						if (!empty($prod->customcode)) { | 
                                                        
| 633 | -							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; | 
                                                        |
| 633 | +							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode; | 
                                                        |
| 634 | 634 | }  | 
                                                        
| 635 | 635 |  						if (!empty($prod->customcode) && !empty($prod->country_code)) { | 
                                                        
| 636 | 636 | $tmptxt .= ' - ';  | 
                                                        
| 637 | 637 | }  | 
                                                        
| 638 | 638 |  						if (!empty($prod->country_code)) { | 
                                                        
| 639 | -							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0); | 
                                                        |
| 639 | +							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $langs, 0); | 
                                                        |
| 640 | 640 | }  | 
                                                        
| 641 | 641 | }  | 
                                                        
| 642 | 642 | $tmptxt .= ')';  | 
                                                        
@@ -662,8 +662,8 @@ discard block  | 
                                                    ||
| 662 | 662 |  			$date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : null; | 
                                                        
| 663 | 663 | |
| 664 | 664 | // Margin  | 
                                                        
| 665 | -			$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : ''); | 
                                                        |
| 666 | -			$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value | 
                                                        |
| 665 | +			$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); | 
                                                        |
| 666 | +			$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value | 
                                                        |
| 667 | 667 | |
| 668 | 668 | // Local Taxes  | 
                                                        
| 669 | 669 | $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);  | 
                                                        
@@ -729,8 +729,8 @@ discard block  | 
                                                    ||
| 729 | 729 | $action = '';  | 
                                                        
| 730 | 730 | }  | 
                                                        
| 731 | 731 | }  | 
                                                        
| 732 | -	} elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) { | 
                                                        |
| 733 | -		if (! $object->fetch($id) > 0) { | 
                                                        |
| 732 | +	} elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) { | 
                                                        |
| 733 | +		if (!$object->fetch($id) > 0) { | 
                                                        |
| 734 | 734 | dol_print_error($db);  | 
                                                        
| 735 | 735 | }  | 
                                                        
| 736 | 736 | $object->fetch_thirdparty();  | 
                                                        
@@ -765,7 +765,7 @@ discard block  | 
                                                    ||
| 765 | 765 | $objectline->array_options = $array_options;  | 
                                                        
| 766 | 766 | $result = $objectline->insertExtraFields();  | 
                                                        
| 767 | 767 |  			if ($result < 0) { | 
                                                        
| 768 | -				setEventMessages($langs->trans('Error') . $result, null, 'errors'); | 
                                                        |
| 768 | +				setEventMessages($langs->trans('Error').$result, null, 'errors'); | 
                                                        |
| 769 | 769 | }  | 
                                                        
| 770 | 770 | }  | 
                                                        
| 771 | 771 | |
@@ -775,13 +775,13 @@ discard block  | 
                                                    ||
| 775 | 775 |  		if (is_array($extralabelsline)) { | 
                                                        
| 776 | 776 | // Get extra fields  | 
                                                        
| 777 | 777 |  			foreach ($extralabelsline as $key => $value) { | 
                                                        
| 778 | - unset($_POST["options_" . $key]);  | 
                                                        |
| 778 | + unset($_POST["options_".$key]);  | 
                                                        |
| 779 | 779 | }  | 
                                                        
| 780 | 780 | }  | 
                                                        
| 781 | 781 | |
| 782 | 782 | // Define special_code for special lines  | 
                                                        
| 783 | 783 |  		$special_code = GETPOSTINT('special_code'); | 
                                                        
| 784 | -		if (! GETPOST('qty', 'alpha')) { | 
                                                        |
| 784 | +		if (!GETPOST('qty', 'alpha')) { | 
                                                        |
| 785 | 785 | $special_code = 3;  | 
                                                        
| 786 | 786 | }  | 
                                                        
| 787 | 787 | |
@@ -827,7 +827,7 @@ discard block  | 
                                                    ||
| 827 | 827 |  		$date_end_fill = !empty(GETPOSTINT('date_end_fill')) ? GETPOSTINT('date_end_fill') : 'NULL'; | 
                                                        
| 828 | 828 | |
| 829 | 829 | // Update line  | 
                                                        
| 830 | -		if (! $error) { | 
                                                        |
| 830 | +		if (!$error) { | 
                                                        |
| 831 | 831 |  			$result = $object->updateline(GETPOSTINT('lineid'), GETPOSTINT('productid'), $ref_fourn, $label, $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1); | 
                                                        
| 832 | 832 |  			if ($result >= 0) { | 
                                                        
| 833 | 833 | $object->fetch($object->id); // Reload lines  | 
                                                        
@@ -901,10 +901,10 @@ discard block  | 
                                                    ||
| 901 | 901 |  	if ($object->fetch($id) > 0) { | 
                                                        
| 902 | 902 | $result = $object->fetch_lines();  | 
                                                        
| 903 | 903 | |
| 904 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';  | 
                                                        |
| 905 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 904 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';  | 
                                                        |
| 905 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 906 | 906 | print '<input type="hidden" name="action" value="add">';  | 
                                                        
| 907 | - print '<input type="hidden" name="facid" value="' . $object->id . '">';  | 
                                                        |
| 907 | + print '<input type="hidden" name="facid" value="'.$object->id.'">';  | 
                                                        |
| 908 | 908 | |
| 909 | 909 | print dol_get_fiche_head(null, '', '', 0);  | 
                                                        
| 910 | 910 | |
@@ -921,17 +921,17 @@ discard block  | 
                                                    ||
| 921 | 921 | $object->fetch_thirdparty();  | 
                                                        
| 922 | 922 | |
| 923 | 923 | // Title  | 
                                                        
| 924 | -		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Title") . '</td><td>'; | 
                                                        |
| 925 | -		print '<input class="flat quatrevingtpercent" type="text" name="title" value="' . dol_escape_htmltag(GETPOST("title", 'alphanohtml')) . '" autofocus>'; | 
                                                        |
| 924 | +		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>'; | 
                                                        |
| 925 | +		print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>'; | 
                                                        |
| 926 | 926 | print '</td></tr>';  | 
                                                        
| 927 | 927 | |
| 928 | 928 | // Ref supplier  | 
                                                        
| 929 | -		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("RefSupplier") . '</td><td>'; | 
                                                        |
| 930 | - print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="' . $object->ref_supplier . '">';  | 
                                                        |
| 929 | +		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("RefSupplier").'</td><td>'; | 
                                                        |
| 930 | + print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="'.$object->ref_supplier.'">';  | 
                                                        |
| 931 | 931 | print '</td></tr>';  | 
                                                        
| 932 | 932 | |
| 933 | 933 | // Third party  | 
                                                        
| 934 | -		print '<tr><td class="titlefieldcreate">' . $langs->trans("Customer") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'customer') . '</td>'; | 
                                                        |
| 934 | +		print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>'; | 
                                                        |
| 935 | 935 | print '</tr>';  | 
                                                        
| 936 | 936 | |
| 937 | 937 | // Invoice subtype  | 
                                                        
@@ -947,42 +947,42 @@ discard block  | 
                                                    ||
| 947 | 947 | // Help of substitution key  | 
                                                        
| 948 | 948 | $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);  | 
                                                        
| 949 | 949 | |
| 950 | -		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')'; | 
                                                        |
| 951 | -		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%m') . ')'; | 
                                                        |
| 952 | -		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m') . ')'; | 
                                                        |
| 953 | -		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B') . ')'; | 
                                                        |
| 954 | -		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%B') . ')'; | 
                                                        |
| 955 | -		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B') . ')'; | 
                                                        |
| 956 | -		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y') . ')'; | 
                                                        |
| 957 | -		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%Y') . ')'; | 
                                                        |
| 958 | -		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y') . ')'; | 
                                                        |
| 950 | +		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')'; | 
                                                        |
| 951 | +		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')'; | 
                                                        |
| 952 | +		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')'; | 
                                                        |
| 953 | +		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')'; | 
                                                        |
| 954 | +		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')'; | 
                                                        |
| 955 | +		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')'; | 
                                                        |
| 956 | +		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')'; | 
                                                        |
| 957 | +		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')'; | 
                                                        |
| 958 | +		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')'; | 
                                                        |
| 959 | 959 | // Only on template invoices  | 
                                                        
| 960 | -		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . (isset($object->date_when) ? ' (' . $langs->trans("Example") . ': ' .dol_print_date($object->date_when, 'dayhour') . ')' : ''); | 
                                                        |
| 961 | -		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . (isset($object->date_when) ? ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour') . ')' : ''); | 
                                                        |
| 960 | +		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')' : ''); | 
                                                        |
| 961 | +		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')' : ''); | 
                                                        |
| 962 | 962 |  		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count"); | 
                                                        
| 963 | 963 |  		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber"); | 
                                                        
| 964 | 964 | |
| 965 | -		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>'; | 
                                                        |
| 965 | +		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; | 
                                                        |
| 966 | 966 |  		foreach ($substitutionarray as $key => $val) { | 
                                                        
| 967 | - $htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';  | 
                                                        |
| 967 | + $htmltext .= $key.' = '.$langs->trans($val).'<br>';  | 
                                                        |
| 968 | 968 | }  | 
                                                        
| 969 | 969 | $htmltext .= '</i>';  | 
                                                        
| 970 | 970 | |
| 971 | 971 | // Label  | 
                                                        
| 972 | -		print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>'; | 
                                                        |
| 973 | - print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">';  | 
                                                        |
| 972 | +		print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td>'; | 
                                                        |
| 973 | + print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="'.$object->label.'">';  | 
                                                        |
| 974 | 974 | print '</td></tr>';  | 
                                                        
| 975 | 975 | |
| 976 | 976 | // Author  | 
                                                        
| 977 | -		print "<tr><td>" . $langs->trans("Author") . "</td><td>" . $user->getFullName($langs) . "</td></tr>"; | 
                                                        |
| 977 | +		print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>"; | 
                                                        |
| 978 | 978 | |
| 979 | 979 | // Payment term  | 
                                                        
| 980 | -		print "<tr><td>" . $langs->trans("PaymentConditions") . "</td><td>"; | 
                                                        |
| 980 | +		print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>"; | 
                                                        |
| 981 | 981 |  		print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, ''); | 
                                                        
| 982 | 982 | print "</td></tr>";  | 
                                                        
| 983 | 983 | |
| 984 | 984 | // Payment mode  | 
                                                        
| 985 | -		print "<tr><td>" . $langs->trans("PaymentMode") . "</td><td>"; | 
                                                        |
| 985 | +		print "<tr><td>".$langs->trans("PaymentMode")."</td><td>"; | 
                                                        |
| 986 | 986 |  		print img_picto('', 'payment', 'class="pictofixedwidth"'); | 
                                                        
| 987 | 987 |  		print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1); | 
                                                        
| 988 | 988 | print "</td></tr>";  | 
                                                        
@@ -991,16 +991,16 @@ discard block  | 
                                                    ||
| 991 | 991 |  		if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) { | 
                                                        
| 992 | 992 |  			$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project; | 
                                                        
| 993 | 993 |  			$langs->load('projects'); | 
                                                        
| 994 | -			print '<tr><td>' . $langs->trans('Project') . '</td><td>'; | 
                                                        |
| 994 | +			print '<tr><td>'.$langs->trans('Project').'</td><td>'; | 
                                                        |
| 995 | 995 | $numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');  | 
                                                        
| 996 | -			print '   <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $object->thirdparty->id . (!empty($id) ? '&id=' . $id : '')) . '">' . $langs->trans("AddProject") . '</a>'; | 
                                                        |
| 996 | +			print '   <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>'; | 
                                                        |
| 997 | 997 | print '</td></tr>';  | 
                                                        
| 998 | 998 | }  | 
                                                        
| 999 | 999 | |
| 1000 | 1000 | // Bank account  | 
                                                        
| 1001 | 1001 |  		if ($object->fk_account > 0) { | 
                                                        
| 1002 | -			print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>"; | 
                                                        |
| 1003 | - $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');  | 
                                                        |
| 1002 | +			print "<tr><td>".$langs->trans('BankAccount')."</td><td>"; | 
                                                        |
| 1003 | + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');  | 
                                                        |
| 1004 | 1004 | print "</td></tr>";  | 
                                                        
| 1005 | 1005 | }  | 
                                                        
| 1006 | 1006 | |
@@ -1017,8 +1017,8 @@ discard block  | 
                                                    ||
| 1017 | 1017 | print $object->showOptionals($extrafields, 'create', $parameters);  | 
                                                        
| 1018 | 1018 | |
| 1019 | 1019 | // Model pdf  | 
                                                        
| 1020 | -		print "<tr><td>" . $langs->trans('Model') . "</td><td>"; | 
                                                        |
| 1021 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';  | 
                                                        |
| 1020 | +		print "<tr><td>".$langs->trans('Model')."</td><td>"; | 
                                                        |
| 1021 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';  | 
                                                        |
| 1022 | 1022 | $list = ModelePDFSuppliersInvoices::liste_modeles($db);  | 
                                                        
| 1023 | 1023 |  		print $form->selectarray('modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF); | 
                                                        
| 1024 | 1024 | print "</td></tr>";  | 
                                                        
@@ -1050,7 +1050,7 @@ discard block  | 
                                                    ||
| 1050 | 1050 | |
| 1051 | 1051 | // Autogeneration  | 
                                                        
| 1052 | 1052 |  		$title = $langs->trans("Recurrence"); | 
                                                        
| 1053 | -		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', ''); | 
                                                        |
| 1053 | +		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', ''); | 
                                                        |
| 1054 | 1054 | |
| 1055 | 1055 |  		print '<span class="opacitymedium">'.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'</span><br><br>'; | 
                                                        
| 1056 | 1056 | |
@@ -1059,30 +1059,30 @@ discard block  | 
                                                    ||
| 1059 | 1059 | print '<table class="border centpercent">';  | 
                                                        
| 1060 | 1060 | |
| 1061 | 1061 | // Frequency + unit  | 
                                                        
| 1062 | -		print '<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')) . "</td><td>"; | 
                                                        |
| 1063 | -		print "<input type='text' name='frequency' value='" . GETPOSTINT('frequency') . "' size='4' /> " . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm')); | 
                                                        |
| 1062 | +		print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>"; | 
                                                        |
| 1063 | +		print "<input type='text' name='frequency' value='".GETPOSTINT('frequency')."' size='4' /> ".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm')); | 
                                                        |
| 1064 | 1064 | print "</td></tr>";  | 
                                                        
| 1065 | 1065 | |
| 1066 | 1066 | // Date next run  | 
                                                        
| 1067 | -		print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>"; | 
                                                        |
| 1067 | +		print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>"; | 
                                                        |
| 1068 | 1068 |  		$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1); | 
                                                        
| 1069 | 1069 | print $form->selectDate($date_next_execution, '', 1, 1, 0, "add", 1, 1);  | 
                                                        
| 1070 | 1070 | print "</td></tr>";  | 
                                                        
| 1071 | 1071 | |
| 1072 | 1072 | // Number max of generation  | 
                                                        
| 1073 | -		print "<tr><td>" . $langs->trans("MaxPeriodNumber") . "</td><td>"; | 
                                                        |
| 1074 | -		print '<input type="text" name="nb_gen_max" value="' . GETPOST('nb_gen_max') . '" size="5" />'; | 
                                                        |
| 1073 | +		print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>"; | 
                                                        |
| 1074 | +		print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />'; | 
                                                        |
| 1075 | 1075 | print "</td></tr>";  | 
                                                        
| 1076 | 1076 | |
| 1077 | 1077 | // Auto validate the invoice  | 
                                                        
| 1078 | -		print "<tr><td>" . $langs->trans("StatusOfAutoGeneratedInvoices") . "</td><td>"; | 
                                                        |
| 1078 | +		print "<tr><td>".$langs->trans("StatusOfAutoGeneratedInvoices")."</td><td>"; | 
                                                        |
| 1079 | 1079 |  		$select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated')); | 
                                                        
| 1080 | 1080 |  		print $form->selectarray('auto_validate', $select, GETPOST('auto_validate')); | 
                                                        
| 1081 | 1081 | print "</td></tr>";  | 
                                                        
| 1082 | 1082 | |
| 1083 | 1083 | // Auto generate document  | 
                                                        
| 1084 | 1084 |  		if (getDolGlobalString('INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION')) { | 
                                                        
| 1085 | -			print "<tr><td>" . $langs->trans("StatusOfGeneratedDocuments") . "</td><td>"; | 
                                                        |
| 1085 | +			print "<tr><td>".$langs->trans("StatusOfGeneratedDocuments")."</td><td>"; | 
                                                        |
| 1086 | 1086 |  			$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc')); | 
                                                        
| 1087 | 1087 |  			print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); | 
                                                        
| 1088 | 1088 | print "</td></tr>";  | 
                                                        
@@ -1125,7 +1125,7 @@ discard block  | 
                                                    ||
| 1125 | 1125 | |
| 1126 | 1126 | print "</form>\n";  | 
                                                        
| 1127 | 1127 |  	} else { | 
                                                        
| 1128 | - dol_print_error(null, "Error, no invoice " . $object->id);  | 
                                                        |
| 1128 | + dol_print_error(null, "Error, no invoice ".$object->id);  | 
                                                        |
| 1129 | 1129 | }  | 
                                                        
| 1130 | 1130 |  } else { | 
                                                        
| 1131 | 1131 | /*  | 
                                                        
@@ -1139,12 +1139,12 @@ discard block  | 
                                                    ||
| 1139 | 1139 | |
| 1140 | 1140 | // Confirmation de la suppression d'une ligne produit  | 
                                                        
| 1141 | 1141 |  		if ($action == 'ask_deleteline') { | 
                                                        
| 1142 | -			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); | 
                                                        |
| 1142 | +			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1); | 
                                                        |
| 1143 | 1143 | }  | 
                                                        
| 1144 | 1144 | |
| 1145 | 1145 | // Confirm delete of repeatable invoice  | 
                                                        
| 1146 | 1146 |  		if ($action == 'ask_deleteinvoice') { | 
                                                        
| 1147 | -			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); | 
                                                        |
| 1147 | +			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1); | 
                                                        |
| 1148 | 1148 | }  | 
                                                        
| 1149 | 1149 | |
| 1150 | 1150 | print $formconfirm;  | 
                                                        
@@ -1158,7 +1158,7 @@ discard block  | 
                                                    ||
| 1158 | 1158 | |
| 1159 | 1159 | // Recurring invoice content  | 
                                                        
| 1160 | 1160 | |
| 1161 | -		$linkback = '<a href="' . DOL_URL_ROOT . '/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans('BackToList') . '</a>'; | 
                                                        |
| 1161 | +		$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list-rec.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans('BackToList').'</a>'; | 
                                                        |
| 1162 | 1162 | |
| 1163 | 1163 | $morehtmlref = '';  | 
                                                        
| 1164 | 1164 |  		if ($action != 'edittitle') { | 
                                                        
@@ -1171,33 +1171,33 @@ discard block  | 
                                                    ||
| 1171 | 1171 |  		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1); | 
                                                        
| 1172 | 1172 |  		$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1); | 
                                                        
| 1173 | 1173 | // Thirdparty  | 
                                                        
| 1174 | -		$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); | 
                                                        |
| 1174 | +		$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); | 
                                                        |
| 1175 | 1175 | |
| 1176 | 1176 | // Project  | 
                                                        
| 1177 | 1177 |  		if (isModEnabled('project')) { | 
                                                        
| 1178 | 1178 |  			$langs->load('projects'); | 
                                                        
| 1179 | -			$morehtmlref .= '<br>' . $langs->trans('Project') . ' '; | 
                                                        |
| 1179 | +			$morehtmlref .= '<br>'.$langs->trans('Project').' '; | 
                                                        |
| 1180 | 1180 |  			if ($usercancreate) { | 
                                                        
| 1181 | 1181 |  				if ($action != 'classify') { | 
                                                        
| 1182 | -					$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; | 
                                                        |
| 1182 | +					$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : '; | 
                                                        |
| 1183 | 1183 | }  | 
                                                        
| 1184 | 1184 |  				if ($action == 'classify') { | 
                                                        
| 1185 | - $morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';  | 
                                                        |
| 1185 | + $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';  | 
                                                        |
| 1186 | 1186 | $morehtmlref .= '<input type="hidden" name="action" value="classin">';  | 
                                                        
| 1187 | - $morehtmlref .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 1187 | + $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1188 | 1188 | $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);  | 
                                                        
| 1189 | -					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 1189 | +					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 1190 | 1190 | $morehtmlref .= '</form>';  | 
                                                        
| 1191 | 1191 |  				} else { | 
                                                        
| 1192 | - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');  | 
                                                        |
| 1192 | + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');  | 
                                                        |
| 1193 | 1193 | }  | 
                                                        
| 1194 | 1194 |  			} else { | 
                                                        
| 1195 | 1195 |  				if (!empty($object->fk_project)) { | 
                                                        
| 1196 | 1196 | $project = new Project($db);  | 
                                                        
| 1197 | 1197 | $project->fetch($object->fk_project);  | 
                                                        
| 1198 | - $morehtmlref .= ' : ' . $project->getNomUrl(1);  | 
                                                        |
| 1198 | + $morehtmlref .= ' : '.$project->getNomUrl(1);  | 
                                                        |
| 1199 | 1199 |  					if ($project->title) { | 
                                                        
| 1200 | - $morehtmlref .= ' - ' . $project->title;  | 
                                                        |
| 1200 | + $morehtmlref .= ' - '.$project->title;  | 
                                                        |
| 1201 | 1201 | }  | 
                                                        
| 1202 | 1202 |  				} else { | 
                                                        
| 1203 | 1203 | $morehtmlref .= '';  | 
                                                        
@@ -1223,34 +1223,34 @@ discard block  | 
                                                    ||
| 1223 | 1223 | print "</td></tr>";  | 
                                                        
| 1224 | 1224 | }  | 
                                                        
| 1225 | 1225 | |
| 1226 | -		print '<tr><td class="titlefield">' . $langs->trans('Author') . '</td><td>'; | 
                                                        |
| 1226 | +		print '<tr><td class="titlefield">'.$langs->trans('Author').'</td><td>'; | 
                                                        |
| 1227 | 1227 | print $author->getNomUrl(-1);  | 
                                                        
| 1228 | 1228 | print "</td></tr>";  | 
                                                        
| 1229 | 1229 | |
| 1230 | 1230 | // Label  | 
                                                        
| 1231 | 1231 | print '<tr>';  | 
                                                        
| 1232 | -		print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>'; | 
                                                        |
| 1233 | -		print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>'; | 
                                                        |
| 1232 | +		print '<td>'.$form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>'; | 
                                                        |
| 1233 | +		print '<td>'.$form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>'; | 
                                                        |
| 1234 | 1234 | print '</tr>';  | 
                                                        
| 1235 | 1235 | |
| 1236 | -		print '<tr><td>' . $langs->trans('AmountHT') . '</td>'; | 
                                                        |
| 1237 | - print '<td>' . price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td>';  | 
                                                        |
| 1236 | +		print '<tr><td>'.$langs->trans('AmountHT').'</td>'; | 
                                                        |
| 1237 | + print '<td>'.price($object->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'</td>';  | 
                                                        |
| 1238 | 1238 | print '</tr>';  | 
                                                        
| 1239 | 1239 | |
| 1240 | -		print '<tr><td>' . $langs->trans("AmountVAT") . '</td><td>' . price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; | 
                                                        |
| 1240 | +		print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; | 
                                                        |
| 1241 | 1241 | print '</tr>';  | 
                                                        
| 1242 | 1242 | |
| 1243 | 1243 | // Amount Local Taxes  | 
                                                        
| 1244 | 1244 |  		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {    // Localtax1 | 
                                                        
| 1245 | -			print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>'; | 
                                                        |
| 1246 | - print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';  | 
                                                        |
| 1245 | +			print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>'; | 
                                                        |
| 1246 | + print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';  | 
                                                        |
| 1247 | 1247 | }  | 
                                                        
| 1248 | 1248 |  		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {    // Localtax2 | 
                                                        
| 1249 | -			print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>'; | 
                                                        |
| 1250 | - print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';  | 
                                                        |
| 1249 | +			print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>'; | 
                                                        |
| 1250 | + print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';  | 
                                                        |
| 1251 | 1251 | }  | 
                                                        
| 1252 | 1252 | |
| 1253 | -		print '<tr><td>' . $langs->trans("AmountTTC") . '</td><td colspan="3">' . price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . '</td>'; | 
                                                        |
| 1253 | +		print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, 0, $langs, 1, -1, -1, $conf->currency).'</td>'; | 
                                                        |
| 1254 | 1254 | print '</tr>';  | 
                                                        
| 1255 | 1255 | |
| 1256 | 1256 | // Payment term  | 
                                                        
@@ -1259,14 +1259,14 @@ discard block  | 
                                                    ||
| 1259 | 1259 |  		print $langs->trans('PaymentConditionsShort'); | 
                                                        
| 1260 | 1260 | print '</td>';  | 
                                                        
| 1261 | 1261 |  		if ($action != 'editconditions' && $usercancreate) { | 
                                                        
| 1262 | -			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>'; | 
                                                        |
| 1262 | +			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>'; | 
                                                        |
| 1263 | 1263 | }  | 
                                                        
| 1264 | 1264 | print '</tr></table>';  | 
                                                        
| 1265 | 1265 | print '</td><td>';  | 
                                                        
| 1266 | 1266 |  		if ($action == 'editconditions') { | 
                                                        
| 1267 | - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');  | 
                                                        |
| 1267 | + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');  | 
                                                        |
| 1268 | 1268 |  		} else { | 
                                                        
| 1269 | - $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');  | 
                                                        |
| 1269 | + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');  | 
                                                        |
| 1270 | 1270 | }  | 
                                                        
| 1271 | 1271 | |
| 1272 | 1272 | print '</td></tr>';  | 
                                                        
@@ -1277,14 +1277,14 @@ discard block  | 
                                                    ||
| 1277 | 1277 |  		print $langs->trans('PaymentMode'); | 
                                                        
| 1278 | 1278 | print '</td>';  | 
                                                        
| 1279 | 1279 |  		if ($action != 'editmode' && $usercancreate) { | 
                                                        
| 1280 | -			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmode&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>'; | 
                                                        |
| 1280 | +			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>'; | 
                                                        |
| 1281 | 1281 | }  | 
                                                        
| 1282 | 1282 | print '</tr></table>';  | 
                                                        
| 1283 | 1283 | print '</td><td>';  | 
                                                        
| 1284 | 1284 |  		if ($action == 'editmode') { | 
                                                        
| 1285 | - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);  | 
                                                        |
| 1285 | + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);  | 
                                                        |
| 1286 | 1286 |  		} else { | 
                                                        
| 1287 | - $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none');  | 
                                                        |
| 1287 | + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none');  | 
                                                        |
| 1288 | 1288 | }  | 
                                                        
| 1289 | 1289 | print '</td></tr>';  | 
                                                        
| 1290 | 1290 | |
@@ -1297,12 +1297,12 @@ discard block  | 
                                                    ||
| 1297 | 1297 |  			print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); | 
                                                        
| 1298 | 1298 | print '</td>';  | 
                                                        
| 1299 | 1299 |  			if ($usercancreate && $action != 'editmulticurrencycode' && $object->suspended == $object::STATUS_SUSPENDED) { | 
                                                        
| 1300 | -				print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>'; | 
                                                        |
| 1300 | +				print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; | 
                                                        |
| 1301 | 1301 | }  | 
                                                        
| 1302 | 1302 | print '</tr></table>';  | 
                                                        
| 1303 | 1303 | print '</td><td>';  | 
                                                        
| 1304 | 1304 | $htmlname = (($usercancreate && $action == 'editmulticurrencycode') ? 'multicurrency_code' : 'none');  | 
                                                        
| 1305 | - $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);  | 
                                                        |
| 1305 | + $form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, $htmlname);  | 
                                                        |
| 1306 | 1306 | print '</td></tr>';  | 
                                                        
| 1307 | 1307 | |
| 1308 | 1308 | // Multicurrency rate  | 
                                                        
@@ -1313,7 +1313,7 @@ discard block  | 
                                                    ||
| 1313 | 1313 |  				print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); | 
                                                        
| 1314 | 1314 | print '</td>';  | 
                                                        
| 1315 | 1315 |  				if ($usercancreate && $action != 'editmulticurrencyrate' && $object->suspended == $object::STATUS_SUSPENDED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { | 
                                                        
| 1316 | -					print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>'; | 
                                                        |
| 1316 | +					print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>'; | 
                                                        |
| 1317 | 1317 | }  | 
                                                        
| 1318 | 1318 | print '</tr></table>';  | 
                                                        
| 1319 | 1319 | print '</td><td>';  | 
                                                        
@@ -1321,12 +1321,12 @@ discard block  | 
                                                    ||
| 1321 | 1321 |  					if ($action == 'actualizemulticurrencyrate') { | 
                                                        
| 1322 | 1322 | list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);  | 
                                                        
| 1323 | 1323 | }  | 
                                                        
| 1324 | - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);  | 
                                                        |
| 1324 | + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);  | 
                                                        |
| 1325 | 1325 |  				} else { | 
                                                        
| 1326 | - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);  | 
                                                        |
| 1326 | + $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);  | 
                                                        |
| 1327 | 1327 |  					if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { | 
                                                        
| 1328 | 1328 | print '<div class="inline-block">         ';  | 
                                                        
| 1329 | -						print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>'; | 
                                                        |
| 1329 | +						print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>'; | 
                                                        |
| 1330 | 1330 | print '</div>';  | 
                                                        
| 1331 | 1331 | }  | 
                                                        
| 1332 | 1332 | }  | 
                                                        
@@ -1342,24 +1342,24 @@ discard block  | 
                                                    ||
| 1342 | 1342 | |
| 1343 | 1343 | $substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);  | 
                                                        
| 1344 | 1344 | |
| 1345 | -		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')'; | 
                                                        |
| 1346 | -		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')'; | 
                                                        |
| 1347 | -		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')'; | 
                                                        |
| 1348 | -		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')'; | 
                                                        |
| 1349 | -		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')'; | 
                                                        |
| 1350 | -		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')'; | 
                                                        |
| 1351 | -		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')'; | 
                                                        |
| 1352 | -		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')'; | 
                                                        |
| 1353 | -		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')'; | 
                                                        |
| 1345 | +		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')'; | 
                                                        |
| 1346 | +		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')'; | 
                                                        |
| 1347 | +		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')'; | 
                                                        |
| 1348 | +		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')'; | 
                                                        |
| 1349 | +		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')'; | 
                                                        |
| 1350 | +		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')'; | 
                                                        |
| 1351 | +		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')'; | 
                                                        |
| 1352 | +		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')'; | 
                                                        |
| 1353 | +		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')'; | 
                                                        |
| 1354 | 1354 | // Only on template invoices  | 
                                                        
| 1355 | -		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour') . ')'; | 
                                                        |
| 1356 | -		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour') . ')'; | 
                                                        |
| 1355 | +		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour').')'; | 
                                                        |
| 1356 | +		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour').')'; | 
                                                        |
| 1357 | 1357 | $substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done;  | 
                                                        
| 1358 | 1358 | $substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max;  | 
                                                        
| 1359 | 1359 | |
| 1360 | -		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>'; | 
                                                        |
| 1360 | +		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; | 
                                                        |
| 1361 | 1361 |  		foreach ($substitutionarray as $key => $val) { | 
                                                        
| 1362 | - $htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';  | 
                                                        |
| 1362 | + $htmltext .= $key.' = '.$langs->trans($val).'<br>';  | 
                                                        |
| 1363 | 1363 | }  | 
                                                        
| 1364 | 1364 | $htmltext .= '</i>';  | 
                                                        
| 1365 | 1365 | |
@@ -1369,14 +1369,14 @@ discard block  | 
                                                    ||
| 1369 | 1369 |  		print $langs->trans('BankAccount'); | 
                                                        
| 1370 | 1370 | print '<td>';  | 
                                                        
| 1371 | 1371 |  		if ($action != 'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) { | 
                                                        
| 1372 | -			print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editbankaccount&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>'; | 
                                                        |
| 1372 | +			print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>'; | 
                                                        |
| 1373 | 1373 | }  | 
                                                        
| 1374 | 1374 | print '</tr></table>';  | 
                                                        
| 1375 | 1375 | print '</td><td>';  | 
                                                        
| 1376 | 1376 |  		if ($action == 'editbankaccount') { | 
                                                        
| 1377 | - $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'fk_account', 1);  | 
                                                        |
| 1377 | + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);  | 
                                                        |
| 1378 | 1378 |  		} else { | 
                                                        
| 1379 | - $form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');  | 
                                                        |
| 1379 | + $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');  | 
                                                        |
| 1380 | 1380 | }  | 
                                                        
| 1381 | 1381 | print "</td>";  | 
                                                        
| 1382 | 1382 | print '</tr>';  | 
                                                        
@@ -1406,18 +1406,18 @@ discard block  | 
                                                    ||
| 1406 | 1406 |  		print $langs->trans('Model'); | 
                                                        
| 1407 | 1407 | print '<td>';  | 
                                                        
| 1408 | 1408 |  		if ($action != 'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) { | 
                                                        
| 1409 | -			print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editmodelpdf&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetModel'), 1) . '</a></td>'; | 
                                                        |
| 1409 | +			print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editmodelpdf&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>'; | 
                                                        |
| 1410 | 1410 | }  | 
                                                        
| 1411 | 1411 | print '</tr></table>';  | 
                                                        
| 1412 | 1412 | print '</td><td>';  | 
                                                        
| 1413 | 1413 |  		if ($action == 'editmodelpdf') { | 
                                                        
| 1414 | - include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';  | 
                                                        |
| 1414 | + include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';  | 
                                                        |
| 1415 | 1415 | $list = array();  | 
                                                        
| 1416 | 1416 | $models = ModelePDFSuppliersInvoices::liste_modeles($db);  | 
                                                        
| 1417 | 1417 |  			foreach ($models as $k => $model) { | 
                                                        
| 1418 | -				$list[] = str_replace(':', '|', $k) . ':' . $model; | 
                                                        |
| 1418 | +				$list[] = str_replace(':', '|', $k).':'.$model; | 
                                                        |
| 1419 | 1419 | }  | 
                                                        
| 1420 | -			$select = 'select;' . implode(',', $list); | 
                                                        |
| 1420 | +			$select = 'select;'.implode(',', $list); | 
                                                        |
| 1421 | 1421 | //TODO : Droits  | 
                                                        
| 1422 | 1422 |  			print $form->editfieldval($langs->trans('Model'), 'modelpdf', $object->model_pdf, $object, $usercancreate, $select); | 
                                                        
| 1423 | 1423 |  		} else { | 
                                                        
@@ -1443,7 +1443,7 @@ discard block  | 
                                                    ||
| 1443 | 1443 | |
| 1444 | 1444 | print '<table class="border centpercent tableforfield">';  | 
                                                        
| 1445 | 1445 | |
| 1446 | -		print '<tr><td colspan="2">' . img_picto('', 'recurring', 'class="pictofixedwidth"') . $title . '</td></tr>'; | 
                                                        |
| 1446 | +		print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>'; | 
                                                        |
| 1447 | 1447 | |
| 1448 | 1448 | // if "frequency" is empty or = 0, the recurrence is disabled  | 
                                                        
| 1449 | 1449 | print '<tr><td style="width: 50%">';  | 
                                                        
@@ -1451,23 +1451,23 @@ discard block  | 
                                                    ||
| 1451 | 1451 |  		print $langs->trans('Frequency'); | 
                                                        
| 1452 | 1452 | print '</td>';  | 
                                                        
| 1453 | 1453 |  		if ($action != 'editfrequency' && $usercancreate) { | 
                                                        
| 1454 | -			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>'; | 
                                                        |
| 1454 | +			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>'; | 
                                                        |
| 1455 | 1455 | }  | 
                                                        
| 1456 | 1456 | print '</tr></table>';  | 
                                                        
| 1457 | 1457 | print '</td><td>';  | 
                                                        
| 1458 | 1458 |  		if ($action == 'editfrequency') { | 
                                                        
| 1459 | - print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '">';  | 
                                                        |
| 1459 | + print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">';  | 
                                                        |
| 1460 | 1460 | print '<input type="hidden" name="action" value="setfrequency">';  | 
                                                        
| 1461 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 1461 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1462 | 1462 | print '<table class="nobordernopadding">';  | 
                                                        
| 1463 | 1463 | print '<tr><td>';  | 
                                                        
| 1464 | -			print "<input type='text' name='frequency' value='" . $object->frequency . "' size='5' /> " . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); | 
                                                        |
| 1464 | +			print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm')); | 
                                                        |
| 1465 | 1465 | print '</td>';  | 
                                                        
| 1466 | -			print '<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 1466 | +			print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 1467 | 1467 | print '</tr></table></form>';  | 
                                                        
| 1468 | 1468 |  		} else { | 
                                                        
| 1469 | 1469 |  			if ($object->frequency > 0) { | 
                                                        
| 1470 | -				print $langs->trans('FrequencyPer_' . $object->unit_frequency, $object->frequency); | 
                                                        |
| 1470 | +				print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); | 
                                                        |
| 1471 | 1471 |  			} else { | 
                                                        
| 1472 | 1472 |  				print $langs->trans("NotARecurringInvoiceTemplate"); | 
                                                        
| 1473 | 1473 | }  | 
                                                        
@@ -1486,8 +1486,8 @@ discard block  | 
                                                    ||
| 1486 | 1486 |  			print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached'); | 
                                                        
| 1487 | 1487 | }  | 
                                                        
| 1488 | 1488 | //var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));  | 
                                                        
| 1489 | -		if (! $object->isMaxNbGenReached()) { | 
                                                        |
| 1490 | -			if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { | 
                                                        |
| 1489 | +		if (!$object->isMaxNbGenReached()) { | 
                                                        |
| 1490 | +			if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) { | 
                                                        |
| 1491 | 1491 |  				print img_warning($langs->trans("Late")); | 
                                                        
| 1492 | 1492 | }  | 
                                                        
| 1493 | 1493 |  		} else { | 
                                                        
@@ -1520,7 +1520,7 @@ discard block  | 
                                                    ||
| 1520 | 1520 |  			print $langs->trans("StatusOfAutoGeneratedInvoices"); | 
                                                        
| 1521 | 1521 | }  | 
                                                        
| 1522 | 1522 | print '</td><td>';  | 
                                                        
| 1523 | -		$select = 'select;0:' . $langs->trans('BillStatusDraft') . ',1:' . $langs->trans('BillStatusValidated'); | 
                                                        |
| 1523 | +		$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); | 
                                                        |
| 1524 | 1524 |  		if ($action == 'auto_validate' || $object->frequency > 0) { | 
                                                        
| 1525 | 1525 |  			print $form->editfieldval($langs->trans("StatusOfAutoGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate, $select); | 
                                                        
| 1526 | 1526 | }  | 
                                                        
@@ -1536,7 +1536,7 @@ discard block  | 
                                                    ||
| 1536 | 1536 | }  | 
                                                        
| 1537 | 1537 | print '</td>';  | 
                                                        
| 1538 | 1538 | print '<td>';  | 
                                                        
| 1539 | -			$select = 'select;0:' . $langs->trans('DoNotGenerateDoc') . ',1:' . $langs->trans('AutogenerateDoc'); | 
                                                        |
| 1539 | +			$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc'); | 
                                                        |
| 1540 | 1540 |  			if ($action == 'generate_pdf' || $object->frequency > 0) { | 
                                                        
| 1541 | 1541 |  				print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select); | 
                                                        
| 1542 | 1542 | }  | 
                                                        
@@ -1560,7 +1560,7 @@ discard block  | 
                                                    ||
| 1560 | 1560 | print '<table class="border centpercent tableforfield">';  | 
                                                        
| 1561 | 1561 | |
| 1562 | 1562 | // Nb of generation already done  | 
                                                        
| 1563 | -			print '<tr><td style="width: 50%">' . $langs->trans("NbOfGenerationDone") . '</td>'; | 
                                                        |
| 1563 | +			print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>'; | 
                                                        |
| 1564 | 1564 | print '<td>';  | 
                                                        
| 1565 | 1565 | print $object->nb_gen_done ? $object->nb_gen_done : '0';  | 
                                                        
| 1566 | 1566 | print '</td>';  | 
                                                        
@@ -1585,15 +1585,15 @@ discard block  | 
                                                    ||
| 1585 | 1585 | print '<div class="clearboth"></div><br>';  | 
                                                        
| 1586 | 1586 | |
| 1587 | 1587 | // Lines  | 
                                                        
| 1588 | -		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOSTINT('lineid')) . '" method="POST"> | 
                                                        |
| 1589 | - <input type="hidden" name="token" value="' . newToken() . '">  | 
                                                        |
| 1590 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">  | 
                                                        |
| 1588 | +		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOSTINT('lineid')).'" method="POST"> | 
                                                        |
| 1589 | + <input type="hidden" name="token" value="' . newToken().'">  | 
                                                        |
| 1590 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">  | 
                                                        |
| 1591 | 1591 | <input type="hidden" name="mode" value="">  | 
                                                        
| 1592 | - <input type="hidden" name="id" value="' . $object->id . '">  | 
                                                        |
| 1592 | + <input type="hidden" name="id" value="' . $object->id.'">  | 
                                                        |
| 1593 | 1593 | ';  | 
                                                        
| 1594 | 1594 | |
| 1595 | 1595 |  		if (!empty($conf->use_javascript_ajax) && $object->statut == 0) { | 
                                                        
| 1596 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';  | 
                                                        |
| 1596 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';  | 
                                                        |
| 1597 | 1597 | }  | 
                                                        
| 1598 | 1598 | |
| 1599 | 1599 | print '<div class="div-table-responsive-no-min">';  | 
                                                        
@@ -1650,24 +1650,24 @@ discard block  | 
                                                    ||
| 1650 | 1650 |  		if (empty($object->suspended)) { | 
                                                        
| 1651 | 1651 |  			if ($usercancreate) { | 
                                                        
| 1652 | 1652 |  				if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { | 
                                                        
| 1653 | -					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1653 | +					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1654 | 1654 |  				} else { | 
                                                        
| 1655 | 1655 |  					if (empty($object->frequency) || $object->date_when <= $nowlasthour) { | 
                                                        
| 1656 | -						print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1656 | +						print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1657 | 1657 |  					} else { | 
                                                        
| 1658 | -						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1658 | +						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1659 | 1659 | }  | 
                                                        
| 1660 | 1660 | }  | 
                                                        
| 1661 | 1661 |  			} else { | 
                                                        
| 1662 | -				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>'; | 
                                                        |
| 1662 | +				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>'; | 
                                                        |
| 1663 | 1663 | }  | 
                                                        
| 1664 | 1664 | }  | 
                                                        
| 1665 | 1665 | |
| 1666 | 1666 |  		if ($usercancreate) { | 
                                                        
| 1667 | 1667 |  			if (empty($object->suspended)) { | 
                                                        
| 1668 | -				print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=disable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Disable") . '</a></div>'; | 
                                                        |
| 1668 | +				print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>'; | 
                                                        |
| 1669 | 1669 |  			} else { | 
                                                        
| 1670 | -				print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=enable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Enable") . '</a></div>'; | 
                                                        |
| 1670 | +				print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=enable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Enable").'</a></div>'; | 
                                                        |
| 1671 | 1671 | }  | 
                                                        
| 1672 | 1672 | }  | 
                                                        
| 1673 | 1673 | |
@@ -274,7 +274,7 @@ discard block  | 
                                                    ||
| 274 | 274 | $now = dol_now();  | 
                                                        
| 275 | 275 | |
| 276 | 276 | // Clean parameters  | 
                                                        
| 277 | - $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated  | 
                                                        |
| 277 | + $this->titre = empty($this->titre) ? '' : $this->titre; // deprecated  | 
                                                        |
| 278 | 278 | $this->title = empty($this->title) ? '' : $this->title;  | 
                                                        
| 279 | 279 | $keyforref = $this->table_ref_field;  | 
                                                        
| 280 | 280 | $this->ref = $this->$keyforref;  | 
                                                        
@@ -338,32 +338,32 @@ discard block  | 
                                                    ||
| 338 | 338 | $sql .= ", '".$this->db->idate($now)."'";  | 
                                                        
| 339 | 339 | $sql .= ", ".((int) $this->suspended);  | 
                                                        
| 340 | 340 | $sql .= ", '".$this->db->escape($this->libelle)."'";  | 
                                                        
| 341 | - $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount  | 
                                                        |
| 342 | - $sql .= ", " .((int) $user->id);  | 
                                                        |
| 343 | - $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');  | 
                                                        |
| 344 | - $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');  | 
                                                        |
| 345 | - $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');  | 
                                                        |
| 346 | - $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');  | 
                                                        |
| 347 | - $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement  | 
                                                        |
| 348 | - $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');  | 
                                                        |
| 349 | - $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');  | 
                                                        |
| 350 | - $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');  | 
                                                        |
| 351 | - $sql .= ", " . (int) $facfourn_src->fk_multicurrency;  | 
                                                        |
| 341 | + $sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount  | 
                                                        |
| 342 | + $sql .= ", ".((int) $user->id);  | 
                                                        |
| 343 | + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');  | 
                                                        |
| 344 | + $sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');  | 
                                                        |
| 345 | + $sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');  | 
                                                        |
| 346 | + $sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');  | 
                                                        |
| 347 | + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement  | 
                                                        |
| 348 | + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');  | 
                                                        |
| 349 | + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');  | 
                                                        |
| 350 | + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');  | 
                                                        |
| 351 | + $sql .= ", ".(int) $facfourn_src->fk_multicurrency;  | 
                                                        |
| 352 | 352 | $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'";  | 
                                                        
| 353 | - $sql .= ", " . (float) $facfourn_src->multicurrency_tx;  | 
                                                        |
| 354 | - $sql .= ", " . (int) $this->usenewprice;  | 
                                                        |
| 355 | - $sql .= ", " . (int) $this->frequency;  | 
                                                        |
| 353 | + $sql .= ", ".(float) $facfourn_src->multicurrency_tx;  | 
                                                        |
| 354 | + $sql .= ", ".(int) $this->usenewprice;  | 
                                                        |
| 355 | + $sql .= ", ".(int) $this->frequency;  | 
                                                        |
| 356 | 356 | $sql .= ", '".$this->db->escape($this->unit_frequency)."'";  | 
                                                        
| 357 | - $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');  | 
                                                        |
| 358 | - $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');  | 
                                                        |
| 359 | - $sql .= ", " . (int) $this->nb_gen_done;  | 
                                                        |
| 360 | - $sql .= ", " . (int) $this->nb_gen_max;  | 
                                                        |
| 361 | - $sql .= ", " . (int) $this->auto_validate;  | 
                                                        |
| 362 | - $sql .= ", " . (int) $this->generate_pdf;  | 
                                                        |
| 357 | + $sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');  | 
                                                        |
| 358 | + $sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');  | 
                                                        |
| 359 | + $sql .= ", ".(int) $this->nb_gen_done;  | 
                                                        |
| 360 | + $sql .= ", ".(int) $this->nb_gen_max;  | 
                                                        |
| 361 | + $sql .= ", ".(int) $this->auto_validate;  | 
                                                        |
| 362 | + $sql .= ", ".(int) $this->generate_pdf;  | 
                                                        |
| 363 | 363 | $sql .= ')';  | 
                                                        
| 364 | 364 | |
| 365 | 365 |  			if ($this->db->query($sql)) { | 
                                                        
| 366 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec');  | 
                                                        |
| 366 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec');  | 
                                                        |
| 367 | 367 | |
| 368 | 368 | // Fields used into addline later  | 
                                                        
| 369 | 369 | $this->fk_multicurrency = $facfourn_src->fk_multicurrency;  | 
                                                        
@@ -499,47 +499,47 @@ discard block  | 
                                                    ||
| 499 | 499 | $error = 0;  | 
                                                        
| 500 | 500 | |
| 501 | 501 | $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET";  | 
                                                        
| 502 | - $sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ;  | 
                                                        |
| 502 | + $sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',";  | 
                                                        |
| 503 | 503 | $sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").",";  | 
                                                        
| 504 | - $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";  | 
                                                        |
| 505 | - $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';  | 
                                                        |
| 504 | + $sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";  | 
                                                        |
| 505 | + $sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).',';  | 
                                                        |
| 506 | 506 |  		if (!empty($this->socid) && $this->socid > 0) { | 
                                                        
| 507 | - $sql .= " fk_soc = ". ((int) $this->socid). ',';  | 
                                                        |
| 507 | + $sql .= " fk_soc = ".((int) $this->socid).',';  | 
                                                        |
| 508 | 508 |  		} elseif (!empty($this->fk_soc) && $this->fk_soc > 0) {	// For backward compatibility | 
                                                        
| 509 | - $sql .= " fk_soc = ". ((int) $this->fk_soc). ',';  | 
                                                        |
| 509 | + $sql .= " fk_soc = ".((int) $this->fk_soc).',';  | 
                                                        |
| 510 | 510 | }  | 
                                                        
| 511 | - $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ',';  | 
                                                        |
| 512 | - $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ",";  | 
                                                        |
| 513 | - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ',';  | 
                                                        |
| 514 | - $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ',';  | 
                                                        |
| 515 | - $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ',';  | 
                                                        |
| 516 | - $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ',';  | 
                                                        |
| 517 | - $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ',';  | 
                                                        |
| 518 | - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ',';  | 
                                                        |
| 519 | - $sql .= " fk_user_modif = ". ((int) $user->id) . ',';  | 
                                                        |
| 520 | - $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ',';  | 
                                                        |
| 521 | - $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ',';  | 
                                                        |
| 522 | - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ',';  | 
                                                        |
| 523 | - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ',';  | 
                                                        |
| 524 | - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ',';  | 
                                                        |
| 525 | - $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',";  | 
                                                        |
| 526 | - $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',";  | 
                                                        |
| 527 | - $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ",";  | 
                                                        |
| 528 | - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ',';  | 
                                                        |
| 529 | - $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ",";  | 
                                                        |
| 530 | - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ',';  | 
                                                        |
| 531 | - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ',';  | 
                                                        |
| 532 | - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ',';  | 
                                                        |
| 533 | - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ',';  | 
                                                        |
| 534 | - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ',';  | 
                                                        |
| 535 | - $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ',';  | 
                                                        |
| 536 | - $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',";  | 
                                                        |
| 537 | - $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ',';  | 
                                                        |
| 538 | - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ',';  | 
                                                        |
| 539 | - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ',';  | 
                                                        |
| 540 | - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ',';  | 
                                                        |
| 541 | - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);  | 
                                                        |
| 542 | - $sql .= " WHERE rowid = ". (int) $this->id;  | 
                                                        |
| 511 | + $sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).',';  | 
                                                        |
| 512 | + $sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').",";  | 
                                                        |
| 513 | + $sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').',';  | 
                                                        |
| 514 | + $sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).',';  | 
                                                        |
| 515 | + $sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).',';  | 
                                                        |
| 516 | + $sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).',';  | 
                                                        |
| 517 | + $sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).',';  | 
                                                        |
| 518 | + $sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).',';  | 
                                                        |
| 519 | + $sql .= " fk_user_modif = ".((int) $user->id).',';  | 
                                                        |
| 520 | + $sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').',';  | 
                                                        |
| 521 | + $sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').',';  | 
                                                        |
| 522 | + $sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').',';  | 
                                                        |
| 523 | + $sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').',';  | 
                                                        |
| 524 | + $sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').',';  | 
                                                        |
| 525 | + $sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',";  | 
                                                        |
| 526 | + $sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',";  | 
                                                        |
| 527 | + $sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').",";  | 
                                                        |
| 528 | + $sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').',';  | 
                                                        |
| 529 | + $sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').",";  | 
                                                        |
| 530 | + $sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).',';  | 
                                                        |
| 531 | + $sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).',';  | 
                                                        |
| 532 | + $sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).',';  | 
                                                        |
| 533 | + $sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).',';  | 
                                                        |
| 534 | + $sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).',';  | 
                                                        |
| 535 | + $sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).',';  | 
                                                        |
| 536 | + $sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',";  | 
                                                        |
| 537 | + $sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').',';  | 
                                                        |
| 538 | + $sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').',';  | 
                                                        |
| 539 | + $sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).',';  | 
                                                        |
| 540 | + $sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).',';  | 
                                                        |
| 541 | + $sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);  | 
                                                        |
| 542 | + $sql .= " WHERE rowid = ".(int) $this->id;  | 
                                                        |
| 543 | 543 | |
| 544 | 544 | $this->db->begin();  | 
                                                        
| 545 | 545 | |
@@ -600,7 +600,7 @@ discard block  | 
                                                    ||
| 600 | 600 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';  | 
                                                        
| 601 | 601 |  		$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; | 
                                                        
| 602 | 602 |  		if ($rowid) { | 
                                                        
| 603 | - $sql .= ' AND f.rowid='. (int) $rowid;  | 
                                                        |
| 603 | + $sql .= ' AND f.rowid='.(int) $rowid;  | 
                                                        |
| 604 | 604 |  		} elseif ($ref) { | 
                                                        
| 605 | 605 | $sql .= " AND f.titre='".$this->db->escape($ref)."'";  | 
                                                        
| 606 | 606 |  		} else { | 
                                                        
@@ -617,7 +617,7 @@ discard block  | 
                                                    ||
| 617 | 617 | $this->id = $obj->rowid;  | 
                                                        
| 618 | 618 | $this->titre = $obj->title;  | 
                                                        
| 619 | 619 | $this->title = $obj->title;  | 
                                                        
| 620 | - $this->subtype = $obj->subtype;  | 
                                                        |
| 620 | + $this->subtype = $obj->subtype;  | 
                                                        |
| 621 | 621 | $this->ref = $obj->title;  | 
                                                        
| 622 | 622 | $this->ref_supplier = $obj->ref_supplier;  | 
                                                        
| 623 | 623 | $this->entity = $obj->entity;  | 
                                                        
@@ -734,7 +734,7 @@ discard block  | 
                                                    ||
| 734 | 734 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';  | 
                                                        
| 735 | 735 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';  | 
                                                        
| 736 | 736 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';  | 
                                                        
| 737 | - $sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id;  | 
                                                        |
| 737 | + $sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id;  | 
                                                        |
| 738 | 738 | $sql .= ' ORDER BY l.rang';  | 
                                                        
| 739 | 739 | |
| 740 | 740 |  		dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG); | 
                                                        
@@ -775,7 +775,7 @@ discard block  | 
                                                    ||
| 775 | 775 | $line->product_type = $objp->product_type;  | 
                                                        
| 776 | 776 | $line->date_start = $objp->date_start;  | 
                                                        
| 777 | 777 | $line->date_end = $objp->date_end;  | 
                                                        
| 778 | - $line->info_bits = $objp->info_bits ;  | 
                                                        |
| 778 | + $line->info_bits = $objp->info_bits;  | 
                                                        |
| 779 | 779 | $line->special_code = $objp->special_code;  | 
                                                        
| 780 | 780 | $line->rang = $objp->rang;  | 
                                                        
| 781 | 781 | $line->fk_unit = $objp->fk_unit;  | 
                                                        
@@ -825,11 +825,11 @@ discard block  | 
                                                    ||
| 825 | 825 | $main = MAIN_DB_PREFIX.'facture_fourn_det_rec';  | 
                                                        
| 826 | 826 | $ef = $main."_extrafields";  | 
                                                        
| 827 | 827 | |
| 828 | - $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")";  | 
                                                        |
| 829 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid;  | 
                                                        |
| 828 | + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")";  | 
                                                        |
| 829 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid;  | 
                                                        |
| 830 | 830 | |
| 831 | 831 |  		if ($this->db->query($sqlef) && $this->db->query($sql)) { | 
                                                        
| 832 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid;  | 
                                                        |
| 832 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid;  | 
                                                        |
| 833 | 833 | dol_syslog($sql);  | 
                                                        
| 834 | 834 |  			if ($this->db->query($sql)) { | 
                                                        
| 835 | 835 | // Delete linked object  | 
                                                        
@@ -858,7 +858,7 @@ discard block  | 
                                                    ||
| 858 | 858 | }  | 
                                                        
| 859 | 859 | // End call triggers  | 
                                                        
| 860 | 860 | }  | 
                                                        
| 861 | -		if (! $error) { | 
                                                        |
| 861 | +		if (!$error) { | 
                                                        |
| 862 | 862 | $this->db->commit();  | 
                                                        
| 863 | 863 | return 1;  | 
                                                        
| 864 | 864 |  		} else { | 
                                                        
@@ -970,7 +970,7 @@ discard block  | 
                                                    ||
| 970 | 970 | }  | 
                                                        
| 971 | 971 | }  | 
                                                        
| 972 | 972 | |
| 973 | -			$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec ('; | 
                                                        |
| 973 | +			$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec ('; | 
                                                        |
| 974 | 974 | $sql .= 'fk_facture_fourn';  | 
                                                        
| 975 | 975 | $sql .= ', fk_product';  | 
                                                        
| 976 | 976 | $sql .= ', ref';  | 
                                                        
@@ -1002,46 +1002,46 @@ discard block  | 
                                                    ||
| 1002 | 1002 | $sql .= ', fk_user_author';  | 
                                                        
| 1003 | 1003 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';  | 
                                                        
| 1004 | 1004 |  			$sql .= ') VALUES ('; | 
                                                        
| 1005 | - $sql .= ' ' . (int) $facid; // source supplier invoice id  | 
                                                        |
| 1006 | - $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');  | 
                                                        |
| 1007 | - $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');  | 
                                                        |
| 1008 | - $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');  | 
                                                        |
| 1009 | - $sql .= ", '" . $this->db->escape($desc) . "'";  | 
                                                        |
| 1010 | - $sql .= ', ' . price2num($pu_ht);  | 
                                                        |
| 1011 | - $sql .= ', ' . price2num($pu_ttc);  | 
                                                        |
| 1012 | - $sql .= ', ' . price2num($qty);  | 
                                                        |
| 1013 | - $sql .= ', ' . price2num($remise_percent);  | 
                                                        |
| 1005 | + $sql .= ' '.(int) $facid; // source supplier invoice id  | 
                                                        |
| 1006 | + $sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null');  | 
                                                        |
| 1007 | + $sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null');  | 
                                                        |
| 1008 | + $sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null');  | 
                                                        |
| 1009 | + $sql .= ", '".$this->db->escape($desc)."'";  | 
                                                        |
| 1010 | + $sql .= ', '.price2num($pu_ht);  | 
                                                        |
| 1011 | + $sql .= ', '.price2num($pu_ttc);  | 
                                                        |
| 1012 | + $sql .= ', '.price2num($qty);  | 
                                                        |
| 1013 | + $sql .= ', '.price2num($remise_percent);  | 
                                                        |
| 1014 | 1014 | $sql .= ', null';  | 
                                                        
| 1015 | - $sql .= ", '" . $this->db->escape($vat_src_code) . "'";  | 
                                                        |
| 1016 | - $sql .= ', ' . price2num($txtva);  | 
                                                        |
| 1017 | - $sql .= ', ' . price2num($txlocaltax1);  | 
                                                        |
| 1018 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'";  | 
                                                        |
| 1019 | - $sql .= ', ' . price2num($txlocaltax2);  | 
                                                        |
| 1020 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'";  | 
                                                        |
| 1021 | - $sql .= ', ' . price2num($total_ht);  | 
                                                        |
| 1022 | - $sql .= ', ' . price2num($total_tva);  | 
                                                        |
| 1023 | - $sql .= ', ' . price2num($total_localtax1);  | 
                                                        |
| 1024 | - $sql .= ', ' . price2num($total_localtax2);  | 
                                                        |
| 1025 | - $sql .= ', ' . price2num($total_ttc);  | 
                                                        |
| 1026 | - $sql .= ', ' . (int) $product_type;  | 
                                                        |
| 1027 | - $sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL');  | 
                                                        |
| 1028 | - $sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL');  | 
                                                        |
| 1029 | - $sql .= ', ' . (int) $info_bits;  | 
                                                        |
| 1030 | - $sql .= ', ' . (int) $special_code;  | 
                                                        |
| 1031 | - $sql .= ', ' . (int) $rang;  | 
                                                        |
| 1032 | - $sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL');  | 
                                                        |
| 1033 | - $sql .= ', ' . (int) $user->id;  | 
                                                        |
| 1034 | - $sql .= ', ' . (int) $this->fk_multicurrency;  | 
                                                        |
| 1035 | - $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";  | 
                                                        |
| 1036 | - $sql .= ', ' . price2num($pu_ht_devise, 'CU');  | 
                                                        |
| 1037 | - $sql .= ', ' . price2num($multicurrency_total_ht, 'CT');  | 
                                                        |
| 1038 | - $sql .= ', ' . price2num($multicurrency_total_tva, 'CT');  | 
                                                        |
| 1039 | - $sql .= ', ' . price2num($multicurrency_total_ttc, 'CT');  | 
                                                        |
| 1015 | + $sql .= ", '".$this->db->escape($vat_src_code)."'";  | 
                                                        |
| 1016 | + $sql .= ', '.price2num($txtva);  | 
                                                        |
| 1017 | + $sql .= ', '.price2num($txlocaltax1);  | 
                                                        |
| 1018 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'";  | 
                                                        |
| 1019 | + $sql .= ', '.price2num($txlocaltax2);  | 
                                                        |
| 1020 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";  | 
                                                        |
| 1021 | + $sql .= ', '.price2num($total_ht);  | 
                                                        |
| 1022 | + $sql .= ', '.price2num($total_tva);  | 
                                                        |
| 1023 | + $sql .= ', '.price2num($total_localtax1);  | 
                                                        |
| 1024 | + $sql .= ', '.price2num($total_localtax2);  | 
                                                        |
| 1025 | + $sql .= ', '.price2num($total_ttc);  | 
                                                        |
| 1026 | + $sql .= ', '.(int) $product_type;  | 
                                                        |
| 1027 | + $sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL');  | 
                                                        |
| 1028 | + $sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL');  | 
                                                        |
| 1029 | + $sql .= ', '.(int) $info_bits;  | 
                                                        |
| 1030 | + $sql .= ', '.(int) $special_code;  | 
                                                        |
| 1031 | + $sql .= ', '.(int) $rang;  | 
                                                        |
| 1032 | + $sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL');  | 
                                                        |
| 1033 | + $sql .= ', '.(int) $user->id;  | 
                                                        |
| 1034 | + $sql .= ', '.(int) $this->fk_multicurrency;  | 
                                                        |
| 1035 | + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'";  | 
                                                        |
| 1036 | + $sql .= ', '.price2num($pu_ht_devise, 'CU');  | 
                                                        |
| 1037 | + $sql .= ', '.price2num($multicurrency_total_ht, 'CT');  | 
                                                        |
| 1038 | + $sql .= ', '.price2num($multicurrency_total_tva, 'CT');  | 
                                                        |
| 1039 | + $sql .= ', '.price2num($multicurrency_total_ttc, 'CT');  | 
                                                        |
| 1040 | 1040 | $sql .= ')';  | 
                                                        
| 1041 | 1041 | |
| 1042 | - dol_syslog(get_class($this). '::addline', LOG_DEBUG);  | 
                                                        |
| 1042 | + dol_syslog(get_class($this).'::addline', LOG_DEBUG);  | 
                                                        |
| 1043 | 1043 |  			if ($this->db->query($sql)) { | 
                                                        
| 1044 | - $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec');  | 
                                                        |
| 1044 | + $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec');  | 
                                                        |
| 1045 | 1045 | $this->update_price();  | 
                                                        
| 1046 | 1046 | $this->id = $facid;  | 
                                                        
| 1047 | 1047 | $this->db->commit();  | 
                                                        
@@ -1092,7 +1092,7 @@ discard block  | 
                                                    ||
| 1092 | 1092 | |
| 1093 | 1093 | $facid = $this->id;  | 
                                                        
| 1094 | 1094 | |
| 1095 | - dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);  | 
                                                        |
| 1095 | + dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);  | 
                                                        |
| 1096 | 1096 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';  | 
                                                        
| 1097 | 1097 | |
| 1098 | 1098 | // Check parameters  | 
                                                        
@@ -1162,41 +1162,41 @@ discard block  | 
                                                    ||
| 1162 | 1162 | $product_type = $product->type;  | 
                                                        
| 1163 | 1163 | }  | 
                                                        
| 1164 | 1164 | |
| 1165 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';  | 
                                                        |
| 1166 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid);  | 
                                                        |
| 1167 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null');  | 
                                                        |
| 1168 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'";  | 
                                                        |
| 1169 | - $sql .= ", label = '" . $this->db->escape($label) . "'";  | 
                                                        |
| 1170 | - $sql .= ", description = '" . $this->db->escape($desc) . "'";  | 
                                                        |
| 1171 | - $sql .= ', pu_ht = ' . price2num($pu_ht);  | 
                                                        |
| 1172 | - $sql .= ', qty = ' . price2num($qty);  | 
                                                        |
| 1173 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'";  | 
                                                        |
| 1174 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'";  | 
                                                        |
| 1175 | - $sql .= ', tva_tx = ' . price2num($txtva);  | 
                                                        |
| 1176 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1;  | 
                                                        |
| 1177 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'";  | 
                                                        |
| 1178 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2;  | 
                                                        |
| 1179 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'";  | 
                                                        |
| 1180 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'";  | 
                                                        |
| 1181 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'";  | 
                                                        |
| 1182 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'";  | 
                                                        |
| 1183 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'";  | 
                                                        |
| 1184 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'";  | 
                                                        |
| 1185 | - $sql .= ', product_type = ' . (int) $product_type;  | 
                                                        |
| 1186 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start);  | 
                                                        |
| 1187 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end);  | 
                                                        |
| 1188 | - $sql .= ', info_bits = ' . (int) $info_bits;  | 
                                                        |
| 1189 | - $sql .= ', special_code = ' . (int) $special_code;  | 
                                                        |
| 1190 | - $sql .= ', rang = ' . (int) $rang;  | 
                                                        |
| 1191 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');  | 
                                                        |
| 1192 | - $sql .= ', fk_user_modif = ' . (int) $user;  | 
                                                        |
| 1165 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';  | 
                                                        |
| 1166 | + $sql .= ' fk_facture_fourn = '.((int) $facid);  | 
                                                        |
| 1167 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null');  | 
                                                        |
| 1168 | + $sql .= ", ref = '".$this->db->escape($ref)."'";  | 
                                                        |
| 1169 | + $sql .= ", label = '".$this->db->escape($label)."'";  | 
                                                        |
| 1170 | + $sql .= ", description = '".$this->db->escape($desc)."'";  | 
                                                        |
| 1171 | + $sql .= ', pu_ht = '.price2num($pu_ht);  | 
                                                        |
| 1172 | + $sql .= ', qty = '.price2num($qty);  | 
                                                        |
| 1173 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'";  | 
                                                        |
| 1174 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'";  | 
                                                        |
| 1175 | + $sql .= ', tva_tx = '.price2num($txtva);  | 
                                                        |
| 1176 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1;  | 
                                                        |
| 1177 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'";  | 
                                                        |
| 1178 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2;  | 
                                                        |
| 1179 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'";  | 
                                                        |
| 1180 | + $sql .= ", total_ht = '".price2num($total_ht)."'";  | 
                                                        |
| 1181 | + $sql .= ", total_tva = '".price2num($total_tva)."'";  | 
                                                        |
| 1182 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'";  | 
                                                        |
| 1183 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'";  | 
                                                        |
| 1184 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'";  | 
                                                        |
| 1185 | + $sql .= ', product_type = '.(int) $product_type;  | 
                                                        |
| 1186 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start);  | 
                                                        |
| 1187 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end);  | 
                                                        |
| 1188 | + $sql .= ', info_bits = '.(int) $info_bits;  | 
                                                        |
| 1189 | + $sql .= ', special_code = '.(int) $special_code;  | 
                                                        |
| 1190 | + $sql .= ', rang = '.(int) $rang;  | 
                                                        |
| 1191 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null');  | 
                                                        |
| 1192 | + $sql .= ', fk_user_modif = '.(int) $user;  | 
                                                        |
| 1193 | 1193 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);  | 
                                                        
| 1194 | 1194 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);  | 
                                                        
| 1195 | 1195 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);  | 
                                                        
| 1196 | 1196 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc);  | 
                                                        
| 1197 | - $sql .= ' WHERE rowid = ' . (int) $rowid;  | 
                                                        |
| 1197 | + $sql .= ' WHERE rowid = '.(int) $rowid;  | 
                                                        |
| 1198 | 1198 | |
| 1199 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG);  | 
                                                        |
| 1199 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG);  | 
                                                        |
| 1200 | 1200 |  			if ($this->db->query($sql)) { | 
                                                        
| 1201 | 1201 | $this->id = $facid;  | 
                                                        
| 1202 | 1202 | $this->update_price();  | 
                                                        
@@ -1286,16 +1286,16 @@ discard block  | 
                                                    ||
| 1286 | 1286 | $tmparray = dol_getdate($now);  | 
                                                        
| 1287 | 1287 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day  | 
                                                        
| 1288 | 1288 | |
| 1289 | -		dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); | 
                                                        |
| 1289 | +		dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); | 
                                                        |
| 1290 | 1290 | |
| 1291 | 1291 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec';  | 
                                                        
| 1292 | 1292 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency  | 
                                                        
| 1293 | 1293 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')";  | 
                                                        
| 1294 | 1294 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';  | 
                                                        
| 1295 | 1295 | $sql .= ' AND suspended = 0';  | 
                                                        
| 1296 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here  | 
                                                        |
| 1296 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here  | 
                                                        |
| 1297 | 1297 |  		if ($restrictioninvoiceid > 0) { | 
                                                        
| 1298 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid;  | 
                                                        |
| 1298 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid;  | 
                                                        |
| 1299 | 1299 | }  | 
                                                        
| 1300 | 1300 |  		$sql .= $this->db->order('entity', 'ASC'); | 
                                                        
| 1301 | 1301 | //print $sql;exit;  | 
                                                        
@@ -1335,7 +1335,7 @@ discard block  | 
                                                    ||
| 1335 | 1335 | // Set entity context  | 
                                                        
| 1336 | 1336 | $conf->entity = $facturerec->entity;  | 
                                                        
| 1337 | 1337 | |
| 1338 | -					dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); | 
                                                        |
| 1338 | +					dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); | 
                                                        |
| 1339 | 1339 | |
| 1340 | 1340 | $new_fac_fourn = new FactureFournisseur($this->db);  | 
                                                        
| 1341 | 1341 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice  | 
                                                        
@@ -1343,7 +1343,7 @@ discard block  | 
                                                    ||
| 1343 | 1343 | |
| 1344 | 1344 | $new_fac_fourn->type = self::TYPE_STANDARD;  | 
                                                        
| 1345 | 1345 | $new_fac_fourn->subtype = $facturerec->subtype;  | 
                                                        
| 1346 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated  | 
                                                        |
| 1346 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated  | 
                                                        |
| 1347 | 1347 | $new_fac_fourn->status = self::STATUS_DRAFT;  | 
                                                        
| 1348 | 1348 | $new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.  | 
                                                        
| 1349 | 1349 | $new_fac_fourn->socid = $facturerec->socid;  | 
                                                        
@@ -1352,7 +1352,7 @@ discard block  | 
                                                    ||
| 1352 | 1352 | $new_fac_fourn->model_pdf = $facturerec->model_pdf;  | 
                                                        
| 1353 | 1353 | $new_fac_fourn->fk_project = $facturerec->fk_project;  | 
                                                        
| 1354 | 1354 | $new_fac_fourn->label = $facturerec->label;  | 
                                                        
| 1355 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated  | 
                                                        |
| 1355 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated  | 
                                                        |
| 1356 | 1356 | |
| 1357 | 1357 | $invoiceidgenerated = $new_fac_fourn->create($user);  | 
                                                        
| 1358 | 1358 | $laststep = "Create invoiceidgenerated $invoiceidgenerated";  | 
                                                        
@@ -1385,9 +1385,9 @@ discard block  | 
                                                    ||
| 1385 | 1385 | }  | 
                                                        
| 1386 | 1386 |  				} else { | 
                                                        
| 1387 | 1387 | $error++;  | 
                                                        
| 1388 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n";  | 
                                                        |
| 1389 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity;  | 
                                                        |
| 1390 | -					dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); | 
                                                        |
| 1388 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n";  | 
                                                        |
| 1389 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity;  | 
                                                        |
| 1390 | +					dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); | 
                                                        |
| 1391 | 1391 | }  | 
                                                        
| 1392 | 1392 | |
| 1393 | 1393 |  				if (!$error && $invoiceidgenerated >= 0) { | 
                                                        
@@ -1395,12 +1395,12 @@ discard block  | 
                                                    ||
| 1395 | 1395 | $facturerec->date_last_gen = dol_now();  | 
                                                        
| 1396 | 1396 | $facturerec->date_when = $facturerec->getNextDate();  | 
                                                        
| 1397 | 1397 | $facturerec->update($user);  | 
                                                        
| 1398 | -					$this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title); | 
                                                        |
| 1399 | -					dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation'); | 
                                                        |
| 1398 | +					$this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title); | 
                                                        |
| 1399 | +					dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation'); | 
                                                        |
| 1400 | 1400 | $nb_create++;  | 
                                                        
| 1401 | 1401 |  					$this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n"; | 
                                                        
| 1402 | 1402 |  				} else { | 
                                                        
| 1403 | -					$this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id=' .$facturerec->id. ', title=' .$facturerec->title); | 
                                                        |
| 1403 | +					$this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id='.$facturerec->id.', title='.$facturerec->title); | 
                                                        |
| 1404 | 1404 | }  | 
                                                        
| 1405 | 1405 | |
| 1406 | 1406 | $parameters = array(  | 
                                                        
@@ -1493,7 +1493,7 @@ discard block  | 
                                                    ||
| 1493 | 1493 | }  | 
                                                        
| 1494 | 1494 | $result .= $linkend;  | 
                                                        
| 1495 | 1495 | global $action;  | 
                                                        
| 1496 | - $hookmanager->initHooks(array($this->element . 'dao'));  | 
                                                        |
| 1496 | + $hookmanager->initHooks(array($this->element.'dao'));  | 
                                                        |
| 1497 | 1497 |  		$parameters = array('id' => $this->id, 'getnomurl' => &$result); | 
                                                        
| 1498 | 1498 |  		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks | 
                                                        
| 1499 | 1499 |  		if ($reshook > 0) { | 
                                                        
@@ -1580,7 +1580,7 @@ discard block  | 
                                                    ||
| 1580 | 1580 | $statusType = 'status6';  | 
                                                        
| 1581 | 1581 |  					$labelStatus = $langs->transnoentitiesnoconv('Disabled'); | 
                                                        
| 1582 | 1582 |  				} else { | 
                                                        
| 1583 | - $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1583 | + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1584 | 1584 |  					$labelStatus = $langs->transnoentitiesnoconv('Draft'); | 
                                                        
| 1585 | 1585 | }  | 
                                                        
| 1586 | 1586 | }  | 
                                                        
@@ -1599,7 +1599,7 @@ discard block  | 
                                                    ||
| 1599 | 1599 | $statusType = 'status6';  | 
                                                        
| 1600 | 1600 |  					$labelStatus = $langs->transnoentitiesnoconv('Disabled'); | 
                                                        
| 1601 | 1601 |  				} else { | 
                                                        
| 1602 | - $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1602 | + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1603 | 1603 |  					$labelStatus = $langs->transnoentitiesnoconv('Draft'); | 
                                                        
| 1604 | 1604 | }  | 
                                                        
| 1605 | 1605 | }  | 
                                                        
@@ -1618,7 +1618,7 @@ discard block  | 
                                                    ||
| 1618 | 1618 | $statusType = 'status6';  | 
                                                        
| 1619 | 1619 |  					$labelStatus = $langs->transnoentitiesnoconv('Disabled'); | 
                                                        
| 1620 | 1620 |  				} else { | 
                                                        
| 1621 | - $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1621 | + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1622 | 1622 |  					$labelStatus = $langs->transnoentitiesnoconv('Draft'); | 
                                                        
| 1623 | 1623 | }  | 
                                                        
| 1624 | 1624 | }  | 
                                                        
@@ -1640,7 +1640,7 @@ discard block  | 
                                                    ||
| 1640 | 1640 | $statusType = 'status6';  | 
                                                        
| 1641 | 1641 |  					$labelStatus = $langs->transnoentitiesnoconv('Disabled'); | 
                                                        
| 1642 | 1642 |  				} else { | 
                                                        
| 1643 | - $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1643 | + $statusType = 'status0'; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 1644 | 1644 |  					$labelStatus = $langs->transnoentitiesnoconv('Draft'); | 
                                                        
| 1645 | 1645 | }  | 
                                                        
| 1646 | 1646 | }  | 
                                                        
@@ -1672,8 +1672,8 @@ discard block  | 
                                                    ||
| 1672 | 1672 | $prodids = array();  | 
                                                        
| 1673 | 1673 | |
| 1674 | 1674 | $sql = 'SELECT rowid';  | 
                                                        
| 1675 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product';  | 
                                                        |
| 1676 | -		$sql .= ' WHERE entity IN (' .getEntity('product'). ')'; | 
                                                        |
| 1675 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product';  | 
                                                        |
| 1676 | +		$sql .= ' WHERE entity IN ('.getEntity('product').')'; | 
                                                        |
| 1677 | 1677 | $sql .= $this->db->plimit(100);  | 
                                                        
| 1678 | 1678 | |
| 1679 | 1679 | $resql = $this->db->query($sql);  | 
                                                        
@@ -1712,7 +1712,7 @@ discard block  | 
                                                    ||
| 1712 | 1712 | $xnbp = 0;  | 
                                                        
| 1713 | 1713 |  			while ($xnbp < $nbp) { | 
                                                        
| 1714 | 1714 | $line = new FactureLigne($this->db);  | 
                                                        
| 1715 | -				$line->desc = $langs->trans('Description'). ' ' .$xnbp; | 
                                                        |
| 1715 | +				$line->desc = $langs->trans('Description').' '.$xnbp; | 
                                                        |
| 1716 | 1716 | $line->qty = 1;  | 
                                                        
| 1717 | 1717 | $line->subprice = 100;  | 
                                                        
| 1718 | 1718 | $line->tva_tx = 19.6;  | 
                                                        
@@ -1759,7 +1759,7 @@ discard block  | 
                                                    ||
| 1759 | 1759 | |
| 1760 | 1760 | // Add a line "offered"  | 
                                                        
| 1761 | 1761 | $line = new FactureLigne($this->db);  | 
                                                        
| 1762 | -			$line->desc = $langs->trans('Description'). ' (offered line)'; | 
                                                        |
| 1762 | +			$line->desc = $langs->trans('Description').' (offered line)'; | 
                                                        |
| 1763 | 1763 | $line->qty = 1;  | 
                                                        
| 1764 | 1764 | $line->subprice = 100;  | 
                                                        
| 1765 | 1765 | $line->tva_tx = 19.6;  | 
                                                        
@@ -1808,12 +1808,12 @@ discard block  | 
                                                    ||
| 1808 | 1808 | public function setFrequencyAndUnit($frequency, $unit)  | 
                                                        
| 1809 | 1809 |  	{ | 
                                                        
| 1810 | 1810 |  		if (!$this->table_element) { | 
                                                        
| 1811 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR);  | 
                                                        |
| 1811 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with property table_element not defined', LOG_ERR);  | 
                                                        |
| 1812 | 1812 | return -1;  | 
                                                        
| 1813 | 1813 | }  | 
                                                        
| 1814 | 1814 | |
| 1815 | 1815 |  		if (!empty($frequency) && empty($unit)) { | 
                                                        
| 1816 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR);  | 
                                                        |
| 1816 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on object with params frequency defined but unit not defined', LOG_ERR);  | 
                                                        |
| 1817 | 1817 | return -2;  | 
                                                        
| 1818 | 1818 | }  | 
                                                        
| 1819 | 1819 | |
@@ -1852,11 +1852,11 @@ discard block  | 
                                                    ||
| 1852 | 1852 | return -1;  | 
                                                        
| 1853 | 1853 | }  | 
                                                        
| 1854 | 1854 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;  | 
                                                        
| 1855 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL");  | 
                                                        |
| 1855 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL");  | 
                                                        |
| 1856 | 1856 |  		if ($increment_nb_gen_done > 0) { | 
                                                        
| 1857 | 1857 | $sql .= ", nb_gen_done = nb_gen_done + 1";  | 
                                                        
| 1858 | 1858 | }  | 
                                                        
| 1859 | - $sql .= " WHERE rowid = " . (int) $this->id;  | 
                                                        |
| 1859 | + $sql .= " WHERE rowid = ".(int) $this->id;  | 
                                                        |
| 1860 | 1860 | |
| 1861 | 1861 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG);  | 
                                                        
| 1862 | 1862 | |
@@ -1890,8 +1890,8 @@ discard block  | 
                                                    ||
| 1890 | 1890 | }  | 
                                                        
| 1891 | 1891 | |
| 1892 | 1892 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;  | 
                                                        
| 1893 | - $sql .= " SET nb_gen_max = ". (int) $nb;  | 
                                                        |
| 1894 | - $sql .= " WHERE rowid = " . (int) $this->id;  | 
                                                        |
| 1893 | + $sql .= " SET nb_gen_max = ".(int) $nb;  | 
                                                        |
| 1894 | + $sql .= " WHERE rowid = ".(int) $this->id;  | 
                                                        |
| 1895 | 1895 | |
| 1896 | 1896 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG);  | 
                                                        
| 1897 | 1897 | |
@@ -1919,7 +1919,7 @@ discard block  | 
                                                    ||
| 1919 | 1919 | |
| 1920 | 1920 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;  | 
                                                        
| 1921 | 1921 | $sql .= " SET auto_validate = ".((int) $validate);  | 
                                                        
| 1922 | - $sql .= " WHERE rowid = " . (int) $this->id;  | 
                                                        |
| 1922 | + $sql .= " WHERE rowid = ".(int) $this->id;  | 
                                                        |
| 1923 | 1923 | |
| 1924 | 1924 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG);  | 
                                                        
| 1925 | 1925 | |
@@ -1946,8 +1946,8 @@ discard block  | 
                                                    ||
| 1946 | 1946 | }  | 
                                                        
| 1947 | 1947 | |
| 1948 | 1948 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;  | 
                                                        
| 1949 | - $sql .= " SET generate_pdf = ". (int) $validate;  | 
                                                        |
| 1950 | - $sql .= " WHERE rowid = " . (int) $this->id;  | 
                                                        |
| 1949 | + $sql .= " SET generate_pdf = ".(int) $validate;  | 
                                                        |
| 1950 | + $sql .= " WHERE rowid = ".(int) $this->id;  | 
                                                        |
| 1951 | 1951 | |
| 1952 | 1952 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG);  | 
                                                        
| 1953 | 1953 | |
@@ -1975,7 +1975,7 @@ discard block  | 
                                                    ||
| 1975 | 1975 | |
| 1976 | 1976 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;  | 
                                                        
| 1977 | 1977 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'";  | 
                                                        
| 1978 | - $sql .= " WHERE rowid = " . (int) $this->id;  | 
                                                        |
| 1978 | + $sql .= " WHERE rowid = ".(int) $this->id;  | 
                                                        |
| 1979 | 1979 | |
| 1980 | 1980 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG);  | 
                                                        
| 1981 | 1981 | |
@@ -2055,8 +2055,8 @@ discard block  | 
                                                    ||
| 2055 | 2055 | $error = 0;  | 
                                                        
| 2056 | 2056 | $this->db->begin();  | 
                                                        
| 2057 | 2057 | |
| 2058 | -		if (! $error) { | 
                                                        |
| 2059 | -			if (! $notrigger) { | 
                                                        |
| 2058 | +		if (!$error) { | 
                                                        |
| 2059 | +			if (!$notrigger) { | 
                                                        |
| 2060 | 2060 | // Call triggers  | 
                                                        
| 2061 | 2061 |  				$result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); | 
                                                        
| 2062 | 2062 |  				if ($result < 0) { | 
                                                        
@@ -2066,15 +2066,15 @@ discard block  | 
                                                    ||
| 2066 | 2066 | }  | 
                                                        
| 2067 | 2067 | }  | 
                                                        
| 2068 | 2068 | |
| 2069 | -		if (! $error) { | 
                                                        |
| 2069 | +		if (!$error) { | 
                                                        |
| 2070 | 2070 | $result = $this->deleteExtraFields();  | 
                                                        
| 2071 | 2071 |  			if ($result < 0) { | 
                                                        
| 2072 | 2072 | $error++;  | 
                                                        
| 2073 | 2073 | }  | 
                                                        
| 2074 | 2074 | }  | 
                                                        
| 2075 | 2075 | |
| 2076 | -		if (! $error) { | 
                                                        |
| 2077 | - $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id;  | 
                                                        |
| 2076 | +		if (!$error) { | 
                                                        |
| 2077 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id;  | 
                                                        |
| 2078 | 2078 | |
| 2079 | 2079 | $res = $this->db->query($sql);  | 
                                                        
| 2080 | 2080 |  			if ($res === false) { | 
                                                        
@@ -2114,7 +2114,7 @@ discard block  | 
                                                    ||
| 2114 | 2114 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';  | 
                                                        
| 2115 | 2115 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';  | 
                                                        
| 2116 | 2116 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';  | 
                                                        
| 2117 | - $sql .= ' WHERE l.rowid = '. (int) $rowid;  | 
                                                        |
| 2117 | + $sql .= ' WHERE l.rowid = '.(int) $rowid;  | 
                                                        |
| 2118 | 2118 | $sql .= ' ORDER BY l.rang';  | 
                                                        
| 2119 | 2119 | |
| 2120 | 2120 |  		dol_syslog('FactureRec::fetch', LOG_DEBUG); | 
                                                        
@@ -2129,7 +2129,7 @@ discard block  | 
                                                    ||
| 2129 | 2129 | $this->ref_supplier = $objp->ref_supplier;  | 
                                                        
| 2130 | 2130 | $this->label = $objp->label;  | 
                                                        
| 2131 | 2131 | $this->description = $objp->line_desc;  | 
                                                        
| 2132 | - $this->desc = $objp->line_desc;  | 
                                                        |
| 2132 | + $this->desc = $objp->line_desc;  | 
                                                        |
| 2133 | 2133 | $this->pu_ht = $objp->pu_ht;  | 
                                                        
| 2134 | 2134 | $this->pu_ttc = $objp->pu_ttc;  | 
                                                        
| 2135 | 2135 | $this->qty = $objp->qty;  | 
                                                        
@@ -2187,44 +2187,44 @@ discard block  | 
                                                    ||
| 2187 | 2187 | |
| 2188 | 2188 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';  | 
                                                        
| 2189 | 2189 | |
| 2190 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';  | 
                                                        |
| 2191 | - $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;  | 
                                                        |
| 2192 | - $sql .= ', fk_parent_line = ' . (int) $this->fk_parent;  | 
                                                        |
| 2193 | - $sql .= ', fk_product = ' . (int) $this->fk_product;  | 
                                                        |
| 2194 | - $sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL');  | 
                                                        |
| 2195 | - $sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL');  | 
                                                        |
| 2196 | - $sql .= ", description = '" . $this->db->escape($this->desc ? $this->desc : $this->description) . "'";  | 
                                                        |
| 2197 | - $sql .= ', pu_ht = ' . price2num($this->pu_ht);  | 
                                                        |
| 2198 | - $sql .= ', pu_ttc = ' . price2num($this->pu_ttc);  | 
                                                        |
| 2199 | - $sql .= ', qty = ' . price2num($this->qty);  | 
                                                        |
| 2200 | - $sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'";  | 
                                                        |
| 2201 | - $sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except;  | 
                                                        |
| 2202 | - $sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";  | 
                                                        |
| 2203 | - $sql .= ', tva_tx = ' . price2num($this->tva_tx);  | 
                                                        |
| 2204 | - $sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);  | 
                                                        |
| 2205 | - $sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";  | 
                                                        |
| 2206 | - $sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);  | 
                                                        |
| 2207 | - $sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";  | 
                                                        |
| 2190 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';  | 
                                                        |
| 2191 | + $sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn;  | 
                                                        |
| 2192 | + $sql .= ', fk_parent_line = '.(int) $this->fk_parent;  | 
                                                        |
| 2193 | + $sql .= ', fk_product = '.(int) $this->fk_product;  | 
                                                        |
| 2194 | + $sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL');  | 
                                                        |
| 2195 | + $sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL');  | 
                                                        |
| 2196 | + $sql .= ", description = '".$this->db->escape($this->desc ? $this->desc : $this->description)."'";  | 
                                                        |
| 2197 | + $sql .= ', pu_ht = '.price2num($this->pu_ht);  | 
                                                        |
| 2198 | + $sql .= ', pu_ttc = '.price2num($this->pu_ttc);  | 
                                                        |
| 2199 | + $sql .= ', qty = '.price2num($this->qty);  | 
                                                        |
| 2200 | + $sql .= ", remise_percent = '".price2num($this->remise_percent)."'";  | 
                                                        |
| 2201 | + $sql .= ', fk_remise_except = '.(int) $this->fk_remise_except;  | 
                                                        |
| 2202 | + $sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'";  | 
                                                        |
| 2203 | + $sql .= ', tva_tx = '.price2num($this->tva_tx);  | 
                                                        |
| 2204 | + $sql .= ', localtax1_tx = '.price2num($this->localtax1_tx);  | 
                                                        |
| 2205 | + $sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'";  | 
                                                        |
| 2206 | + $sql .= ', localtax2_tx = '.price2num($this->localtax2_tx);  | 
                                                        |
| 2207 | + $sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'";  | 
                                                        |
| 2208 | 2208 |  		if (empty($this->skip_update_total)) { | 
                                                        
| 2209 | - $sql .= ', total_ht = ' . price2num($this->total_ht);  | 
                                                        |
| 2210 | - $sql .= ', total_tva = ' . price2num($this->total_tva);  | 
                                                        |
| 2211 | - $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1);  | 
                                                        |
| 2212 | - $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2);  | 
                                                        |
| 2213 | - $sql .= ', total_ttc = ' . price2num($this->total_ttc);  | 
                                                        |
| 2209 | + $sql .= ', total_ht = '.price2num($this->total_ht);  | 
                                                        |
| 2210 | + $sql .= ', total_tva = '.price2num($this->total_tva);  | 
                                                        |
| 2211 | + $sql .= ', total_localtax1 = '.price2num($this->total_localtax1);  | 
                                                        |
| 2212 | + $sql .= ', total_localtax2 = '.price2num($this->total_localtax2);  | 
                                                        |
| 2213 | + $sql .= ', total_ttc = '.price2num($this->total_ttc);  | 
                                                        |
| 2214 | 2214 | }  | 
                                                        
| 2215 | - $sql .= ', product_type = ' . (int) $this->product_type;  | 
                                                        |
| 2216 | - $sql .= ', date_start = ' . (int) $this->date_start;  | 
                                                        |
| 2217 | - $sql .= ', date_end = ' . (int) $this->date_end;  | 
                                                        |
| 2218 | - $sql .= ", info_bits = " . ((int) $this->info_bits);  | 
                                                        |
| 2219 | - $sql .= ', special_code =' . (int) $this->special_code;  | 
                                                        |
| 2220 | - $sql .= ', rang = ' . (int) $this->rang;  | 
                                                        |
| 2221 | - $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');  | 
                                                        |
| 2222 | - $sql .= ', fk_user_modif = ' . (int) $user->id;  | 
                                                        |
| 2223 | - $sql .= ' WHERE rowid = ' . (int) $this->id;  | 
                                                        |
| 2215 | + $sql .= ', product_type = '.(int) $this->product_type;  | 
                                                        |
| 2216 | + $sql .= ', date_start = '.(int) $this->date_start;  | 
                                                        |
| 2217 | + $sql .= ', date_end = '.(int) $this->date_end;  | 
                                                        |
| 2218 | + $sql .= ", info_bits = ".((int) $this->info_bits);  | 
                                                        |
| 2219 | + $sql .= ', special_code ='.(int) $this->special_code;  | 
                                                        |
| 2220 | + $sql .= ', rang = '.(int) $this->rang;  | 
                                                        |
| 2221 | + $sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');  | 
                                                        |
| 2222 | + $sql .= ', fk_user_modif = '.(int) $user->id;  | 
                                                        |
| 2223 | + $sql .= ' WHERE rowid = '.(int) $this->id;  | 
                                                        |
| 2224 | 2224 | |
| 2225 | 2225 | $this->db->begin();  | 
                                                        
| 2226 | 2226 | |
| 2227 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG);  | 
                                                        |
| 2227 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG);  | 
                                                        |
| 2228 | 2228 | $resql = $this->db->query($sql);  | 
                                                        
| 2229 | 2229 |  		if ($resql) { | 
                                                        
| 2230 | 2230 |  			if (!$error) { | 
                                                        
@@ -353,7 +353,7 @@ discard block  | 
                                                    ||
| 353 | 353 | }  | 
                                                        
| 354 | 354 | |
| 355 | 355 |  $usercanedit = $user->hasRight('website', 'write'); | 
                                                        
| 356 | -$permissiontoadd = $user->hasRight('website', 'write');	// Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles | 
                                                        |
| 356 | +$permissiontoadd = $user->hasRight('website', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles | 
                                                        |
| 357 | 357 |  $permissiontodelete = $user->hasRight('website', 'delete'); | 
                                                        
| 358 | 358 | |
| 359 | 359 | |
@@ -420,7 +420,7 @@ discard block  | 
                                                    ||
| 420 | 420 |  if ($sortorder) { | 
                                                        
| 421 | 421 | $backtopage .= '&sortorder='.urlencode($sortorder);  | 
                                                        
| 422 | 422 | }  | 
                                                        
| 423 | -include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file.  | 
                                                        |
| 423 | +include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; // This manage 'sendit', 'confirm_deletefile', 'renamefile' action when submitting new file.  | 
                                                        |
| 424 | 424 | |
| 425 | 425 | $backtopage = $savbacktopage;  | 
                                                        
| 426 | 426 | //var_dump($backtopage);  | 
                                                        
@@ -1183,7 +1183,7 @@ discard block  | 
                                                    ||
| 1183 | 1183 | $content = '';  | 
                                                        
| 1184 | 1184 |  		if (GETPOSTISSET('content')) { | 
                                                        
| 1185 | 1185 |  			//$content = GETPOST('content', 'restricthtmlallowunvalid');	// @TODO Use a restricthtmlallowunvalidwithphp | 
                                                        
| 1186 | -			$content = GETPOST('content', 'none');	// @TODO Use a restricthtmlallowunvalidwithphp | 
                                                        |
| 1186 | +			$content = GETPOST('content', 'none'); // @TODO Use a restricthtmlallowunvalidwithphp | 
                                                        |
| 1187 | 1187 | |
| 1188 | 1188 | $objectpage->content = make_substitutions($content, $substitutionarray);  | 
                                                        
| 1189 | 1189 |  		} else { | 
                                                        
@@ -1556,7 +1556,7 @@ discard block  | 
                                                    ||
| 1556 | 1556 | $error++;  | 
                                                        
| 1557 | 1557 |  					setEventMessages($langs->trans('ErrorFaviconMustBeASquaredImage'), array(), 'errors'); | 
                                                        
| 1558 | 1558 | }  | 
                                                        
| 1559 | -				if (! $error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) { | 
                                                        |
| 1559 | +				if (!$error && ($filesize[0] != 16 && $filesize[0] != 32 && $filesize[0] != 64)) { | 
                                                        |
| 1560 | 1560 | $error++;  | 
                                                        
| 1561 | 1561 |  					setEventMessages($langs->trans('ErrorFaviconSize'), array(), 'errors'); | 
                                                        
| 1562 | 1562 | }  | 
                                                        
@@ -1568,7 +1568,7 @@ discard block  | 
                                                    ||
| 1568 | 1568 |  				if (!GETPOSTISSET('updateandstay')) {	// If we click on "Save And Stay", we don not make the redirect | 
                                                        
| 1569 | 1569 | $action = 'preview';  | 
                                                        
| 1570 | 1570 |  					if ($backtopage) { | 
                                                        
| 1571 | -						$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage);	// Clean backtopage url | 
                                                        |
| 1571 | +						$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url | 
                                                        |
| 1572 | 1572 |  						header("Location: ".$backtopage); | 
                                                        
| 1573 | 1573 | exit;  | 
                                                        
| 1574 | 1574 | }  | 
                                                        
@@ -1601,7 +1601,7 @@ discard block  | 
                                                    ||
| 1601 | 1601 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1602 | 1602 | |
| 1603 | 1603 | // Security analysis  | 
                                                        
| 1604 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1604 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1605 | 1605 | |
| 1606 | 1606 |  			if (!$errorphpcheck) { | 
                                                        
| 1607 | 1607 | $htmlheadercontent = '';  | 
                                                        
@@ -1639,7 +1639,7 @@ discard block  | 
                                                    ||
| 1639 | 1639 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1640 | 1640 | |
| 1641 | 1641 | // Security analysis  | 
                                                        
| 1642 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1642 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1643 | 1643 | |
| 1644 | 1644 |  			if (!$errorphpcheck) { | 
                                                        
| 1645 | 1645 | $csscontent = '';  | 
                                                        
@@ -1682,7 +1682,7 @@ discard block  | 
                                                    ||
| 1682 | 1682 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1683 | 1683 | |
| 1684 | 1684 | // Security analysis  | 
                                                        
| 1685 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1685 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1686 | 1686 | |
| 1687 | 1687 |  			if (!$errorphpcheck) { | 
                                                        
| 1688 | 1688 | $jscontent = '';  | 
                                                        
@@ -1720,7 +1720,7 @@ discard block  | 
                                                    ||
| 1720 | 1720 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1721 | 1721 | |
| 1722 | 1722 | // Security analysis  | 
                                                        
| 1723 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1723 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1724 | 1724 | |
| 1725 | 1725 |  			if (!$errorphpcheck) { | 
                                                        
| 1726 | 1726 | $robotcontent = '';  | 
                                                        
@@ -1758,7 +1758,7 @@ discard block  | 
                                                    ||
| 1758 | 1758 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1759 | 1759 | |
| 1760 | 1760 | // Security analysis  | 
                                                        
| 1761 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1761 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1762 | 1762 | |
| 1763 | 1763 |  			if (!$errorphpcheck) { | 
                                                        
| 1764 | 1764 | $htaccesscontent = '';  | 
                                                        
@@ -1782,7 +1782,7 @@ discard block  | 
                                                    ||
| 1782 | 1782 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1783 | 1783 | |
| 1784 | 1784 | // Security analysis  | 
                                                        
| 1785 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1785 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1786 | 1786 | |
| 1787 | 1787 |  			if (!$errorphpcheck) { | 
                                                        
| 1788 | 1788 | $manifestjsoncontent = '';  | 
                                                        
@@ -1820,7 +1820,7 @@ discard block  | 
                                                    ||
| 1820 | 1820 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1821 | 1821 | |
| 1822 | 1822 | // Security analysis  | 
                                                        
| 1823 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1823 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1824 | 1824 | |
| 1825 | 1825 |  			if (!$errorphpcheck) { | 
                                                        
| 1826 | 1826 | $readmecontent = '';  | 
                                                        
@@ -1858,7 +1858,7 @@ discard block  | 
                                                    ||
| 1858 | 1858 | $phpfullcodestring = dolKeepOnlyPhpCode($dataposted);  | 
                                                        
| 1859 | 1859 | |
| 1860 | 1860 | // Security analysis  | 
                                                        
| 1861 | - $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1861 | + $errorphpcheck = checkPHPCode($phpfullcodestringold, $phpfullcodestring); // Contains the setEventMessages  | 
                                                        |
| 1862 | 1862 | |
| 1863 | 1863 |  			if (!$errorphpcheck) { | 
                                                        
| 1864 | 1864 | $licensecontent = '';  | 
                                                        
@@ -1900,7 +1900,7 @@ discard block  | 
                                                    ||
| 1900 | 1900 |  			if (!GETPOSTISSET('updateandstay')) {	// If we click on "Save And Stay", we don not make the redirect | 
                                                        
| 1901 | 1901 | $action = 'preview';  | 
                                                        
| 1902 | 1902 |  				if ($backtopage) { | 
                                                        
| 1903 | -					$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage);	// Clean backtopage url | 
                                                        |
| 1903 | +					$backtopage = preg_replace('/searchstring=[^&]*/', '', $backtopage); // Clean backtopage url | 
                                                        |
| 1904 | 1904 |  					header("Location: ".$backtopage); | 
                                                        
| 1905 | 1905 | exit;  | 
                                                        
| 1906 | 1906 | }  | 
                                                        
@@ -1919,7 +1919,7 @@ discard block  | 
                                                    ||
| 1919 | 1919 | |
| 1920 | 1920 | $object->fk_default_home = $pageid;  | 
                                                        
| 1921 | 1921 | $res = $object->update($user);  | 
                                                        
| 1922 | -	if (! ($res > 0)) { | 
                                                        |
| 1922 | +	if (!($res > 0)) { | 
                                                        |
| 1923 | 1923 | $error++;  | 
                                                        
| 1924 | 1924 | setEventMessages($object->error, $object->errors, 'errors');  | 
                                                        
| 1925 | 1925 | }  | 
                                                        
@@ -2310,7 +2310,7 @@ discard block  | 
                                                    ||
| 2310 | 2310 | |
| 2311 | 2311 | $phpfullcodestringold = dolKeepOnlyPhpCode($objectpage->content);  | 
                                                        
| 2312 | 2312 | |
| 2313 | -			$objectpage->content = GETPOST('PAGE_CONTENT', 'none');	// any HTML content allowed | 
                                                        |
| 2313 | +			$objectpage->content = GETPOST('PAGE_CONTENT', 'none'); // any HTML content allowed | 
                                                        |
| 2314 | 2314 | |
| 2315 | 2315 | $phpfullcodestring = dolKeepOnlyPhpCode($objectpage->content);  | 
                                                        
| 2316 | 2316 | |
@@ -2531,7 +2531,7 @@ discard block  | 
                                                    ||
| 2531 | 2531 | $fileofzip = '';  | 
                                                        
| 2532 | 2532 |  				if (GETPOSTISSET('templateuserfile')) { | 
                                                        
| 2533 | 2533 | // Case we selected one template  | 
                                                        
| 2534 | -					$fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha');	// $fileofzip will be sanitized later into the importWebSite() | 
                                                        |
| 2534 | +					$fileofzip = DOL_DATA_ROOT.'/doctemplates/websites/'.GETPOST('templateuserfile', 'alpha'); // $fileofzip will be sanitized later into the importWebSite() | 
                                                        |
| 2535 | 2535 |  				} elseif (!empty($_FILES) && is_array($_FILES['userfile'])) { | 
                                                        
| 2536 | 2536 | // Case we upload a new template  | 
                                                        
| 2537 | 2537 |  					if (is_array($_FILES['userfile']['tmp_name'])) { | 
                                                        
@@ -2613,7 +2613,7 @@ discard block  | 
                                                    ||
| 2613 | 2613 |  	if ($website->virtualhost) { | 
                                                        
| 2614 | 2614 | $domainname = $website->virtualhost;  | 
                                                        
| 2615 | 2615 | }  | 
                                                        
| 2616 | -	if (! preg_match('/^http/i', $domainname)) { | 
                                                        |
| 2616 | +	if (!preg_match('/^http/i', $domainname)) { | 
                                                        |
| 2617 | 2617 | $domainname = 'https://'.$domainname;  | 
                                                        
| 2618 | 2618 | }  | 
                                                        
| 2619 | 2619 | |
@@ -2679,7 +2679,7 @@ discard block  | 
                                                    ||
| 2679 | 2679 | $url->appendChild($lastmod);  | 
                                                        
| 2680 | 2680 | // Add suggested frequency for refresh  | 
                                                        
| 2681 | 2681 |  				if (getDolGlobalString('WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ')) { | 
                                                        
| 2682 | -					$changefreq = $domtree->createElement('changefreq', 'weekly');	// TODO Manage other values | 
                                                        |
| 2682 | +					$changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values | 
                                                        |
| 2683 | 2683 | $url->appendChild($changefreq);  | 
                                                        
| 2684 | 2684 | }  | 
                                                        
| 2685 | 2685 | // Add higher priority for home page  | 
                                                        
@@ -2784,7 +2784,7 @@ discard block  | 
                                                    ||
| 2784 | 2784 | $url->appendChild($lastmod);  | 
                                                        
| 2785 | 2785 | // Add suggested frequency for refresh  | 
                                                        
| 2786 | 2786 |  				if (getDolGlobalString('WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ')) { | 
                                                        
| 2787 | -					$changefreq = $domtree->createElement('changefreq', 'weekly');	// TODO Manage other values | 
                                                        |
| 2787 | +					$changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values | 
                                                        |
| 2788 | 2788 | $url->appendChild($changefreq);  | 
                                                        
| 2789 | 2789 | }  | 
                                                        
| 2790 | 2790 | |
@@ -3418,7 +3418,7 @@ discard block  | 
                                                    ||
| 3418 | 3418 | print '<!-- button EditInLine and ShowSubcontainers -->'."\n";  | 
                                                        
| 3419 | 3419 | print '<div class="websiteselectionsection inline-block">';  | 
                                                        
| 3420 | 3420 | |
| 3421 | - print '<div class="inline-block marginrightonly">'; // Button includes dynamic content  | 
                                                        |
| 3421 | + print '<div class="inline-block marginrightonly">'; // Button includes dynamic content  | 
                                                        |
| 3422 | 3422 |  				print $langs->trans("ShowSubcontainers"); | 
                                                        
| 3423 | 3423 |  				if (!getDolGlobalString('WEBSITE_SUBCONTAINERSINLINE')) { | 
                                                        
| 3424 | 3424 |  					print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>'; | 
                                                        
@@ -3427,7 +3427,7 @@ discard block  | 
                                                    ||
| 3427 | 3427 | }  | 
                                                        
| 3428 | 3428 | print '</div>';  | 
                                                        
| 3429 | 3429 | |
| 3430 | - print '<div class="inline-block marginrightonly">'; // Button edit inline  | 
                                                        |
| 3430 | + print '<div class="inline-block marginrightonly">'; // Button edit inline  | 
                                                        |
| 3431 | 3431 | |
| 3432 | 3432 | print '<span id="switchckeditorinline">'."\n";  | 
                                                        
| 3433 | 3433 | // Enable CKEditor inline with js on section and div with conteneditable=true  | 
                                                        
@@ -3547,7 +3547,7 @@ discard block  | 
                                                    ||
| 3547 | 3547 |  				} else { | 
                                                        
| 3548 | 3548 | $disabled = '';  | 
                                                        
| 3549 | 3549 | $title = '';  | 
                                                        
| 3550 | - $url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&pageid='.((int) $websitepage->id).'&website='.urlencode($website->ref); // action=delete for webpage, deletesite for website  | 
                                                        |
| 3550 | + $url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&pageid='.((int) $websitepage->id).'&website='.urlencode($website->ref); // action=delete for webpage, deletesite for website  | 
                                                        |
| 3551 | 3551 | }  | 
                                                        
| 3552 | 3552 |  				print '<a href="'.$url.'" class="button buttonDelete bordertransp'.($disabled ? ' disabled' : '').'"'.$disabled.' title="'.dol_escape_htmltag($title).'">'.img_picto('', 'delete', 'class=""').'<span class="hideonsmartphone paddingleft">'.$langs->trans("Delete").'</span></a>'; | 
                                                        
| 3553 | 3553 | print '</span>';  | 
                                                        
@@ -3767,7 +3767,7 @@ discard block  | 
                                                    ||
| 3767 | 3767 | // Clean the php htaccesscontent file to remove php code and get only html part  | 
                                                        
| 3768 | 3768 |  		$htaccesscontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htaccesscontent); | 
                                                        
| 3769 | 3769 |  	} else { | 
                                                        
| 3770 | -		$htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml');	// We must use 'nohtml' and not 'alphanohtml' because we must accept " | 
                                                        |
| 3770 | +		$htaccesscontent = GETPOST('WEBSITE_HTACCESS', 'nohtml'); // We must use 'nohtml' and not 'alphanohtml' because we must accept " | 
                                                        |
| 3771 | 3771 | }  | 
                                                        
| 3772 | 3772 |  	if (!trim($htaccesscontent)) { | 
                                                        
| 3773 | 3773 | $htaccesscontent .= "# Order allow,deny\n";  | 
                                                        
@@ -3869,7 +3869,7 @@ discard block  | 
                                                    ||
| 3869 | 3869 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 3870 | 3870 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 3871 | 3871 |  	if ($maxmin > 0) { | 
                                                        
| 3872 | - print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 3872 | + print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 3873 | 3873 | }  | 
                                                        
| 3874 | 3874 | print '<input type="file" class="flat minwidth300" name="addedfile" id="addedfile"/>';  | 
                                                        
| 3875 | 3875 | |
@@ -4126,7 +4126,7 @@ discard block  | 
                                                    ||
| 4126 | 4126 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 4127 | 4127 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 4128 | 4128 |  		if ($maxmin > 0) { | 
                                                        
| 4129 | - print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 4129 | + print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 4130 | 4130 | }  | 
                                                        
| 4131 | 4131 | print '<input class="flat minwidth400" type="file" name="userfile[]" accept=".zip">';  | 
                                                        
| 4132 | 4132 |  		print '<input type="submit" class="button small" name="buttonsubmitimportfile" value="'.dol_escape_htmltag($langs->trans("Upload")).'">'; | 
                                                        
@@ -4726,7 +4726,7 @@ discard block  | 
                                                    ||
| 4726 | 4726 | |
| 4727 | 4727 | |
| 4728 | 4728 | $module = 'medias';  | 
                                                        
| 4729 | - $formalreadyopen = 2; // So the form to submit a new file will not be opened another time inside the core/tpl/filemanager.tpl.php  | 
                                                        |
| 4729 | + $formalreadyopen = 2; // So the form to submit a new file will not be opened another time inside the core/tpl/filemanager.tpl.php  | 
                                                        |
| 4730 | 4730 |  	if (empty($url)) { | 
                                                        
| 4731 | 4731 | $url = DOL_URL_ROOT.'/website/index.php'; // Must be an url without param  | 
                                                        
| 4732 | 4732 | }  | 
                                                        
@@ -4962,8 +4962,8 @@ discard block  | 
                                                    ||
| 4962 | 4962 |  			print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; | 
                                                        
| 4963 | 4963 |  			print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); | 
                                                        
| 4964 | 4964 |  			print getTitleFieldOfList("UserCreation", 0, $_SERVER['PHP_SELF'], 'fk_user_creat', '', $param, '', $sortfield, $sortorder, '')."\n"; | 
                                                        
| 4965 | -			print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n";		// Date creation | 
                                                        |
| 4966 | -			print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";		// Date last modif | 
                                                        |
| 4965 | +			print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date creation | 
                                                        |
| 4966 | +			print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif | 
                                                        |
| 4967 | 4967 |  			print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); | 
                                                        
| 4968 | 4968 | // Action column  | 
                                                        
| 4969 | 4969 |  			if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { | 
                                                        
@@ -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();  | 
                                                        
@@ -838,9 +838,9 @@ discard block  | 
                                                    ||
| 838 | 838 | return;  | 
                                                        
| 839 | 839 | }  | 
                                                        
| 840 | 840 |  		if (empty($reshook)) { | 
                                                        
| 841 | -			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>'; | 
                                                        |
| 841 | +			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>'; | 
                                                        |
| 842 | 842 |  			foreach ($arrayofaction as $code => $label) { | 
                                                        
| 843 | - $ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';  | 
                                                        |
| 843 | + $ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';  | 
                                                        |
| 844 | 844 | }  | 
                                                        
| 845 | 845 | }  | 
                                                        
| 846 | 846 | $ret .= $hookmanager->resPrint;  | 
                                                        
@@ -848,17 +848,17 @@ discard block  | 
                                                    ||
| 848 | 848 | $ret .= '</select>';  | 
                                                        
| 849 | 849 | |
| 850 | 850 |  		if (empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 851 | -			$ret .= ajax_combobox('.' . $name . 'select'); | 
                                                        |
| 851 | +			$ret .= ajax_combobox('.'.$name.'select'); | 
                                                        |
| 852 | 852 | }  | 
                                                        
| 853 | 853 | |
| 854 | 854 | // 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  | 
                                                        
| 855 | 855 | $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.  | 
                                                        
| 856 | -		$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")) . '">'; | 
                                                        |
| 856 | +		$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")).'">'; | 
                                                        |
| 857 | 857 | $ret .= '</div>';  | 
                                                        
| 858 | 858 | |
| 859 | 859 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 860 | 860 | $ret .= '<!-- JS CODE TO ENABLE mass action select -->  | 
                                                        
| 861 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 861 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 862 | 862 | 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 */  | 
                                                        
| 863 | 863 |          		{ | 
                                                        
| 864 | 864 | atleastoneselected=0;  | 
                                                        
@@ -869,11 +869,11 @@ discard block  | 
                                                    ||
| 869 | 869 | |
| 870 | 870 |  					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected); | 
                                                        
| 871 | 871 | |
| 872 | - if (atleastoneselected || ' . $alwaysvisible . ')  | 
                                                        |
| 872 | + if (atleastoneselected || ' . $alwaysvisible.')  | 
                                                        |
| 873 | 873 |      	  			{ | 
                                                        
| 874 | 874 |                                      jQuery("."+name).show(); | 
                                                        
| 875 | -        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . ' | 
                                                        |
| 876 | -        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . ' | 
                                                        |
| 875 | +        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').' | 
                                                        |
| 876 | +        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').' | 
                                                        |
| 877 | 877 | }  | 
                                                        
| 878 | 878 | else  | 
                                                        
| 879 | 879 |      	  			{ | 
                                                        
@@ -883,11 +883,11 @@ discard block  | 
                                                    ||
| 883 | 883 | }  | 
                                                        
| 884 | 884 | |
| 885 | 885 |          	jQuery(document).ready(function () { | 
                                                        
| 886 | - initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");  | 
                                                        |
| 887 | -                    jQuery(".' . $cssclass . '").click(function() { | 
                                                        |
| 888 | - initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");  | 
                                                        |
| 886 | + initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");  | 
                                                        |
| 887 | +                    jQuery(".' . $cssclass.'").click(function() { | 
                                                        |
| 888 | + initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");  | 
                                                        |
| 889 | 889 | });  | 
                                                        
| 890 | -                        jQuery(".' . $name . 'select").change(function() { | 
                                                        |
| 890 | +                        jQuery(".' . $name.'select").change(function() { | 
                                                        |
| 891 | 891 | var massaction = $( this ).val();  | 
                                                        
| 892 | 892 |          			var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); | 
                                                        
| 893 | 893 | if (massaction == "builddoc")  | 
                                                        
@@ -895,18 +895,18 @@ discard block  | 
                                                    ||
| 895 | 895 | urlform = urlform + "#show_files";  | 
                                                        
| 896 | 896 | }  | 
                                                        
| 897 | 897 |          			$( this ).closest("form").attr("action", urlform); | 
                                                        
| 898 | -                    console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform); | 
                                                        |
| 898 | +                    console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform); | 
                                                        |
| 899 | 899 | /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */  | 
                                                        
| 900 | 900 | if ($(this).val() != \'0\')  | 
                                                        
| 901 | 901 |      	  			{ | 
                                                        
| 902 | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); | 
                                                        |
| 903 | -										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */ | 
                                                        |
| 904 | -                                        jQuery(".' . $name . '"+massaction).show(); | 
                                                        |
| 902 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false); | 
                                                        |
| 903 | +										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */ | 
                                                        |
| 904 | +                                        jQuery(".' . $name.'"+massaction).show(); | 
                                                        |
| 905 | 905 | }  | 
                                                        
| 906 | 906 | else  | 
                                                        
| 907 | 907 |      	  			{ | 
                                                        
| 908 | -                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); | 
                                                        |
| 909 | -										jQuery(".' . $name . 'other").hide();	/* To disable any div open */ | 
                                                        |
| 908 | +                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', true); | 
                                                        |
| 909 | +										jQuery(".' . $name.'other").hide();	/* To disable any div open */ | 
                                                        |
| 910 | 910 | }  | 
                                                        
| 911 | 911 | });  | 
                                                        
| 912 | 912 | });  | 
                                                        
@@ -949,14 +949,14 @@ discard block  | 
                                                    ||
| 949 | 949 | $atleastonefavorite = 0;  | 
                                                        
| 950 | 950 | |
| 951 | 951 | $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite, eec";  | 
                                                        
| 952 | - $sql .= " FROM " . $this->db->prefix() . "c_country";  | 
                                                        |
| 952 | + $sql .= " FROM ".$this->db->prefix()."c_country";  | 
                                                        |
| 953 | 953 | $sql .= " WHERE active > 0";  | 
                                                        
| 954 | 954 | //$sql.= " ORDER BY code ASC";  | 
                                                        
| 955 | 955 | |
| 956 | - dol_syslog(get_class($this) . "::select_country", LOG_DEBUG);  | 
                                                        |
| 956 | + dol_syslog(get_class($this)."::select_country", LOG_DEBUG);  | 
                                                        |
| 957 | 957 | $resql = $this->db->query($sql);  | 
                                                        
| 958 | 958 |  		if ($resql) { | 
                                                        
| 959 | - $out .= '<select id="select' . $htmlname . '" class="flat maxwidth200onsmartphone selectcountry' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        |
| 959 | + $out .= '<select id="select'.$htmlname.'" class="flat maxwidth200onsmartphone selectcountry'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        |
| 960 | 960 | $num = $this->db->num_rows($resql);  | 
                                                        
| 961 | 961 | $i = 0;  | 
                                                        
| 962 | 962 |  			if ($num) { | 
                                                        
@@ -966,7 +966,7 @@ discard block  | 
                                                    ||
| 966 | 966 | $countryArray[$i]['rowid'] = $obj->rowid;  | 
                                                        
| 967 | 967 | $countryArray[$i]['code_iso'] = $obj->code_iso;  | 
                                                        
| 968 | 968 | $countryArray[$i]['code_iso3'] = $obj->code_iso3;  | 
                                                        
| 969 | -					$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 : '')); | 
                                                        |
| 969 | +					$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 : '')); | 
                                                        |
| 970 | 970 | $countryArray[$i]['favorite'] = $obj->favorite;  | 
                                                        
| 971 | 971 | $countryArray[$i]['eec'] = $obj->eec;  | 
                                                        
| 972 | 972 | $favorite[$i] = $obj->favorite;  | 
                                                        
@@ -984,20 +984,20 @@ discard block  | 
                                                    ||
| 984 | 984 | |
| 985 | 985 |  				if ($showempty) { | 
                                                        
| 986 | 986 |  					if (is_numeric($showempty)) { | 
                                                        
| 987 | - $out .= '<option value=""> </option>' . "\n";  | 
                                                        |
| 987 | + $out .= '<option value=""> </option>'."\n";  | 
                                                        |
| 988 | 988 |  					} else { | 
                                                        
| 989 | - $out .= '<option value="-1">' . $langs->trans($showempty) . '</option>' . "\n";  | 
                                                        |
| 989 | + $out .= '<option value="-1">'.$langs->trans($showempty).'</option>'."\n";  | 
                                                        |
| 990 | 990 | }  | 
                                                        
| 991 | 991 | }  | 
                                                        
| 992 | 992 | |
| 993 | 993 |  				if ($addspecialentries) {    // Add dedicated entries for groups of countries | 
                                                        
| 994 | 994 | //if ($showempty) $out.= '<option value="" disabled class="selectoptiondisabledwhite">--------------</option>';  | 
                                                        
| 995 | -					$out .= '<option value="special_allnotme"' . ($selected == 'special_allnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        |
| 996 | -					$out .= '<option value="special_eec"' . ($selected == 'special_eec' ? ' selected' : '') . '>' . $langs->trans("CountriesInEEC") . '</option>'; | 
                                                        |
| 995 | +					$out .= '<option value="special_allnotme"'.($selected == 'special_allnotme' ? ' selected' : '').'>'.$langs->trans("CountriesExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        |
| 996 | +					$out .= '<option value="special_eec"'.($selected == 'special_eec' ? ' selected' : '').'>'.$langs->trans("CountriesInEEC").'</option>'; | 
                                                        |
| 997 | 997 |  					if ($mysoc->isInEEC()) { | 
                                                        
| 998 | -						$out .= '<option value="special_eecnotme"' . ($selected == 'special_eecnotme' ? ' selected' : '') . '>' . $langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country" . $mysoc->country_code)) . '</option>'; | 
                                                        |
| 998 | +						$out .= '<option value="special_eecnotme"'.($selected == 'special_eecnotme' ? ' selected' : '').'>'.$langs->trans("CountriesInEECExceptMe", $langs->transnoentitiesnoconv("Country".$mysoc->country_code)).'</option>'; | 
                                                        |
| 999 | 999 | }  | 
                                                        
| 1000 | -					$out .= '<option value="special_noteec"' . ($selected == 'special_noteec' ? ' selected' : '') . '>' . $langs->trans("CountriesNotInEEC") . '</option>'; | 
                                                        |
| 1000 | +					$out .= '<option value="special_noteec"'.($selected == 'special_noteec' ? ' selected' : '').'>'.$langs->trans("CountriesNotInEEC").'</option>'; | 
                                                        |
| 1001 | 1001 | $out .= '<option value="" disabled class="selectoptiondisabledwhite">------------</option>';  | 
                                                        
| 1002 | 1002 | }  | 
                                                        
| 1003 | 1003 | |
@@ -1025,20 +1025,20 @@ discard block  | 
                                                    ||
| 1025 | 1025 | $labeltoshow .= ' ';  | 
                                                        
| 1026 | 1026 | }  | 
                                                        
| 1027 | 1027 |  					if ($row['code_iso']) { | 
                                                        
| 1028 | -						$labeltoshow .= ' <span class="opacitymedium">(' . $row['code_iso'] . ')</span>'; | 
                                                        |
| 1028 | +						$labeltoshow .= ' <span class="opacitymedium">('.$row['code_iso'].')</span>'; | 
                                                        |
| 1029 | 1029 |  						if (empty($hideflags)) { | 
                                                        
| 1030 | 1030 | $tmpflag = picto_from_langcode($row['code_iso'], 'class="saturatemedium paddingrightonly"', 1);  | 
                                                        
| 1031 | - $labeltoshow = $tmpflag . ' ' . $labeltoshow;  | 
                                                        |
| 1031 | + $labeltoshow = $tmpflag.' '.$labeltoshow;  | 
                                                        |
| 1032 | 1032 | }  | 
                                                        
| 1033 | 1033 | }  | 
                                                        
| 1034 | 1034 | |
| 1035 | 1035 |  					if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label'])) { | 
                                                        
| 1036 | - $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']) . '">';  | 
                                                        |
| 1036 | + $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']).'">';  | 
                                                        |
| 1037 | 1037 |  					} else { | 
                                                        
| 1038 | - $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']) . '">';  | 
                                                        |
| 1038 | + $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']).'">';  | 
                                                        |
| 1039 | 1039 | }  | 
                                                        
| 1040 | 1040 | $out .= $labeltoshow;  | 
                                                        
| 1041 | - $out .= '</option>' . "\n";  | 
                                                        |
| 1041 | + $out .= '</option>'."\n";  | 
                                                        |
| 1042 | 1042 | }  | 
                                                        
| 1043 | 1043 | }  | 
                                                        
| 1044 | 1044 | $out .= '</select>';  | 
                                                        
@@ -1047,8 +1047,8 @@ discard block  | 
                                                    ||
| 1047 | 1047 | }  | 
                                                        
| 1048 | 1048 | |
| 1049 | 1049 | // Make select dynamic  | 
                                                        
| 1050 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1051 | -		$out .= ajax_combobox('select' . $htmlname, array(), 0, 0, 'resolve'); | 
                                                        |
| 1050 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1051 | +		$out .= ajax_combobox('select'.$htmlname, array(), 0, 0, 'resolve'); | 
                                                        |
| 1052 | 1052 | |
| 1053 | 1053 | return $out;  | 
                                                        
| 1054 | 1054 | }  | 
                                                        
@@ -1080,25 +1080,25 @@ discard block  | 
                                                    ||
| 1080 | 1080 | $incotermArray = array();  | 
                                                        
| 1081 | 1081 | |
| 1082 | 1082 | $sql = "SELECT rowid, code";  | 
                                                        
| 1083 | - $sql .= " FROM " . $this->db->prefix() . "c_incoterms";  | 
                                                        |
| 1083 | + $sql .= " FROM ".$this->db->prefix()."c_incoterms";  | 
                                                        |
| 1084 | 1084 | $sql .= " WHERE active > 0";  | 
                                                        
| 1085 | 1085 | $sql .= " ORDER BY code ASC";  | 
                                                        
| 1086 | 1086 | |
| 1087 | - dol_syslog(get_class($this) . "::select_incoterm", LOG_DEBUG);  | 
                                                        |
| 1087 | + dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);  | 
                                                        |
| 1088 | 1088 | $resql = $this->db->query($sql);  | 
                                                        
| 1089 | 1089 |  		if ($resql) { | 
                                                        
| 1090 | 1090 |  			if ($conf->use_javascript_ajax && !$forcecombo) { | 
                                                        
| 1091 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1091 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1092 | 1092 | $out .= ajax_combobox($htmlname, $events);  | 
                                                        
| 1093 | 1093 | }  | 
                                                        
| 1094 | 1094 | |
| 1095 | 1095 |  			if (!empty($page)) { | 
                                                        
| 1096 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 1096 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 1097 | 1097 | $out .= '<input type="hidden" name="action" value="set_incoterms">';  | 
                                                        
| 1098 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 1098 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 1099 | 1099 | }  | 
                                                        
| 1100 | 1100 | |
| 1101 | - $out .= '<select id="' . $htmlname . '" class="flat selectincoterm width75" name="' . $htmlname . '" ' . $htmloption . '>';  | 
                                                        |
| 1101 | + $out .= '<select id="'.$htmlname.'" class="flat selectincoterm width75" name="'.$htmlname.'" '.$htmloption.'>';  | 
                                                        |
| 1102 | 1102 | $out .= '<option value="0"> </option>';  | 
                                                        
| 1103 | 1103 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1104 | 1104 | $i = 0;  | 
                                                        
@@ -1112,9 +1112,9 @@ discard block  | 
                                                    ||
| 1112 | 1112 | |
| 1113 | 1113 |  				foreach ($incotermArray as $row) { | 
                                                        
| 1114 | 1114 |  					if ($selected && ($selected == $row['rowid'] || $selected == $row['code'])) { | 
                                                        
| 1115 | - $out .= '<option value="' . $row['rowid'] . '" selected>';  | 
                                                        |
| 1115 | + $out .= '<option value="'.$row['rowid'].'" selected>';  | 
                                                        |
| 1116 | 1116 |  					} else { | 
                                                        
| 1117 | - $out .= '<option value="' . $row['rowid'] . '">';  | 
                                                        |
| 1117 | + $out .= '<option value="'.$row['rowid'].'">';  | 
                                                        |
| 1118 | 1118 | }  | 
                                                        
| 1119 | 1119 | |
| 1120 | 1120 |  					if ($row['code']) { | 
                                                        
@@ -1127,13 +1127,13 @@ discard block  | 
                                                    ||
| 1127 | 1127 | $out .= '</select>';  | 
                                                        
| 1128 | 1128 | |
| 1129 | 1129 |  			if ($conf->use_javascript_ajax && empty($disableautocomplete)) { | 
                                                        
| 1130 | -				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n"; | 
                                                        |
| 1130 | +				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n"; | 
                                                        |
| 1131 | 1131 | $moreattrib .= ' autocomplete="off"';  | 
                                                        
| 1132 | 1132 | }  | 
                                                        
| 1133 | - $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";  | 
                                                        |
| 1133 | + $out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";  | 
                                                        |
| 1134 | 1134 | |
| 1135 | 1135 |  			if (!empty($page)) { | 
                                                        
| 1136 | -				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>'; | 
                                                        |
| 1136 | +				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>'; | 
                                                        |
| 1137 | 1137 | }  | 
                                                        
| 1138 | 1138 |  		} else { | 
                                                        
| 1139 | 1139 | dol_print_error($this->db);  | 
                                                        
@@ -1164,9 +1164,9 @@ discard block  | 
                                                    ||
| 1164 | 1164 |  		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service")) | 
                                                        
| 1165 | 1165 |  			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) { | 
                                                        
| 1166 | 1166 |  			if (empty($hidetext)) { | 
                                                        
| 1167 | -				print $langs->trans("Type") . ': '; | 
                                                        |
| 1167 | +				print $langs->trans("Type").': '; | 
                                                        |
| 1168 | 1168 | }  | 
                                                        
| 1169 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 1169 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 1170 | 1170 |  			if ($showempty) { | 
                                                        
| 1171 | 1171 | print '<option value="-1"';  | 
                                                        
| 1172 | 1172 |  				if ($selected == -1) { | 
                                                        
@@ -1179,28 +1179,28 @@ discard block  | 
                                                    ||
| 1179 | 1179 |  			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) { | 
                                                        
| 1180 | 1180 | print ' selected';  | 
                                                        
| 1181 | 1181 | }  | 
                                                        
| 1182 | -			print '>' . $langs->trans("Product"); | 
                                                        |
| 1182 | +			print '>'.$langs->trans("Product"); | 
                                                        |
| 1183 | 1183 | |
| 1184 | 1184 | print '<option value="1"';  | 
                                                        
| 1185 | 1185 |  			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) { | 
                                                        
| 1186 | 1186 | print ' selected';  | 
                                                        
| 1187 | 1187 | }  | 
                                                        
| 1188 | -			print '>' . $langs->trans("Service"); | 
                                                        |
| 1188 | +			print '>'.$langs->trans("Service"); | 
                                                        |
| 1189 | 1189 | |
| 1190 | 1190 | print '</select>';  | 
                                                        
| 1191 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 1191 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 1192 | 1192 |  			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); | 
                                                        
| 1193 | 1193 | }  | 
                                                        
| 1194 | 1194 |  		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) { | 
                                                        
| 1195 | 1195 |  			print $langs->trans("Service"); | 
                                                        
| 1196 | - print '<input type="hidden" name="' . $htmlname . '" value="1">';  | 
                                                        |
| 1196 | + print '<input type="hidden" name="'.$htmlname.'" value="1">';  | 
                                                        |
| 1197 | 1197 | }  | 
                                                        
| 1198 | 1198 |  		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) { | 
                                                        
| 1199 | 1199 |  			print $langs->trans("Product"); | 
                                                        
| 1200 | - print '<input type="hidden" name="' . $htmlname . '" value="0">';  | 
                                                        |
| 1200 | + print '<input type="hidden" name="'.$htmlname.'" value="0">';  | 
                                                        |
| 1201 | 1201 | }  | 
                                                        
| 1202 | 1202 |  		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled. | 
                                                        
| 1203 | - 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  | 
                                                        |
| 1203 | + 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  | 
                                                        |
| 1204 | 1204 | }  | 
                                                        
| 1205 | 1205 | }  | 
                                                        
| 1206 | 1206 | |
@@ -1226,7 +1226,7 @@ discard block  | 
                                                    ||
| 1226 | 1226 |  		$langs->load("trips"); | 
                                                        
| 1227 | 1227 | |
| 1228 | 1228 | $sql = "SELECT c.code, c.label";  | 
                                                        
| 1229 | - $sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";  | 
                                                        |
| 1229 | + $sql .= " FROM ".$this->db->prefix()."c_type_fees as c";  | 
                                                        |
| 1230 | 1230 | $sql .= " WHERE active > 0";  | 
                                                        
| 1231 | 1231 | |
| 1232 | 1232 | $resql = $this->db->query($sql);  | 
                                                        
@@ -1267,11 +1267,11 @@ discard block  | 
                                                    ||
| 1267 | 1267 | // phpcs:enable  | 
                                                        
| 1268 | 1268 | global $user, $langs;  | 
                                                        
| 1269 | 1269 | |
| 1270 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 1270 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 1271 | 1271 | |
| 1272 | 1272 | $this->load_cache_types_fees();  | 
                                                        
| 1273 | 1273 | |
| 1274 | - print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';  | 
                                                        |
| 1274 | + print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';  | 
                                                        |
| 1275 | 1275 |  		if ($showempty) { | 
                                                        
| 1276 | 1276 | print '<option value="-1"';  | 
                                                        
| 1277 | 1277 |  			if ($selected == -1) { | 
                                                        
@@ -1281,7 +1281,7 @@ discard block  | 
                                                    ||
| 1281 | 1281 | }  | 
                                                        
| 1282 | 1282 | |
| 1283 | 1283 |  		foreach ($this->cache_types_fees as $key => $value) { | 
                                                        
| 1284 | - print '<option value="' . $key . '"';  | 
                                                        |
| 1284 | + print '<option value="'.$key.'"';  | 
                                                        |
| 1285 | 1285 |  			if ($key == $selected) { | 
                                                        
| 1286 | 1286 | print ' selected';  | 
                                                        
| 1287 | 1287 | }  | 
                                                        
@@ -1332,12 +1332,12 @@ discard block  | 
                                                    ||
| 1332 | 1332 | $ajaxoptions = array();  | 
                                                        
| 1333 | 1333 | }  | 
                                                        
| 1334 | 1334 | |
| 1335 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1335 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1336 | 1336 | |
| 1337 | 1337 | // No immediate load of all database  | 
                                                        
| 1338 | 1338 | $placeholder = '';  | 
                                                        
| 1339 | 1339 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 1340 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 1340 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 1341 | 1341 | $societetmp = new Societe($this->db);  | 
                                                        
| 1342 | 1342 | $societetmp->fetch($selected);  | 
                                                        
| 1343 | 1343 | $selected_input_value = $societetmp->name;  | 
                                                        
@@ -1345,25 +1345,25 @@ discard block  | 
                                                    ||
| 1345 | 1345 | }  | 
                                                        
| 1346 | 1346 | |
| 1347 | 1347 | // mode 1  | 
                                                        
| 1348 | -			$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)) : ''); | 
                                                        |
| 1348 | +			$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)) : ''); | 
                                                        |
| 1349 | 1349 | |
| 1350 | 1350 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 1351 | 1351 |  			if (empty($hidelabel)) { | 
                                                        
| 1352 | -				print $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 1352 | +				print $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 1353 | 1353 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 1354 | 1354 |  				$placeholder = $langs->trans("RefOrLabel"); | 
                                                        
| 1355 | 1355 |  				if ($hidelabel == 2) { | 
                                                        
| 1356 | 1356 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1357 | 1357 | }  | 
                                                        
| 1358 | 1358 | }  | 
                                                        
| 1359 | -			$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' : '') . ' />'; | 
                                                        |
| 1359 | +			$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' : '').' />'; | 
                                                        |
| 1360 | 1360 |  			if ($hidelabel == 3) { | 
                                                        
| 1361 | 1361 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 1362 | 1362 | }  | 
                                                        
| 1363 | 1363 | |
| 1364 | 1364 | $out .= ajax_event($htmlname, $events);  | 
                                                        
| 1365 | 1365 | |
| 1366 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 1366 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 1367 | 1367 |  		} else { | 
                                                        
| 1368 | 1368 | // Immediate load of all database  | 
                                                        
| 1369 | 1369 | $out .= $this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple, $excludeids, $showcode);  | 
                                                        
@@ -1447,30 +1447,30 @@ discard block  | 
                                                    ||
| 1447 | 1447 | $sql .= ", s.address, s.zip, s.town";  | 
                                                        
| 1448 | 1448 | $sql .= ", dictp.code as country_code";  | 
                                                        
| 1449 | 1449 | }  | 
                                                        
| 1450 | - $sql .= " FROM " . $this->db->prefix() . "societe as s";  | 
                                                        |
| 1450 | + $sql .= " FROM ".$this->db->prefix()."societe as s";  | 
                                                        |
| 1451 | 1451 |  		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1452 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1452 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";  | 
                                                        |
| 1453 | 1453 | }  | 
                                                        
| 1454 | 1454 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1455 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 1455 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 1456 | 1456 | }  | 
                                                        
| 1457 | -		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")"; | 
                                                        |
| 1457 | +		$sql .= " WHERE s.entity IN (".getEntity('societe').")"; | 
                                                        |
| 1458 | 1458 |  		if (!empty($user->socid)) { | 
                                                        
| 1459 | - $sql .= " AND s.rowid = " . ((int) $user->socid);  | 
                                                        |
| 1459 | + $sql .= " AND s.rowid = ".((int) $user->socid);  | 
                                                        |
| 1460 | 1460 | }  | 
                                                        
| 1461 | 1461 |  		if ($filter) { | 
                                                        
| 1462 | 1462 |  			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria() | 
                                                        
| 1463 | 1463 | // if not, by testSqlAndScriptInject() only.  | 
                                                        
| 1464 | -			$sql .= " AND (" . $filter . ")"; | 
                                                        |
| 1464 | +			$sql .= " AND (".$filter.")"; | 
                                                        |
| 1465 | 1465 | }  | 
                                                        
| 1466 | 1466 |  		if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 1467 | - $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 1467 | + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 1468 | 1468 | }  | 
                                                        
| 1469 | 1469 |  		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1470 | 1470 | $sql .= " AND s.status <> 0";  | 
                                                        
| 1471 | 1471 | }  | 
                                                        
| 1472 | 1472 |  		if (!empty($excludeids)) { | 
                                                        
| 1473 | -			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")"; | 
                                                        |
| 1473 | +			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")"; | 
                                                        |
| 1474 | 1474 | }  | 
                                                        
| 1475 | 1475 | // Add where from hooks  | 
                                                        
| 1476 | 1476 | $parameters = array();  | 
                                                        
@@ -1490,17 +1490,17 @@ discard block  | 
                                                    ||
| 1490 | 1490 |  				if ($i > 0) { | 
                                                        
| 1491 | 1491 | $sql .= " AND ";  | 
                                                        
| 1492 | 1492 | }  | 
                                                        
| 1493 | - $sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 1493 | + $sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 1494 | 1494 | $i++;  | 
                                                        
| 1495 | 1495 | }  | 
                                                        
| 1496 | 1496 |  			if (count($search_crit) > 1) { | 
                                                        
| 1497 | 1497 | $sql .= ")";  | 
                                                        
| 1498 | 1498 | }  | 
                                                        
| 1499 | 1499 |  			if (isModEnabled('barcode')) { | 
                                                        
| 1500 | - $sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1500 | + $sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1501 | 1501 | }  | 
                                                        
| 1502 | - $sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1503 | - $sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 1502 | + $sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1503 | + $sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 1504 | 1504 | $sql .= ")";  | 
                                                        
| 1505 | 1505 | }  | 
                                                        
| 1506 | 1506 |  		$sql .= $this->db->order("nom", "ASC"); | 
                                                        
@@ -1511,12 +1511,12 @@ discard block  | 
                                                    ||
| 1511 | 1511 | $resql = $this->db->query($sql);  | 
                                                        
| 1512 | 1512 |  		if ($resql) { | 
                                                        
| 1513 | 1513 |  			if (!$forcecombo) { | 
                                                        
| 1514 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1514 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1515 | 1515 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1516 | 1516 | }  | 
                                                        
| 1517 | 1517 | |
| 1518 | 1518 | // Construct $out and $outarray  | 
                                                        
| 1519 | - $out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";  | 
                                                        |
| 1519 | + $out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";  | 
                                                        |
| 1520 | 1520 | |
| 1521 | 1521 | $textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');  | 
                                                        
| 1522 | 1522 |  			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) { | 
                                                        
@@ -1529,7 +1529,7 @@ discard block  | 
                                                    ||
| 1529 | 1529 | }  | 
                                                        
| 1530 | 1530 | }  | 
                                                        
| 1531 | 1531 |  			if ($showempty) { | 
                                                        
| 1532 | -				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : ' ') . '</span>') . '">' . $textifempty . '</option>' . "\n"; | 
                                                        |
| 1532 | +				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : ' ').'</span>').'">'.$textifempty.'</option>'."\n"; | 
                                                        |
| 1533 | 1533 | }  | 
                                                        
| 1534 | 1534 | |
| 1535 | 1535 | $companytemp = new Societe($this->db);  | 
                                                        
@@ -1542,18 +1542,18 @@ discard block  | 
                                                    ||
| 1542 | 1542 | $label = '';  | 
                                                        
| 1543 | 1543 |  					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) { | 
                                                        
| 1544 | 1544 |  						if (($obj->client) && (!empty($obj->code_client))) { | 
                                                        
| 1545 | - $label = $obj->code_client . ' - ';  | 
                                                        |
| 1545 | + $label = $obj->code_client.' - ';  | 
                                                        |
| 1546 | 1546 | }  | 
                                                        
| 1547 | 1547 |  						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) { | 
                                                        
| 1548 | - $label .= $obj->code_fournisseur . ' - ';  | 
                                                        |
| 1548 | + $label .= $obj->code_fournisseur.' - ';  | 
                                                        |
| 1549 | 1549 | }  | 
                                                        
| 1550 | - $label .= ' ' . $obj->name;  | 
                                                        |
| 1550 | + $label .= ' '.$obj->name;  | 
                                                        |
| 1551 | 1551 |  					} else { | 
                                                        
| 1552 | 1552 | $label = $obj->name;  | 
                                                        
| 1553 | 1553 | }  | 
                                                        
| 1554 | 1554 | |
| 1555 | 1555 |  					if (!empty($obj->name_alias)) { | 
                                                        
| 1556 | -						$label .= ' (' . $obj->name_alias . ')'; | 
                                                        |
| 1556 | +						$label .= ' ('.$obj->name_alias.')'; | 
                                                        |
| 1557 | 1557 | }  | 
                                                        
| 1558 | 1558 | |
| 1559 | 1559 |  					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) { | 
                                                        
@@ -1568,7 +1568,7 @@ discard block  | 
                                                    ||
| 1568 | 1568 | $companytemp->fournisseur = $obj->fournisseur;  | 
                                                        
| 1569 | 1569 | $tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');  | 
                                                        
| 1570 | 1570 |  						if ($tmptype) { | 
                                                        
| 1571 | - $labelhtml .= ' ' . $tmptype;  | 
                                                        |
| 1571 | + $labelhtml .= ' '.$tmptype;  | 
                                                        |
| 1572 | 1572 | }  | 
                                                        
| 1573 | 1573 | |
| 1574 | 1574 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
@@ -1578,10 +1578,10 @@ discard block  | 
                                                    ||
| 1578 | 1578 |  							$label .= $langs->trans("Customer"); | 
                                                        
| 1579 | 1579 | }  | 
                                                        
| 1580 | 1580 |  						if ($obj->client == 2 || $obj->client == 3) { | 
                                                        
| 1581 | -							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect"); | 
                                                        |
| 1581 | +							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect"); | 
                                                        |
| 1582 | 1582 | }  | 
                                                        
| 1583 | 1583 |  						if ($obj->fournisseur) { | 
                                                        
| 1584 | -							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier"); | 
                                                        |
| 1584 | +							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier"); | 
                                                        |
| 1585 | 1585 | }  | 
                                                        
| 1586 | 1586 |  						if ($obj->client || $obj->fournisseur) { | 
                                                        
| 1587 | 1587 | $label .= ')';  | 
                                                        
@@ -1589,9 +1589,9 @@ discard block  | 
                                                    ||
| 1589 | 1589 | }  | 
                                                        
| 1590 | 1590 | |
| 1591 | 1591 |  					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) { | 
                                                        
| 1592 | - $s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');  | 
                                                        |
| 1592 | + $s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');  | 
                                                        |
| 1593 | 1593 |  						if (!empty($obj->country_code)) { | 
                                                        
| 1594 | -							$s .= ', ' . $langs->trans('Country' . $obj->country_code); | 
                                                        |
| 1594 | +							$s .= ', '.$langs->trans('Country'.$obj->country_code); | 
                                                        |
| 1595 | 1595 | }  | 
                                                        
| 1596 | 1596 | $label .= $s;  | 
                                                        
| 1597 | 1597 | $labelhtml .= $s;  | 
                                                        
@@ -1599,9 +1599,9 @@ discard block  | 
                                                    ||
| 1599 | 1599 | |
| 1600 | 1600 |  					if (empty($outputmode)) { | 
                                                        
| 1601 | 1601 |  						if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1602 | - $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>';  | 
                                                        |
| 1602 | + $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>';  | 
                                                        |
| 1603 | 1603 |  						} else { | 
                                                        
| 1604 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 1604 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 1605 | 1605 | }  | 
                                                        
| 1606 | 1606 |  					} else { | 
                                                        
| 1607 | 1607 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml)); | 
                                                        
@@ -1613,7 +1613,7 @@ discard block  | 
                                                    ||
| 1613 | 1613 | }  | 
                                                        
| 1614 | 1614 | }  | 
                                                        
| 1615 | 1615 | }  | 
                                                        
| 1616 | - $out .= '</select>' . "\n";  | 
                                                        |
| 1616 | + $out .= '</select>'."\n";  | 
                                                        |
| 1617 | 1617 |  		} else { | 
                                                        
| 1618 | 1618 | dol_print_error($this->db);  | 
                                                        
| 1619 | 1619 | }  | 
                                                        
@@ -1647,18 +1647,18 @@ discard block  | 
                                                    ||
| 1647 | 1647 | // On recherche les remises  | 
                                                        
| 1648 | 1648 | $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";  | 
                                                        
| 1649 | 1649 | $sql .= " re.description, re.fk_facture_source";  | 
                                                        
| 1650 | - $sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";  | 
                                                        |
| 1651 | - $sql .= " WHERE re.fk_soc = " . (int) $socid;  | 
                                                        |
| 1652 | - $sql .= " AND re.entity = " . $conf->entity;  | 
                                                        |
| 1650 | + $sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";  | 
                                                        |
| 1651 | + $sql .= " WHERE re.fk_soc = ".(int) $socid;  | 
                                                        |
| 1652 | + $sql .= " AND re.entity = ".$conf->entity;  | 
                                                        |
| 1653 | 1653 |  		if ($filter) { | 
                                                        
| 1654 | - $sql .= " AND " . $filter;  | 
                                                        |
| 1654 | + $sql .= " AND ".$filter;  | 
                                                        |
| 1655 | 1655 | }  | 
                                                        
| 1656 | 1656 | $sql .= " ORDER BY re.description ASC";  | 
                                                        
| 1657 | 1657 | |
| 1658 | - dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);  | 
                                                        |
| 1658 | + dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);  | 
                                                        |
| 1659 | 1659 | $resql = $this->db->query($sql);  | 
                                                        
| 1660 | 1660 |  		if ($resql) { | 
                                                        
| 1661 | - print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';  | 
                                                        |
| 1661 | + print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';  | 
                                                        |
| 1662 | 1662 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1663 | 1663 | |
| 1664 | 1664 | $qualifiedlines = $num;  | 
                                                        
@@ -1696,16 +1696,16 @@ discard block  | 
                                                    ||
| 1696 | 1696 |  					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) { | 
                                                        
| 1697 | 1697 | $tmpfac = new Facture($this->db);  | 
                                                        
| 1698 | 1698 |  						if ($tmpfac->fetch($obj->fk_facture_source) > 0) { | 
                                                        
| 1699 | - $desc = $desc . ' - ' . $tmpfac->ref;  | 
                                                        |
| 1699 | + $desc = $desc.' - '.$tmpfac->ref;  | 
                                                        |
| 1700 | 1700 | }  | 
                                                        
| 1701 | 1701 | }  | 
                                                        
| 1702 | 1702 | |
| 1703 | -					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>'; | 
                                                        |
| 1703 | +					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>'; | 
                                                        |
| 1704 | 1704 | $i++;  | 
                                                        
| 1705 | 1705 | }  | 
                                                        
| 1706 | 1706 | }  | 
                                                        
| 1707 | 1707 | print '</select>';  | 
                                                        
| 1708 | -			print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 1708 | +			print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 1709 | 1709 | |
| 1710 | 1710 | return $qualifiedlines;  | 
                                                        
| 1711 | 1711 |  		} else { | 
                                                        
@@ -1786,7 +1786,7 @@ discard block  | 
                                                    ||
| 1786 | 1786 | $out = '';  | 
                                                        
| 1787 | 1787 | |
| 1788 | 1788 |  		if (!is_object($hookmanager)) { | 
                                                        
| 1789 | - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';  | 
                                                        |
| 1789 | + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';  | 
                                                        |
| 1790 | 1790 | $hookmanager = new HookManager($this->db);  | 
                                                        
| 1791 | 1791 | }  | 
                                                        
| 1792 | 1792 | |
@@ -1795,13 +1795,13 @@ discard block  | 
                                                    ||
| 1795 | 1795 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1796 | 1796 | $sql .= ", s.nom as company, s.town AS company_town";  | 
                                                        
| 1797 | 1797 | }  | 
                                                        
| 1798 | - $sql .= " FROM " . $this->db->prefix() . "socpeople as sp";  | 
                                                        |
| 1798 | + $sql .= " FROM ".$this->db->prefix()."socpeople as sp";  | 
                                                        |
| 1799 | 1799 |  		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) { | 
                                                        
| 1800 | - $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1800 | + $sql .= " LEFT OUTER JOIN ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";  | 
                                                        |
| 1801 | 1801 | }  | 
                                                        
| 1802 | -		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; | 
                                                        |
| 1802 | +		$sql .= " WHERE sp.entity IN (".getEntity('contact').")"; | 
                                                        |
| 1803 | 1803 |  		if ($socid > 0 || $socid == -1) { | 
                                                        
| 1804 | - $sql .= " AND sp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 1804 | + $sql .= " AND sp.fk_soc = ".((int) $socid);  | 
                                                        |
| 1805 | 1805 | }  | 
                                                        
| 1806 | 1806 |  		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) { | 
                                                        
| 1807 | 1807 | $sql .= " AND sp.statut <> 0";  | 
                                                        
@@ -1812,30 +1812,30 @@ discard block  | 
                                                    ||
| 1812 | 1812 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 1813 | 1813 | $sql .= " ORDER BY sp.lastname ASC";  | 
                                                        
| 1814 | 1814 | |
| 1815 | - dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1815 | + dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);  | 
                                                        |
| 1816 | 1816 | $resql = $this->db->query($sql);  | 
                                                        
| 1817 | 1817 |  		if ($resql) { | 
                                                        
| 1818 | 1818 | $num = $this->db->num_rows($resql);  | 
                                                        
| 1819 | 1819 | |
| 1820 | 1820 |  			if ($htmlname != 'none' && !$options_only) { | 
                                                        
| 1821 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';  | 
                                                        |
| 1821 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';  | 
                                                        |
| 1822 | 1822 | }  | 
                                                        
| 1823 | 1823 | |
| 1824 | 1824 |  			if ($showempty && !is_numeric($showempty)) { | 
                                                        
| 1825 | 1825 | $textforempty = $showempty;  | 
                                                        
| 1826 | - $out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';  | 
                                                        |
| 1826 | + $out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';  | 
                                                        |
| 1827 | 1827 |  			} else { | 
                                                        
| 1828 | 1828 |  				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) { | 
                                                        
| 1829 | - $out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 1829 | + $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 1830 | 1830 | }  | 
                                                        
| 1831 | 1831 |  				if ($showempty == 2) { | 
                                                        
| 1832 | -					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>'; | 
                                                        |
| 1832 | +					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; | 
                                                        |
| 1833 | 1833 | }  | 
                                                        
| 1834 | 1834 | }  | 
                                                        
| 1835 | 1835 | |
| 1836 | 1836 | $i = 0;  | 
                                                        
| 1837 | 1837 |  			if ($num) { | 
                                                        
| 1838 | - include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 1838 | + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 1839 | 1839 | $contactstatic = new Contact($this->db);  | 
                                                        
| 1840 | 1840 | |
| 1841 | 1841 |  				while ($i < $num) { | 
                                                        
@@ -1871,7 +1871,7 @@ discard block  | 
                                                    ||
| 1871 | 1871 | }  | 
                                                        
| 1872 | 1872 |  						$extendedInfos = implode(' - ', $extendedInfos); | 
                                                        
| 1873 | 1873 |  						if (!empty($extendedInfos)) { | 
                                                        
| 1874 | - $extendedInfos = ' - ' . $extendedInfos;  | 
                                                        |
| 1874 | + $extendedInfos = ' - '.$extendedInfos;  | 
                                                        |
| 1875 | 1875 | }  | 
                                                        
| 1876 | 1876 | }  | 
                                                        
| 1877 | 1877 | |
@@ -1888,42 +1888,42 @@ discard block  | 
                                                    ||
| 1888 | 1888 | $disabled = 1;  | 
                                                        
| 1889 | 1889 | }  | 
                                                        
| 1890 | 1890 |  							if (!empty($selected) && in_array($obj->rowid, $selected)) { | 
                                                        
| 1891 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1891 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1892 | 1892 |  								if ($disabled) { | 
                                                        
| 1893 | 1893 | $out .= ' disabled';  | 
                                                        
| 1894 | 1894 | }  | 
                                                        
| 1895 | 1895 | $out .= ' selected>';  | 
                                                        
| 1896 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1896 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1897 | 1897 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1898 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1898 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1899 | 1899 | }  | 
                                                        
| 1900 | 1900 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1901 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1901 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1902 | 1902 | }  | 
                                                        
| 1903 | 1903 | $out .= '</option>';  | 
                                                        
| 1904 | 1904 |  							} else { | 
                                                        
| 1905 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 1905 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 1906 | 1906 |  								if ($disabled) { | 
                                                        
| 1907 | 1907 | $out .= ' disabled';  | 
                                                        
| 1908 | 1908 | }  | 
                                                        
| 1909 | 1909 | $out .= '>';  | 
                                                        
| 1910 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1910 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1911 | 1911 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1912 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1912 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1913 | 1913 | }  | 
                                                        
| 1914 | 1914 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1915 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1915 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1916 | 1916 | }  | 
                                                        
| 1917 | 1917 | $out .= '</option>';  | 
                                                        
| 1918 | 1918 | }  | 
                                                        
| 1919 | 1919 |  						} else { | 
                                                        
| 1920 | 1920 |  							if (in_array($obj->rowid, $selected)) { | 
                                                        
| 1921 | - $out .= $contactstatic->getFullName($langs) . $extendedInfos;  | 
                                                        |
| 1921 | + $out .= $contactstatic->getFullName($langs).$extendedInfos;  | 
                                                        |
| 1922 | 1922 |  								if ($showfunction && $obj->poste) { | 
                                                        
| 1923 | -									$out .= ' (' . $obj->poste . ')'; | 
                                                        |
| 1923 | +									$out .= ' ('.$obj->poste.')'; | 
                                                        |
| 1924 | 1924 | }  | 
                                                        
| 1925 | 1925 |  								if (($showsoc > 0) && $obj->company) { | 
                                                        
| 1926 | -									$out .= ' - (' . $obj->company . ')'; | 
                                                        |
| 1926 | +									$out .= ' - ('.$obj->company.')'; | 
                                                        |
| 1927 | 1927 | }  | 
                                                        
| 1928 | 1928 | }  | 
                                                        
| 1929 | 1929 | }  | 
                                                        
@@ -1932,7 +1932,7 @@ discard block  | 
                                                    ||
| 1932 | 1932 | }  | 
                                                        
| 1933 | 1933 |  			} else { | 
                                                        
| 1934 | 1934 |  				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst'); | 
                                                        
| 1935 | - $out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';  | 
                                                        |
| 1935 | + $out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';  | 
                                                        |
| 1936 | 1936 | $out .= $labeltoshow;  | 
                                                        
| 1937 | 1937 | $out .= '</option>';  | 
                                                        
| 1938 | 1938 | }  | 
                                                        
@@ -1953,7 +1953,7 @@ discard block  | 
                                                    ||
| 1953 | 1953 | }  | 
                                                        
| 1954 | 1954 | |
| 1955 | 1955 |  			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) { | 
                                                        
| 1956 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 1956 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 1957 | 1957 |  				$out .= ajax_combobox($htmlid, $events, getDolGlobalString("CONTACT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 1958 | 1958 | }  | 
                                                        
| 1959 | 1959 | |
@@ -2058,11 +2058,11 @@ discard block  | 
                                                    ||
| 2058 | 2058 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 2059 | 2059 | $sql .= ", e.label";  | 
                                                        
| 2060 | 2060 | }  | 
                                                        
| 2061 | - $sql .= " FROM " . $this->db->prefix() . "user as u";  | 
                                                        |
| 2061 | + $sql .= " FROM ".$this->db->prefix()."user as u";  | 
                                                        |
| 2062 | 2062 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 2063 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2063 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";  | 
                                                        |
| 2064 | 2064 |  			if (!empty($force_entity)) { | 
                                                        
| 2065 | - $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";  | 
                                                        |
| 2065 | + $sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";  | 
                                                        |
| 2066 | 2066 |  			} else { | 
                                                        
| 2067 | 2067 | $sql .= " WHERE u.entity IS NOT NULL";  | 
                                                        
| 2068 | 2068 | }  | 
                                                        
@@ -2070,17 +2070,17 @@ discard block  | 
                                                    ||
| 2070 | 2070 |  			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) { | 
                                                        
| 2071 | 2071 |  				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))"; | 
                                                        
| 2072 | 2072 |  			} else { | 
                                                        
| 2073 | -				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")"; | 
                                                        |
| 2073 | +				$sql .= " WHERE u.entity IN (".getEntity('user').")"; | 
                                                        |
| 2074 | 2074 | }  | 
                                                        
| 2075 | 2075 | }  | 
                                                        
| 2076 | 2076 |  		if (!empty($user->socid)) { | 
                                                        
| 2077 | - $sql .= " AND u.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 2077 | + $sql .= " AND u.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 2078 | 2078 | }  | 
                                                        
| 2079 | 2079 |  		if (is_array($exclude) && $excludeUsers) { | 
                                                        
| 2080 | -			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")"; | 
                                                        |
| 2080 | +			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")"; | 
                                                        |
| 2081 | 2081 | }  | 
                                                        
| 2082 | 2082 |  		if ($includeUsers) { | 
                                                        
| 2083 | -			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")"; | 
                                                        |
| 2083 | +			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")"; | 
                                                        |
| 2084 | 2084 | }  | 
                                                        
| 2085 | 2085 |  		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) { | 
                                                        
| 2086 | 2086 | $sql .= " AND u.statut <> 0";  | 
                                                        
@@ -2092,7 +2092,7 @@ discard block  | 
                                                    ||
| 2092 | 2092 | $sql .= " AND u.fk_soc IS NULL";  | 
                                                        
| 2093 | 2093 | }  | 
                                                        
| 2094 | 2094 |  		if (!empty($morefilter)) { | 
                                                        
| 2095 | - $sql .= " " . $morefilter;  | 
                                                        |
| 2095 | + $sql .= " ".$morefilter;  | 
                                                        |
| 2096 | 2096 | }  | 
                                                        
| 2097 | 2097 | |
| 2098 | 2098 | //Add hook to filter on user (for example on usergroup define in custom modules)  | 
                                                        
@@ -2107,7 +2107,7 @@ discard block  | 
                                                    ||
| 2107 | 2107 | $sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";  | 
                                                        
| 2108 | 2108 | }  | 
                                                        
| 2109 | 2109 | |
| 2110 | - dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2110 | + dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);  | 
                                                        |
| 2111 | 2111 | |
| 2112 | 2112 | $resql = $this->db->query($sql);  | 
                                                        
| 2113 | 2113 |  		if ($resql) { | 
                                                        
@@ -2115,7 +2115,7 @@ discard block  | 
                                                    ||
| 2115 | 2115 | $i = 0;  | 
                                                        
| 2116 | 2116 |  			if ($num) { | 
                                                        
| 2117 | 2117 | // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined  | 
                                                        
| 2118 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 2118 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 2119 | 2119 |  				if ($show_empty && !$multiple) { | 
                                                        
| 2120 | 2120 | $textforempty = ' ';  | 
                                                        
| 2121 | 2121 |  					if (!empty($conf->use_javascript_ajax)) { | 
                                                        
@@ -2124,10 +2124,10 @@ discard block  | 
                                                    ||
| 2124 | 2124 |  					if (!is_numeric($show_empty)) { | 
                                                        
| 2125 | 2125 | $textforempty = $show_empty;  | 
                                                        
| 2126 | 2126 | }  | 
                                                        
| 2127 | - $out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 2127 | + $out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 2128 | 2128 | }  | 
                                                        
| 2129 | 2129 |  				if ($show_every) { | 
                                                        
| 2130 | -					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n"; | 
                                                        |
| 2130 | +					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; | 
                                                        |
| 2131 | 2131 | }  | 
                                                        
| 2132 | 2132 | |
| 2133 | 2133 | $userstatic = new User($this->db);  | 
                                                        
@@ -2174,22 +2174,22 @@ discard block  | 
                                                    ||
| 2174 | 2174 | }  | 
                                                        
| 2175 | 2175 |  					if ($showstatus >= 0) { | 
                                                        
| 2176 | 2176 |  						if ($obj->status == 1 && $showstatus == 1) { | 
                                                        
| 2177 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled'); | 
                                                        |
| 2178 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled'); | 
                                                        |
| 2177 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled'); | 
                                                        |
| 2178 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled'); | 
                                                        |
| 2179 | 2179 | }  | 
                                                        
| 2180 | 2180 |  						if ($obj->status == 0 && $showstatus == 1) { | 
                                                        
| 2181 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled'); | 
                                                        |
| 2182 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled'); | 
                                                        |
| 2181 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled'); | 
                                                        |
| 2182 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled'); | 
                                                        |
| 2183 | 2183 | }  | 
                                                        
| 2184 | 2184 | }  | 
                                                        
| 2185 | 2185 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && !empty($user->admin) && empty($user->entity)) { | 
                                                        
| 2186 | 2186 |  						if (empty($obj->entity)) { | 
                                                        
| 2187 | -							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities"); | 
                                                        |
| 2188 | -							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities"); | 
                                                        |
| 2187 | +							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities"); | 
                                                        |
| 2188 | +							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities"); | 
                                                        |
| 2189 | 2189 |  						} else { | 
                                                        
| 2190 | 2190 |  							if ($obj->entity != $conf->entity) { | 
                                                        
| 2191 | -								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2192 | -								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2191 | +								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2192 | +								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined")); | 
                                                        |
| 2193 | 2193 | }  | 
                                                        
| 2194 | 2194 | }  | 
                                                        
| 2195 | 2195 | }  | 
                                                        
@@ -2197,13 +2197,13 @@ discard block  | 
                                                    ||
| 2197 | 2197 | $moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');  | 
                                                        
| 2198 | 2198 |  					if (!empty($disableline) && $disableline != '1') { | 
                                                        
| 2199 | 2199 | // Add text from $enableonlytext parameter  | 
                                                        
| 2200 | - $moreinfo .= ' - ' . $disableline;  | 
                                                        |
| 2201 | - $moreinfohtml .= ' - ' . $disableline;  | 
                                                        |
| 2200 | + $moreinfo .= ' - '.$disableline;  | 
                                                        |
| 2201 | + $moreinfohtml .= ' - '.$disableline;  | 
                                                        |
| 2202 | 2202 | }  | 
                                                        
| 2203 | 2203 | $labeltoshow .= $moreinfo;  | 
                                                        
| 2204 | 2204 | $labeltoshowhtml .= $moreinfohtml;  | 
                                                        
| 2205 | 2205 | |
| 2206 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2206 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2207 | 2207 |  					if (!empty($disableline)) { | 
                                                        
| 2208 | 2208 | $out .= ' disabled';  | 
                                                        
| 2209 | 2209 | }  | 
                                                        
@@ -2211,7 +2211,7 @@ discard block  | 
                                                    ||
| 2211 | 2211 | $out .= ' selected';  | 
                                                        
| 2212 | 2212 | }  | 
                                                        
| 2213 | 2213 | $out .= ' data-html="';  | 
                                                        
| 2214 | - $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';  | 
                                                        |
| 2214 | + $outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';  | 
                                                        |
| 2215 | 2215 |  					if ($showstatus >= 0 && $obj->status == 0) { | 
                                                        
| 2216 | 2216 | $outhtml .= '<strike class="opacitymediumxxx">';  | 
                                                        
| 2217 | 2217 | }  | 
                                                        
@@ -2224,7 +2224,7 @@ discard block  | 
                                                    ||
| 2224 | 2224 | $out .= $labeltoshow;  | 
                                                        
| 2225 | 2225 | $out .= '</option>';  | 
                                                        
| 2226 | 2226 | |
| 2227 | - $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;  | 
                                                        |
| 2227 | + $outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;  | 
                                                        |
| 2228 | 2228 | $outarray2[$userstatic->id] = array(  | 
                                                        
| 2229 | 2229 | 'id' => $userstatic->id,  | 
                                                        
| 2230 | 2230 | 'label' => $labeltoshow,  | 
                                                        
@@ -2236,14 +2236,14 @@ discard block  | 
                                                    ||
| 2236 | 2236 | $i++;  | 
                                                        
| 2237 | 2237 | }  | 
                                                        
| 2238 | 2238 |  			} else { | 
                                                        
| 2239 | - $out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';  | 
                                                        |
| 2240 | -				$out .= '<option value="">' . $langs->trans("None") . '</option>'; | 
                                                        |
| 2239 | + $out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';  | 
                                                        |
| 2240 | +				$out .= '<option value="">'.$langs->trans("None").'</option>'; | 
                                                        |
| 2241 | 2241 | }  | 
                                                        
| 2242 | 2242 | $out .= '</select>';  | 
                                                        
| 2243 | 2243 | |
| 2244 | 2244 |  			if ($num && !$forcecombo) { | 
                                                        
| 2245 | 2245 | // Enhance with select2  | 
                                                        
| 2246 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2246 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2247 | 2247 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 2248 | 2248 | }  | 
                                                        
| 2249 | 2249 |  		} else { | 
                                                        
@@ -2317,16 +2317,16 @@ discard block  | 
                                                    ||
| 2317 | 2317 | $out .= $userstatic->getNomUrl(-1);  | 
                                                        
| 2318 | 2318 |  			if ($i == 0) { | 
                                                        
| 2319 | 2319 | $ownerid = $value['id'];  | 
                                                        
| 2320 | -				$out .= ' (' . $langs->trans("Owner") . ')'; | 
                                                        |
| 2320 | +				$out .= ' ('.$langs->trans("Owner").')'; | 
                                                        |
| 2321 | 2321 | }  | 
                                                        
| 2322 | 2322 |  			if ($nbassignetouser > 1 && $action != 'view') { | 
                                                        
| 2323 | -				$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 . '">'; | 
                                                        |
| 2323 | +				$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.'">'; | 
                                                        |
| 2324 | 2324 | }  | 
                                                        
| 2325 | 2325 | // Show my availability  | 
                                                        
| 2326 | 2326 |  			if ($showproperties) { | 
                                                        
| 2327 | 2327 |  				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) { | 
                                                        
| 2328 | 2328 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2329 | -					$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>'; | 
                                                        |
| 2329 | +					$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>'; | 
                                                        |
| 2330 | 2330 | $out .= '</div>';  | 
                                                        
| 2331 | 2331 | }  | 
                                                        
| 2332 | 2332 | }  | 
                                                        
@@ -2343,15 +2343,15 @@ discard block  | 
                                                    ||
| 2343 | 2343 | // Method with no ajax  | 
                                                        
| 2344 | 2344 |  		if ($action != 'view') { | 
                                                        
| 2345 | 2345 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';  | 
                                                        
| 2346 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2346 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2347 | 2347 |  			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });'; | 
                                                        
| 2348 | 2348 |  			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());'; | 
                                                        
| 2349 | -			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2350 | -			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2349 | +			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }'; | 
                                                        |
| 2350 | +			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }'; | 
                                                        |
| 2351 | 2351 | $out .= '});';  | 
                                                        
| 2352 | 2352 | $out .= '})</script>';  | 
                                                        
| 2353 | 2353 |  			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2354 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2354 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2355 | 2355 | $out .= '<br>';  | 
                                                        
| 2356 | 2356 | }  | 
                                                        
| 2357 | 2357 | |
@@ -2410,13 +2410,13 @@ discard block  | 
                                                    ||
| 2410 | 2410 | $resourcestatic->fetch($value['id']);  | 
                                                        
| 2411 | 2411 | $out .= $resourcestatic->getNomUrl(-1);  | 
                                                        
| 2412 | 2412 |  			if ($nbassignetoresource > 1 && $action != 'view') { | 
                                                        
| 2413 | -				$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 . '">'; | 
                                                        |
| 2413 | +				$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.'">'; | 
                                                        |
| 2414 | 2414 | }  | 
                                                        
| 2415 | 2415 | // Show my availability  | 
                                                        
| 2416 | 2416 |  			if ($showproperties) { | 
                                                        
| 2417 | 2417 |  				if (is_array($listofresourceid) && count($listofresourceid)) { | 
                                                        
| 2418 | 2418 | $out .= '<div class="myavailability inline-block">';  | 
                                                        
| 2419 | -					$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>'; | 
                                                        |
| 2419 | +					$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>'; | 
                                                        |
| 2420 | 2420 | $out .= '</div>';  | 
                                                        
| 2421 | 2421 | }  | 
                                                        
| 2422 | 2422 | }  | 
                                                        
@@ -2433,11 +2433,11 @@ discard block  | 
                                                    ||
| 2433 | 2433 | // Method with no ajax  | 
                                                        
| 2434 | 2434 |  		if ($action != 'view') { | 
                                                        
| 2435 | 2435 | $out .= '<input type="hidden" class="removedassignedhidden" name="removedassignedresource" value="">';  | 
                                                        
| 2436 | -			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2436 | +			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {'; | 
                                                        |
| 2437 | 2437 |  			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });'; | 
                                                        
| 2438 | 2438 |  			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());'; | 
                                                        
| 2439 | -			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2440 | -			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2439 | +			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }'; | 
                                                        |
| 2440 | +			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }'; | 
                                                        |
| 2441 | 2441 | $out .= '});';  | 
                                                        
| 2442 | 2442 | $out .= '})</script>';  | 
                                                        
| 2443 | 2443 | |
@@ -2445,7 +2445,7 @@ discard block  | 
                                                    ||
| 2445 | 2445 |  			$out .= img_picto('', 'resource', 'class="pictofixedwidth"'); | 
                                                        
| 2446 | 2446 | $out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);  | 
                                                        
| 2447 | 2447 |  			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); | 
                                                        
| 2448 | -			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">'; | 
                                                        |
| 2448 | +			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; | 
                                                        |
| 2449 | 2449 | $out .= '<br>';  | 
                                                        
| 2450 | 2450 | }  | 
                                                        
| 2451 | 2451 | |
@@ -2506,7 +2506,7 @@ discard block  | 
                                                    ||
| 2506 | 2506 | $placeholder = '';  | 
                                                        
| 2507 | 2507 | |
| 2508 | 2508 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 2509 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2509 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2510 | 2510 | $producttmpselect = new Product($this->db);  | 
                                                        
| 2511 | 2511 | $producttmpselect->fetch($selected);  | 
                                                        
| 2512 | 2512 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -2521,17 +2521,17 @@ discard block  | 
                                                    ||
| 2521 | 2521 | }  | 
                                                        
| 2522 | 2522 | }  | 
                                                        
| 2523 | 2523 | // mode=1 means customers products  | 
                                                        
| 2524 | - $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;  | 
                                                        |
| 2525 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2524 | + $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;  | 
                                                        |
| 2525 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 2526 | 2526 | |
| 2527 | 2527 |  			if (isModEnabled('variants') && is_array($selected_combinations)) { | 
                                                        
| 2528 | 2528 | // Code to automatically insert with javascript the select of attributes under the select of product  | 
                                                        
| 2529 | 2529 | // when a parent of variant has been selected.  | 
                                                        
| 2530 | 2530 | $out .= '  | 
                                                        
| 2531 | 2531 | <!-- script to auto show attributes select tags if a variant was selected -->  | 
                                                        
| 2532 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 2532 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 2533 | 2533 | // auto show attributes fields  | 
                                                        
| 2534 | - selected = ' . json_encode($selected_combinations) . ';  | 
                                                        |
| 2534 | + selected = ' . json_encode($selected_combinations).';  | 
                                                        |
| 2535 | 2535 |  					combvalues = {}; | 
                                                        
| 2536 | 2536 | |
| 2537 | 2537 |  					jQuery(document).ready(function () { | 
                                                        
@@ -2542,7 +2542,7 @@ discard block  | 
                                                    ||
| 2542 | 2542 | }  | 
                                                        
| 2543 | 2543 | });  | 
                                                        
| 2544 | 2544 | |
| 2545 | -						jQuery("input#' . $htmlname . '").change(function () { | 
                                                        |
| 2545 | +						jQuery("input#' . $htmlname.'").change(function () { | 
                                                        |
| 2546 | 2546 | |
| 2547 | 2547 |  							if (!jQuery(this).val()) { | 
                                                        
| 2548 | 2548 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2551,7 +2551,7 @@ discard block  | 
                                                    ||
| 2551 | 2551 | |
| 2552 | 2552 |  							console.log("A change has started. We get variants fields to inject html select"); | 
                                                        
| 2553 | 2553 | |
| 2554 | -							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", { | 
                                                        |
| 2554 | +							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", { | 
                                                        |
| 2555 | 2555 | id: jQuery(this).val()  | 
                                                        
| 2556 | 2556 |  							}, function (data) { | 
                                                        
| 2557 | 2557 | jQuery(\'div#attributes_box\').empty();  | 
                                                        
@@ -2594,21 +2594,21 @@ discard block  | 
                                                    ||
| 2594 | 2594 | })  | 
                                                        
| 2595 | 2595 | });  | 
                                                        
| 2596 | 2596 | |
| 2597 | -						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . ' | 
                                                        |
| 2597 | +						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').' | 
                                                        |
| 2598 | 2598 | });  | 
                                                        
| 2599 | 2599 | </script>  | 
                                                        
| 2600 | 2600 | ';  | 
                                                        
| 2601 | 2601 | }  | 
                                                        
| 2602 | 2602 | |
| 2603 | 2603 |  			if (empty($hidelabel)) { | 
                                                        
| 2604 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 2604 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 2605 | 2605 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 2606 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 2606 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 2607 | 2607 |  				if ($hidelabel == 2) { | 
                                                        
| 2608 | 2608 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2609 | 2609 | }  | 
                                                        
| 2610 | 2610 | }  | 
                                                        
| 2611 | -			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 2611 | +			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 2612 | 2612 |  			if ($hidelabel == 3) { | 
                                                        
| 2613 | 2613 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 2614 | 2614 | }  | 
                                                        
@@ -2645,33 +2645,33 @@ discard block  | 
                                                    ||
| 2645 | 2645 | // phpcs:enable  | 
                                                        
| 2646 | 2646 | global $conf, $user, $langs, $db;  | 
                                                        
| 2647 | 2647 | |
| 2648 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2648 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2649 | 2649 | |
| 2650 | 2650 | $error = 0;  | 
                                                        
| 2651 | 2651 | $out = '';  | 
                                                        
| 2652 | 2652 | |
| 2653 | 2653 |  		if (!$forcecombo) { | 
                                                        
| 2654 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2654 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2655 | 2655 | $events = array();  | 
                                                        
| 2656 | 2656 |  			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2657 | 2657 | }  | 
                                                        
| 2658 | 2658 | |
| 2659 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2659 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2660 | 2660 | |
| 2661 | 2661 | $sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';  | 
                                                        
| 2662 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';  | 
                                                        |
| 2663 | -		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')'; | 
                                                        |
| 2662 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';  | 
                                                        |
| 2663 | +		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')'; | 
                                                        |
| 2664 | 2664 |  		if (!empty($status)) { | 
                                                        
| 2665 | - $sql .= ' AND status = ' . (int) $status;  | 
                                                        |
| 2665 | + $sql .= ' AND status = '.(int) $status;  | 
                                                        |
| 2666 | 2666 | }  | 
                                                        
| 2667 | 2667 |  		if (!empty($type)) { | 
                                                        
| 2668 | - $sql .= ' AND bomtype = ' . (int) $type;  | 
                                                        |
| 2668 | + $sql .= ' AND bomtype = '.(int) $type;  | 
                                                        |
| 2669 | 2669 | }  | 
                                                        
| 2670 | 2670 |  		if (!empty($TProducts)) { | 
                                                        
| 2671 | -			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')'; | 
                                                        |
| 2671 | +			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')'; | 
                                                        |
| 2672 | 2672 | }  | 
                                                        
| 2673 | 2673 |  		if (!empty($limit)) { | 
                                                        
| 2674 | - $sql .= ' LIMIT ' . (int) $limit;  | 
                                                        |
| 2674 | + $sql .= ' LIMIT '.(int) $limit;  | 
                                                        |
| 2675 | 2675 | }  | 
                                                        
| 2676 | 2676 | $resql = $db->query($sql);  | 
                                                        
| 2677 | 2677 |  		if ($resql) { | 
                                                        
@@ -2685,11 +2685,11 @@ discard block  | 
                                                    ||
| 2685 | 2685 |  			while ($obj = $db->fetch_object($resql)) { | 
                                                        
| 2686 | 2686 | $product = new Product($db);  | 
                                                        
| 2687 | 2687 | $res = $product->fetch($obj->fk_product);  | 
                                                        
| 2688 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 2688 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 2689 | 2689 |  				if ($obj->rowid == $selected) { | 
                                                        
| 2690 | 2690 | $out .= 'selected';  | 
                                                        
| 2691 | 2691 | }  | 
                                                        
| 2692 | - $out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';  | 
                                                        |
| 2692 | + $out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';  | 
                                                        |
| 2693 | 2693 | }  | 
                                                        
| 2694 | 2694 |  		} else { | 
                                                        
| 2695 | 2695 | $error++;  | 
                                                        
@@ -2746,7 +2746,7 @@ discard block  | 
                                                    ||
| 2746 | 2746 | |
| 2747 | 2747 | $warehouseStatusArray = array();  | 
                                                        
| 2748 | 2748 |  		if (!empty($warehouseStatus)) { | 
                                                        
| 2749 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2749 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';  | 
                                                        |
| 2750 | 2750 |  			if (preg_match('/warehouseclosed/', $warehouseStatus)) { | 
                                                        
| 2751 | 2751 | $warehouseStatusArray[] = Entrepot::STATUS_CLOSED;  | 
                                                        
| 2752 | 2752 | }  | 
                                                        
@@ -2760,9 +2760,9 @@ discard block  | 
                                                    ||
| 2760 | 2760 | |
| 2761 | 2761 | $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";  | 
                                                        
| 2762 | 2762 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2763 | -			$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 | 
                                                        |
| 2763 | +			$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 | 
                                                        |
| 2764 | 2764 |  		} else { | 
                                                        
| 2765 | -			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock"; | 
                                                        |
| 2765 | +			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock"; | 
                                                        |
| 2766 | 2766 | }  | 
                                                        
| 2767 | 2767 | |
| 2768 | 2768 | $sql = "SELECT ";  | 
                                                        
@@ -2778,9 +2778,9 @@ discard block  | 
                                                    ||
| 2778 | 2778 | |
| 2779 | 2779 |  		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) { | 
                                                        
| 2780 | 2780 | //Product category  | 
                                                        
| 2781 | - $sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie  | 
                                                        |
| 2782 | - FROM " . $this->db->prefix() . "categorie_product  | 
                                                        |
| 2783 | - WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid  | 
                                                        |
| 2781 | + $sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie  | 
                                                        |
| 2782 | + FROM " . $this->db->prefix()."categorie_product  | 
                                                        |
| 2783 | + WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid  | 
                                                        |
| 2784 | 2784 | LIMIT 1  | 
                                                        
| 2785 | 2785 | ) AS categorie_product_id ";  | 
                                                        
| 2786 | 2786 | }  | 
                                                        
@@ -2806,15 +2806,15 @@ discard block  | 
                                                    ||
| 2806 | 2806 | }  | 
                                                        
| 2807 | 2807 | // Price by quantity  | 
                                                        
| 2808 | 2808 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2809 | - $sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2809 | + $sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";  | 
                                                        |
| 2810 | 2810 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2811 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2811 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2812 | 2812 | }  | 
                                                        
| 2813 | 2813 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2814 | 2814 | $sql .= " DESC LIMIT 1) as price_rowid";  | 
                                                        
| 2815 | - $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  | 
                                                        |
| 2815 | + $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  | 
                                                        |
| 2816 | 2816 |  			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { | 
                                                        
| 2817 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 2817 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 2818 | 2818 | }  | 
                                                        
| 2819 | 2819 | $sql .= " ORDER BY date_price";  | 
                                                        
| 2820 | 2820 | $sql .= " DESC LIMIT 1) as price_by_qty";  | 
                                                        
@@ -2823,58 +2823,58 @@ discard block  | 
                                                    ||
| 2823 | 2823 | |
| 2824 | 2824 | $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        
| 2825 | 2825 | // Add from (left join) from hooks  | 
                                                        
| 2826 | - $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2826 | + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2827 | 2827 |  		$reshook = $hookmanager->executeHooks('selectProductsListFrom', $parameters); // Note that $action and $object may have been modified by hook | 
                                                        
| 2828 | 2828 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 2829 | 2829 | |
| 2830 | 2830 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2831 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2832 | -			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")"; | 
                                                        |
| 2833 | -			$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. | 
                                                        |
| 2831 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";  | 
                                                        |
| 2832 | +			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; | 
                                                        |
| 2833 | +			$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. | 
                                                        |
| 2834 | 2834 | }  | 
                                                        
| 2835 | 2835 | |
| 2836 | 2836 | // include search in supplier ref  | 
                                                        
| 2837 | 2837 |  		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2838 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2838 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 2839 | 2839 | }  | 
                                                        
| 2840 | 2840 | |
| 2841 | 2841 | //Price by customer  | 
                                                        
| 2842 | 2842 |  		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2843 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2843 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";  | 
                                                        |
| 2844 | 2844 | }  | 
                                                        
| 2845 | 2845 | // Units  | 
                                                        
| 2846 | 2846 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 2847 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 2847 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 2848 | 2848 | }  | 
                                                        
| 2849 | 2849 | // Multilang : we add translation  | 
                                                        
| 2850 | 2850 |  		if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2851 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 2851 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";  | 
                                                        |
| 2852 | 2852 |  			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) { | 
                                                        
| 2853 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 2853 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 2854 | 2854 | $soc = new Societe($this->db);  | 
                                                        
| 2855 | 2855 | $result = $soc->fetch($socid);  | 
                                                        
| 2856 | 2856 |  				if ($result > 0 && !empty($soc->default_lang)) { | 
                                                        
| 2857 | - $sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";  | 
                                                        |
| 2857 | + $sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";  | 
                                                        |
| 2858 | 2858 |  				} else { | 
                                                        
| 2859 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 2859 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 2860 | 2860 | }  | 
                                                        
| 2861 | 2861 |  			} else { | 
                                                        
| 2862 | - $sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";  | 
                                                        |
| 2862 | + $sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";  | 
                                                        |
| 2863 | 2863 | }  | 
                                                        
| 2864 | 2864 | }  | 
                                                        
| 2865 | 2865 | |
| 2866 | 2866 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 2867 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 2867 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";  | 
                                                        |
| 2868 | 2868 | }  | 
                                                        
| 2869 | 2869 | |
| 2870 | -		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')'; | 
                                                        |
| 2870 | +		$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; | 
                                                        |
| 2871 | 2871 | |
| 2872 | 2872 |  		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) { | 
                                                        
| 2873 | 2873 | $sql .= " AND pac.rowid IS NULL";  | 
                                                        
| 2874 | 2874 | }  | 
                                                        
| 2875 | 2875 | |
| 2876 | 2876 |  		if ($finished == 0) { | 
                                                        
| 2877 | - $sql .= " AND p.finished = " . ((int) $finished);  | 
                                                        |
| 2877 | + $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        |
| 2878 | 2878 |  		} elseif ($finished == 1) { | 
                                                        
| 2879 | 2879 | $sql .= " AND p.finished = ".((int) $finished);  | 
                                                        
| 2880 | 2880 | }  | 
                                                        
@@ -2882,18 +2882,18 @@ discard block  | 
                                                    ||
| 2882 | 2882 | $sql .= " AND p.tosell = ".((int) $status);  | 
                                                        
| 2883 | 2883 | }  | 
                                                        
| 2884 | 2884 |  		if ($status_purchase >= 0) { | 
                                                        
| 2885 | - $sql .= " AND p.tobuy = " . ((int) $status_purchase);  | 
                                                        |
| 2885 | + $sql .= " AND p.tobuy = ".((int) $status_purchase);  | 
                                                        |
| 2886 | 2886 | }  | 
                                                        
| 2887 | 2887 | // Filter by product type  | 
                                                        
| 2888 | 2888 |  		if (strval($filtertype) != '') { | 
                                                        
| 2889 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 2889 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 2890 | 2890 |  		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only | 
                                                        
| 2891 | 2891 | $sql .= " AND p.fk_product_type = 1";  | 
                                                        
| 2892 | 2892 |  		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only | 
                                                        
| 2893 | 2893 | $sql .= " AND p.fk_product_type = 0";  | 
                                                        
| 2894 | 2894 | }  | 
                                                        
| 2895 | 2895 | // Add where from hooks  | 
                                                        
| 2896 | - $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2896 | + $parameters = array(); // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 2897 | 2897 |  		$reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook | 
                                                        
| 2898 | 2898 | $sql .= $hookmanager->resPrint;  | 
                                                        
| 2899 | 2899 | // Add criteria on ref/label  | 
                                                        
@@ -2910,21 +2910,21 @@ discard block  | 
                                                    ||
| 2910 | 2910 |  				if ($i > 0) { | 
                                                        
| 2911 | 2911 | $sql .= " AND ";  | 
                                                        
| 2912 | 2912 | }  | 
                                                        
| 2913 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2913 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2914 | 2914 |  				if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2915 | - $sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2915 | + $sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2916 | 2916 | }  | 
                                                        
| 2917 | 2917 |  				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && !empty($socid)) { | 
                                                        
| 2918 | - $sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2918 | + $sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2919 | 2919 | }  | 
                                                        
| 2920 | 2920 |  				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) { | 
                                                        
| 2921 | - $sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2921 | + $sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2922 | 2922 |  					if (getDolGlobalInt('MAIN_MULTILANGS')) { | 
                                                        
| 2923 | - $sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2923 | + $sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2924 | 2924 | }  | 
                                                        
| 2925 | 2925 | }  | 
                                                        
| 2926 | 2926 |  				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) { | 
                                                        
| 2927 | - $sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 2927 | + $sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 2928 | 2928 | }  | 
                                                        
| 2929 | 2929 | $sql .= ")";  | 
                                                        
| 2930 | 2930 | $i++;  | 
                                                        
@@ -2933,12 +2933,12 @@ discard block  | 
                                                    ||
| 2933 | 2933 | $sql .= ")";  | 
                                                        
| 2934 | 2934 | }  | 
                                                        
| 2935 | 2935 |  			if (isModEnabled('barcode')) { | 
                                                        
| 2936 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 2936 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 2937 | 2937 | }  | 
                                                        
| 2938 | 2938 | $sql .= ')';  | 
                                                        
| 2939 | 2939 | }  | 
                                                        
| 2940 | 2940 |  		if (count($warehouseStatusArray)) { | 
                                                        
| 2941 | - $sql .= " GROUP BY " . $selectFields;  | 
                                                        |
| 2941 | + $sql .= " GROUP BY ".$selectFields;  | 
                                                        |
| 2942 | 2942 | }  | 
                                                        
| 2943 | 2943 | |
| 2944 | 2944 | //Sort by category  | 
                                                        
@@ -2953,23 +2953,23 @@ discard block  | 
                                                    ||
| 2953 | 2953 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 2954 | 2954 | |
| 2955 | 2955 | // Build output string  | 
                                                        
| 2956 | - dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 2956 | + dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);  | 
                                                        |
| 2957 | 2957 | $result = $this->db->query($sql);  | 
                                                        
| 2958 | 2958 |  		if ($result) { | 
                                                        
| 2959 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 2960 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 2961 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 2959 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 2960 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 2961 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 2962 | 2962 | |
| 2963 | 2963 | $num = $this->db->num_rows($result);  | 
                                                        
| 2964 | 2964 | |
| 2965 | 2965 | $events = array();  | 
                                                        
| 2966 | 2966 | |
| 2967 | 2967 |  			if (!$forcecombo) { | 
                                                        
| 2968 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 2968 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 2969 | 2969 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); | 
                                                        
| 2970 | 2970 | }  | 
                                                        
| 2971 | 2971 | |
| 2972 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 2972 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 2973 | 2973 | |
| 2974 | 2974 | $textifempty = '';  | 
                                                        
| 2975 | 2975 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -2986,7 +2986,7 @@ discard block  | 
                                                    ||
| 2986 | 2986 | }  | 
                                                        
| 2987 | 2987 | }  | 
                                                        
| 2988 | 2988 |  			if ($showempty) { | 
                                                        
| 2989 | - $out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : ' ') . '</option>';  | 
                                                        |
| 2989 | + $out .= '<option value="-1" selected>'.($textifempty ? $textifempty : ' ').'</option>';  | 
                                                        |
| 2990 | 2990 | }  | 
                                                        
| 2991 | 2991 | |
| 2992 | 2992 | $i = 0;  | 
                                                        
@@ -2997,11 +2997,11 @@ discard block  | 
                                                    ||
| 2997 | 2997 | |
| 2998 | 2998 |  				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 | 
                                                        
| 2999 | 2999 | $sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";  | 
                                                        
| 3000 | - $sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";  | 
                                                        |
| 3001 | - $sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);  | 
                                                        |
| 3000 | + $sql .= " FROM ".$this->db->prefix()."product_price_by_qty";  | 
                                                        |
| 3001 | + $sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);  | 
                                                        |
| 3002 | 3002 | $sql .= " ORDER BY quantity ASC";  | 
                                                        
| 3003 | 3003 | |
| 3004 | - dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 3004 | + dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);  | 
                                                        |
| 3005 | 3005 | $result2 = $this->db->query($sql);  | 
                                                        
| 3006 | 3006 |  					if ($result2) { | 
                                                        
| 3007 | 3007 | $nb_prices = $this->db->num_rows($result2);  | 
                                                        
@@ -3039,7 +3039,7 @@ discard block  | 
                                                    ||
| 3039 | 3039 | $price_product = new Product($this->db);  | 
                                                        
| 3040 | 3040 | $price_product->fetch($objp->rowid, '', '', 1);  | 
                                                        
| 3041 | 3041 | |
| 3042 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3042 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3043 | 3043 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3044 | 3044 | $price_result = $priceparser->parseProduct($price_product);  | 
                                                        
| 3045 | 3045 |  						if ($price_result >= 0) { | 
                                                        
@@ -3123,7 +3123,7 @@ discard block  | 
                                                    ||
| 3123 | 3123 | $label = $objp->label_translated;  | 
                                                        
| 3124 | 3124 | }  | 
                                                        
| 3125 | 3125 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3126 | -			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3126 | +			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3127 | 3127 | }  | 
                                                        
| 3128 | 3128 | |
| 3129 | 3129 | $outkey = $objp->rowid;  | 
                                                        
@@ -3144,32 +3144,32 @@ discard block  | 
                                                    ||
| 3144 | 3144 | $outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';  | 
                                                        
| 3145 | 3145 | |
| 3146 | 3146 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3147 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 3147 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 3148 | 3148 | }  | 
                                                        
| 3149 | 3149 | |
| 3150 | 3150 | // Units  | 
                                                        
| 3151 | 3151 | $outvalUnits = '';  | 
                                                        
| 3152 | 3152 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3153 | 3153 |  			if (!empty($objp->unit_short)) { | 
                                                        
| 3154 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3154 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3155 | 3155 | }  | 
                                                        
| 3156 | 3156 | }  | 
                                                        
| 3157 | 3157 |  		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) { | 
                                                        
| 3158 | 3158 |  			if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3159 | 3159 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3160 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3160 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3161 | 3161 | }  | 
                                                        
| 3162 | 3162 |  			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3163 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3164 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3163 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3164 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3165 | 3165 | }  | 
                                                        
| 3166 | 3166 |  			if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3167 | 3167 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3168 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3168 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3169 | 3169 | }  | 
                                                        
| 3170 | 3170 |  			if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3171 | 3171 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3172 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3172 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3173 | 3173 | }  | 
                                                        
| 3174 | 3174 | }  | 
                                                        
| 3175 | 3175 |  		if ($outdurationvalue && $outdurationunit) { | 
                                                        
@@ -3181,14 +3181,14 @@ discard block  | 
                                                    ||
| 3181 | 3181 |  				'y' => $langs->trans('Year') | 
                                                        
| 3182 | 3182 | );  | 
                                                        
| 3183 | 3183 |  			if (isset($da[$outdurationunit])) { | 
                                                        
| 3184 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3184 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3185 | 3185 | }  | 
                                                        
| 3186 | 3186 | }  | 
                                                        
| 3187 | 3187 | |
| 3188 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 3188 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 3189 | 3189 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 3190 | 3190 |  		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { | 
                                                        
| 3191 | - $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 . '"';  | 
                                                        |
| 3191 | + $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.'"';  | 
                                                        |
| 3192 | 3192 | }  | 
                                                        
| 3193 | 3193 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3194 | 3194 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
@@ -3200,36 +3200,36 @@ discard block  | 
                                                    ||
| 3200 | 3200 | }  | 
                                                        
| 3201 | 3201 | }  | 
                                                        
| 3202 | 3202 |  		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { | 
                                                        
| 3203 | - $opt .= ' data-labeltrans="' . $outlabel_translated . '"';  | 
                                                        |
| 3204 | - $opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';  | 
                                                        |
| 3203 | + $opt .= ' data-labeltrans="'.$outlabel_translated.'"';  | 
                                                        |
| 3204 | + $opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';  | 
                                                        |
| 3205 | 3205 | }  | 
                                                        
| 3206 | 3206 | $opt .= '>';  | 
                                                        
| 3207 | 3207 | $opt .= $objp->ref;  | 
                                                        
| 3208 | 3208 |  		if (!empty($objp->custref)) { | 
                                                        
| 3209 | -			$opt .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3209 | +			$opt .= ' ('.$objp->custref.')'; | 
                                                        |
| 3210 | 3210 | }  | 
                                                        
| 3211 | 3211 |  		if ($outbarcode) { | 
                                                        
| 3212 | -			$opt .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3212 | +			$opt .= ' ('.$outbarcode.')'; | 
                                                        |
| 3213 | 3213 | }  | 
                                                        
| 3214 | - $opt .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3214 | + $opt .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3215 | 3215 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3216 | -			$opt .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3216 | +			$opt .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3217 | 3217 | }  | 
                                                        
| 3218 | 3218 | |
| 3219 | 3219 | $objRef = $objp->ref;  | 
                                                        
| 3220 | 3220 |  		if (!empty($objp->custref)) { | 
                                                        
| 3221 | -			$objRef .= ' (' . $objp->custref . ')'; | 
                                                        |
| 3221 | +			$objRef .= ' ('.$objp->custref.')'; | 
                                                        |
| 3222 | 3222 | }  | 
                                                        
| 3223 | 3223 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 3224 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3224 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3225 | 3225 | }  | 
                                                        
| 3226 | 3226 | $outval .= $objRef;  | 
                                                        
| 3227 | 3227 |  		if ($outbarcode) { | 
                                                        
| 3228 | -			$outval .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3228 | +			$outval .= ' ('.$outbarcode.')'; | 
                                                        |
| 3229 | 3229 | }  | 
                                                        
| 3230 | - $outval .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3230 | + $outval .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3231 | 3231 |  		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) { | 
                                                        
| 3232 | -			$outval .= ' (' . getCountry($outorigin, 1) . ')'; | 
                                                        |
| 3232 | +			$outval .= ' ('.getCountry($outorigin, 1).')'; | 
                                                        |
| 3233 | 3233 | }  | 
                                                        
| 3234 | 3234 | |
| 3235 | 3235 | // Units  | 
                                                        
@@ -3242,35 +3242,35 @@ discard block  | 
                                                    ||
| 3242 | 3242 | // If we need a particular price level (from 1 to n)  | 
                                                        
| 3243 | 3243 |  		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { | 
                                                        
| 3244 | 3244 | $sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";  | 
                                                        
| 3245 | - $sql .= " FROM " . $this->db->prefix() . "product_price";  | 
                                                        |
| 3246 | - $sql .= " WHERE fk_product = " . ((int) $objp->rowid);  | 
                                                        |
| 3247 | -			$sql .= " AND entity IN (" . getEntity('productprice') . ")"; | 
                                                        |
| 3248 | - $sql .= " AND price_level = " . ((int) $price_level);  | 
                                                        |
| 3245 | + $sql .= " FROM ".$this->db->prefix()."product_price";  | 
                                                        |
| 3246 | + $sql .= " WHERE fk_product = ".((int) $objp->rowid);  | 
                                                        |
| 3247 | +			$sql .= " AND entity IN (".getEntity('productprice').")"; | 
                                                        |
| 3248 | + $sql .= " AND price_level = ".((int) $price_level);  | 
                                                        |
| 3249 | 3249 | $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.  | 
                                                        
| 3250 | 3250 | $sql .= " LIMIT 1";  | 
                                                        
| 3251 | 3251 | |
| 3252 | - dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);  | 
                                                        |
| 3252 | + dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);  | 
                                                        |
| 3253 | 3253 | $result2 = $this->db->query($sql);  | 
                                                        
| 3254 | 3254 |  			if ($result2) { | 
                                                        
| 3255 | 3255 | $objp2 = $this->db->fetch_object($result2);  | 
                                                        
| 3256 | 3256 |  				if ($objp2) { | 
                                                        
| 3257 | 3257 | $found = 1;  | 
                                                        
| 3258 | 3258 |  					if ($objp2->price_base_type == 'HT') { | 
                                                        
| 3259 | -						$opt .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3260 | -						$outval .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3259 | +						$opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3260 | +						$outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3261 | 3261 |  					} else { | 
                                                        
| 3262 | -						$opt .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3263 | -						$outval .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3262 | +						$opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3263 | +						$outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3264 | 3264 | }  | 
                                                        
| 3265 | 3265 | $outprice_ht = price($objp2->price);  | 
                                                        
| 3266 | 3266 | $outprice_ttc = price($objp2->price_ttc);  | 
                                                        
| 3267 | 3267 | $outpricebasetype = $objp2->price_base_type;  | 
                                                        
| 3268 | 3268 |  					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility | 
                                                        
| 3269 | - $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3270 | - $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3269 | + $outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice  | 
                                                        |
| 3270 | + $outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice  | 
                                                        |
| 3271 | 3271 |  					} else { | 
                                                        
| 3272 | - $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3273 | - $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3272 | + $outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice  | 
                                                        |
| 3273 | + $outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice  | 
                                                        |
| 3274 | 3274 | }  | 
                                                        
| 3275 | 3275 | }  | 
                                                        
| 3276 | 3276 |  			} else { | 
                                                        
@@ -3284,13 +3284,13 @@ discard block  | 
                                                    ||
| 3284 | 3284 | $outqty = $objp->quantity;  | 
                                                        
| 3285 | 3285 | $outdiscount = $objp->remise_percent;  | 
                                                        
| 3286 | 3286 |  			if ($objp->quantity == 1) { | 
                                                        
| 3287 | - $opt .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3288 | - $outval .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";  | 
                                                        |
| 3287 | + $opt .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3288 | + $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";  | 
                                                        |
| 3289 | 3289 |  				$opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3290 | 3290 |  				$outval .= $langs->transnoentities("Unit"); | 
                                                        
| 3291 | 3291 |  			} else { | 
                                                        
| 3292 | - $opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3293 | - $outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;  | 
                                                        |
| 3292 | + $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3293 | + $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;  | 
                                                        |
| 3294 | 3294 |  				$opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3295 | 3295 |  				$outval .= $langs->transnoentities("Units"); | 
                                                        
| 3296 | 3296 | }  | 
                                                        
@@ -3298,16 +3298,16 @@ discard block  | 
                                                    ||
| 3298 | 3298 | $outprice_ht = price($objp->unitprice);  | 
                                                        
| 3299 | 3299 | $outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));  | 
                                                        
| 3300 | 3300 | $outpricebasetype = $objp->price_base_type;  | 
                                                        
| 3301 | - $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  | 
                                                        |
| 3302 | - $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  | 
                                                        |
| 3301 | + $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  | 
                                                        |
| 3302 | + $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  | 
                                                        |
| 3303 | 3303 | }  | 
                                                        
| 3304 | 3304 |  		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) { | 
                                                        
| 3305 | -			$opt .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3306 | -			$outval .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3305 | +			$opt .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3306 | +			$outval .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3307 | 3307 | }  | 
                                                        
| 3308 | 3308 |  		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) { | 
                                                        
| 3309 | -			$opt .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3310 | -			$outval .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3309 | +			$opt .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3310 | +			$outval .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3311 | 3311 | }  | 
                                                        
| 3312 | 3312 | |
| 3313 | 3313 | // Price by customer  | 
                                                        
@@ -3316,11 +3316,11 @@ discard block  | 
                                                    ||
| 3316 | 3316 | $found = 1;  | 
                                                        
| 3317 | 3317 | |
| 3318 | 3318 |  				if ($objp->custprice_base_type == 'HT') { | 
                                                        
| 3319 | -					$opt .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3320 | -					$outval .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3319 | +					$opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3320 | +					$outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3321 | 3321 |  				} else { | 
                                                        
| 3322 | -					$opt .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3323 | -					$outval .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3322 | +					$opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3323 | +					$outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3324 | 3324 | }  | 
                                                        
| 3325 | 3325 | |
| 3326 | 3326 | $outprice_ht = price($objp->custprice);  | 
                                                        
@@ -3334,11 +3334,11 @@ discard block  | 
                                                    ||
| 3334 | 3334 | // If level no defined or multiprice not found, we used the default price  | 
                                                        
| 3335 | 3335 |  		if (empty($hidepriceinlabel) && !$found) { | 
                                                        
| 3336 | 3336 |  			if ($objp->price_base_type == 'HT') { | 
                                                        
| 3337 | -				$opt .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT"); | 
                                                        |
| 3338 | -				$outval .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT"); | 
                                                        |
| 3337 | +				$opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); | 
                                                        |
| 3338 | +				$outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); | 
                                                        |
| 3339 | 3339 |  			} else { | 
                                                        
| 3340 | -				$opt .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC"); | 
                                                        |
| 3341 | -				$outval .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC"); | 
                                                        |
| 3340 | +				$opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); | 
                                                        |
| 3341 | +				$outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); | 
                                                        |
| 3342 | 3342 | }  | 
                                                        
| 3343 | 3343 | $outprice_ht = price($objp->price);  | 
                                                        
| 3344 | 3344 | $outprice_ttc = price($objp->price_ttc);  | 
                                                        
@@ -3349,14 +3349,14 @@ discard block  | 
                                                    ||
| 3349 | 3349 | |
| 3350 | 3350 |  		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3351 | 3351 |  			if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3352 | -				$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3352 | +				$opt .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3353 | 3353 | |
| 3354 | 3354 |  				if ($objp->stock > 0) { | 
                                                        
| 3355 | 3355 | $outval .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3356 | 3356 |  				} elseif ($objp->stock <= 0) { | 
                                                        
| 3357 | 3357 | $outval .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3358 | 3358 | }  | 
                                                        
| 3359 | -				$outval .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3359 | +				$outval .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3360 | 3360 | $outval .= '</span>';  | 
                                                        
| 3361 | 3361 |  				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3362 | 3362 |  					$langs->load("stocks"); | 
                                                        
@@ -3366,9 +3366,9 @@ discard block  | 
                                                    ||
| 3366 | 3366 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3367 | 3367 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3368 | 3368 | |
| 3369 | -					$opt .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3369 | +					$opt .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3370 | 3370 | |
| 3371 | -					$outval .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3371 | +					$outval .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3372 | 3372 |  					if ($virtualstock > 0) { | 
                                                        
| 3373 | 3373 | $outval .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3374 | 3374 |  					} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3446,7 +3446,7 @@ discard block  | 
                                                    ||
| 3446 | 3446 | $selected_input_value = '';  | 
                                                        
| 3447 | 3447 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { | 
                                                        
| 3448 | 3448 |  			if ($selected > 0) { | 
                                                        
| 3449 | - require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';  | 
                                                        |
| 3449 | + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';  | 
                                                        |
| 3450 | 3450 | $producttmpselect = new Product($this->db);  | 
                                                        
| 3451 | 3451 | $producttmpselect->fetch($selected);  | 
                                                        
| 3452 | 3452 | $selected_input_value = $producttmpselect->ref;  | 
                                                        
@@ -3454,10 +3454,10 @@ discard block  | 
                                                    ||
| 3454 | 3454 | }  | 
                                                        
| 3455 | 3455 | |
| 3456 | 3456 | // mode=2 means suppliers products  | 
                                                        
| 3457 | - $urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;  | 
                                                        |
| 3458 | - print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 3457 | + $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;  | 
                                                        |
| 3458 | + print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);  | 
                                                        |
| 3459 | 3459 | |
| 3460 | -			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="minwidth300" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>'; | 
                                                        |
| 3460 | +			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="minwidth300" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>'; | 
                                                        |
| 3461 | 3461 |  		} else { | 
                                                        
| 3462 | 3462 | print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);  | 
                                                        
| 3463 | 3463 | }  | 
                                                        
@@ -3517,25 +3517,25 @@ discard block  | 
                                                    ||
| 3517 | 3517 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3518 | 3518 | $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";  | 
                                                        
| 3519 | 3519 | }  | 
                                                        
| 3520 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3521 | -		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )"; | 
                                                        |
| 3520 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3521 | +		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )"; | 
                                                        |
| 3522 | 3522 |  		if ($socid > 0) { | 
                                                        
| 3523 | - $sql .= " AND pfp.fk_soc = " . ((int) $socid);  | 
                                                        |
| 3523 | + $sql .= " AND pfp.fk_soc = ".((int) $socid);  | 
                                                        |
| 3524 | 3524 | }  | 
                                                        
| 3525 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3525 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3526 | 3526 | // Units  | 
                                                        
| 3527 | 3527 |  		if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3528 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3528 | + $sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";  | 
                                                        |
| 3529 | 3529 | }  | 
                                                        
| 3530 | -		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")"; | 
                                                        |
| 3530 | +		$sql .= " WHERE p.entity IN (".getEntity('product').")"; | 
                                                        |
| 3531 | 3531 |  		if ($statut != -1) { | 
                                                        
| 3532 | - $sql .= " AND p.tobuy = " . ((int) $statut);  | 
                                                        |
| 3532 | + $sql .= " AND p.tobuy = ".((int) $statut);  | 
                                                        |
| 3533 | 3533 | }  | 
                                                        
| 3534 | 3534 |  		if (strval($filtertype) != '') { | 
                                                        
| 3535 | - $sql .= " AND p.fk_product_type = " . ((int) $filtertype);  | 
                                                        |
| 3535 | + $sql .= " AND p.fk_product_type = ".((int) $filtertype);  | 
                                                        |
| 3536 | 3536 | }  | 
                                                        
| 3537 | 3537 |  		if (!empty($filtre)) { | 
                                                        
| 3538 | - $sql .= " " . $filtre;  | 
                                                        |
| 3538 | + $sql .= " ".$filtre;  | 
                                                        |
| 3539 | 3539 | }  | 
                                                        
| 3540 | 3540 | // Add where from hooks  | 
                                                        
| 3541 | 3541 | $parameters = array();  | 
                                                        
@@ -3555,9 +3555,9 @@ discard block  | 
                                                    ||
| 3555 | 3555 |  				if ($i > 0) { | 
                                                        
| 3556 | 3556 | $sql .= " AND ";  | 
                                                        
| 3557 | 3557 | }  | 
                                                        
| 3558 | - $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) . "%'";  | 
                                                        |
| 3558 | + $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)."%'";  | 
                                                        |
| 3559 | 3559 |  				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { | 
                                                        
| 3560 | - $sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 3560 | + $sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 3561 | 3561 | }  | 
                                                        
| 3562 | 3562 | $sql .= ")";  | 
                                                        
| 3563 | 3563 | $i++;  | 
                                                        
@@ -3566,8 +3566,8 @@ discard block  | 
                                                    ||
| 3566 | 3566 | $sql .= ")";  | 
                                                        
| 3567 | 3567 | }  | 
                                                        
| 3568 | 3568 |  			if (isModEnabled('barcode')) { | 
                                                        
| 3569 | - $sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3570 | - $sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";  | 
                                                        |
| 3569 | + $sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3570 | + $sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";  | 
                                                        |
| 3571 | 3571 | }  | 
                                                        
| 3572 | 3572 | $sql .= ')';  | 
                                                        
| 3573 | 3573 | }  | 
                                                        
@@ -3576,20 +3576,20 @@ discard block  | 
                                                    ||
| 3576 | 3576 | |
| 3577 | 3577 | // Build output string  | 
                                                        
| 3578 | 3578 | |
| 3579 | - dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3579 | + dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);  | 
                                                        |
| 3580 | 3580 | $result = $this->db->query($sql);  | 
                                                        
| 3581 | 3581 |  		if ($result) { | 
                                                        
| 3582 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3583 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';  | 
                                                        |
| 3582 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3583 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';  | 
                                                        |
| 3584 | 3584 | |
| 3585 | 3585 | $num = $this->db->num_rows($result);  | 
                                                        
| 3586 | 3586 | |
| 3587 | 3587 | //$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">'; // remove select to have id same with combo and ajax  | 
                                                        
| 3588 | - $out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3588 | + $out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3589 | 3589 |  			if (!$selected) { | 
                                                        
| 3590 | - $out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3590 | + $out .= '<option value="-1" selected>'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3591 | 3591 |  			} else { | 
                                                        
| 3592 | - $out .= '<option value="-1">' . ($placeholder ? $placeholder : ' ') . '</option>';  | 
                                                        |
| 3592 | + $out .= '<option value="-1">'.($placeholder ? $placeholder : ' ').'</option>';  | 
                                                        |
| 3593 | 3593 | }  | 
                                                        
| 3594 | 3594 | |
| 3595 | 3595 | $i = 0;  | 
                                                        
@@ -3604,7 +3604,7 @@ discard block  | 
                                                    ||
| 3604 | 3604 | |
| 3605 | 3605 | $outkey = $objp->idprodfournprice; // id in table of price  | 
                                                        
| 3606 | 3606 |  				if (!$outkey && $alsoproductwithnosupplierprice) { | 
                                                        
| 3607 | - $outkey = 'idprod_' . $objp->rowid; // id of product  | 
                                                        |
| 3607 | + $outkey = 'idprod_'.$objp->rowid; // id of product  | 
                                                        |
| 3608 | 3608 | }  | 
                                                        
| 3609 | 3609 | |
| 3610 | 3610 | $outref = $objp->ref;  | 
                                                        
@@ -3619,23 +3619,23 @@ discard block  | 
                                                    ||
| 3619 | 3619 | $outvalUnits = '';  | 
                                                        
| 3620 | 3620 |  				if (getDolGlobalInt('PRODUCT_USE_UNITS')) { | 
                                                        
| 3621 | 3621 |  					if (!empty($objp->unit_short)) { | 
                                                        
| 3622 | - $outvalUnits .= ' - ' . $objp->unit_short;  | 
                                                        |
| 3622 | + $outvalUnits .= ' - '.$objp->unit_short;  | 
                                                        |
| 3623 | 3623 | }  | 
                                                        
| 3624 | 3624 |  					if (!empty($objp->weight) && $objp->weight_units !== null) { | 
                                                        
| 3625 | 3625 | $unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);  | 
                                                        
| 3626 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3626 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3627 | 3627 | }  | 
                                                        
| 3628 | 3628 |  					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) { | 
                                                        
| 3629 | - $unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3630 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3629 | + $unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);  | 
                                                        |
| 3630 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3631 | 3631 | }  | 
                                                        
| 3632 | 3632 |  					if (!empty($objp->surface) && $objp->surface_units !== null) { | 
                                                        
| 3633 | 3633 | $unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);  | 
                                                        
| 3634 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3634 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3635 | 3635 | }  | 
                                                        
| 3636 | 3636 |  					if (!empty($objp->volume) && $objp->volume_units !== null) { | 
                                                        
| 3637 | 3637 | $unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);  | 
                                                        
| 3638 | - $outvalUnits .= ' - ' . $unitToShow;  | 
                                                        |
| 3638 | + $outvalUnits .= ' - '.$unitToShow;  | 
                                                        |
| 3639 | 3639 | }  | 
                                                        
| 3640 | 3640 |  					if ($outdurationvalue && $outdurationunit) { | 
                                                        
| 3641 | 3641 | $da = array(  | 
                                                        
@@ -3646,22 +3646,22 @@ discard block  | 
                                                    ||
| 3646 | 3646 |  							'y' => $langs->trans('Year') | 
                                                        
| 3647 | 3647 | );  | 
                                                        
| 3648 | 3648 |  						if (isset($da[$outdurationunit])) { | 
                                                        
| 3649 | - $outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3649 | + $outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));  | 
                                                        |
| 3650 | 3650 | }  | 
                                                        
| 3651 | 3651 | }  | 
                                                        
| 3652 | 3652 | }  | 
                                                        
| 3653 | 3653 | |
| 3654 | 3654 | $objRef = $objp->ref;  | 
                                                        
| 3655 | 3655 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3656 | -					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3656 | +					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 3657 | 3657 | }  | 
                                                        
| 3658 | 3658 | $objRefFourn = $objp->ref_fourn;  | 
                                                        
| 3659 | 3659 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3660 | -					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3660 | +					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1); | 
                                                        |
| 3661 | 3661 | }  | 
                                                        
| 3662 | 3662 | $label = $objp->label;  | 
                                                        
| 3663 | 3663 |  				if ($filterkey && $filterkey != '') { | 
                                                        
| 3664 | -					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3664 | +					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1); | 
                                                        |
| 3665 | 3665 | }  | 
                                                        
| 3666 | 3666 | |
| 3667 | 3667 |  				switch ($objp->fk_product_type) { | 
                                                        
@@ -3684,21 +3684,21 @@ discard block  | 
                                                    ||
| 3684 | 3684 | |
| 3685 | 3685 | $optlabel .= $objp->ref;  | 
                                                        
| 3686 | 3686 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3687 | -					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>'; | 
                                                        |
| 3687 | +					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>'; | 
                                                        |
| 3688 | 3688 | }  | 
                                                        
| 3689 | 3689 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3690 | -					$optlabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3690 | +					$optlabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3691 | 3691 | }  | 
                                                        
| 3692 | - $optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3692 | + $optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3693 | 3693 | |
| 3694 | 3694 | $outvallabel = $objRef;  | 
                                                        
| 3695 | 3695 |  				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) { | 
                                                        
| 3696 | -					$outvallabel .= ' (' . $objRefFourn . ')'; | 
                                                        |
| 3696 | +					$outvallabel .= ' ('.$objRefFourn.')'; | 
                                                        |
| 3697 | 3697 | }  | 
                                                        
| 3698 | 3698 |  				if (isModEnabled('barcode') && !empty($objp->barcode)) { | 
                                                        
| 3699 | -					$outvallabel .= ' (' . $outbarcode . ')'; | 
                                                        |
| 3699 | +					$outvallabel .= ' ('.$outbarcode.')'; | 
                                                        |
| 3700 | 3700 | }  | 
                                                        
| 3701 | - $outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3701 | + $outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);  | 
                                                        |
| 3702 | 3702 | |
| 3703 | 3703 | // Units  | 
                                                        
| 3704 | 3704 | $optlabel .= $outvalUnits;  | 
                                                        
@@ -3715,7 +3715,7 @@ discard block  | 
                                                    ||
| 3715 | 3715 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 3716 | 3716 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 3717 | 3717 | |
| 3718 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3718 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3719 | 3719 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3720 | 3720 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 3721 | 3721 |  						if ($price_result >= 0) { | 
                                                        
@@ -3726,57 +3726,57 @@ discard block  | 
                                                    ||
| 3726 | 3726 | }  | 
                                                        
| 3727 | 3727 | }  | 
                                                        
| 3728 | 3728 |  					if ($objp->quantity == 1) { | 
                                                        
| 3729 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3730 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3729 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3730 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3731 | 3731 |  						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        
| 3732 | 3732 |  						$outvallabel .= $langs->transnoentities("Unit"); | 
                                                        
| 3733 | 3733 |  					} else { | 
                                                        
| 3734 | -						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3735 | -						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity; | 
                                                        |
| 3736 | -						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3737 | -						$outvallabel .= ' ' . $langs->transnoentities("Units"); | 
                                                        |
| 3734 | +						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3735 | +						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; | 
                                                        |
| 3736 | +						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding | 
                                                        |
| 3737 | +						$outvallabel .= ' '.$langs->transnoentities("Units"); | 
                                                        |
| 3738 | 3738 | }  | 
                                                        
| 3739 | 3739 | |
| 3740 | 3740 |  					if ($objp->quantity > 1) { | 
                                                        
| 3741 | -						$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 | 
                                                        |
| 3742 | -						$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 | 
                                                        |
| 3741 | +						$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 | 
                                                        |
| 3742 | +						$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 | 
                                                        |
| 3743 | 3743 | }  | 
                                                        
| 3744 | 3744 |  					if ($objp->remise_percent >= 1) { | 
                                                        
| 3745 | -						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3746 | -						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %'; | 
                                                        |
| 3745 | +						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3746 | +						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %'; | 
                                                        |
| 3747 | 3747 | }  | 
                                                        
| 3748 | 3748 |  					if ($objp->duration) { | 
                                                        
| 3749 | - $optlabel .= " - " . $objp->duration;  | 
                                                        |
| 3750 | - $outvallabel .= " - " . $objp->duration;  | 
                                                        |
| 3749 | + $optlabel .= " - ".$objp->duration;  | 
                                                        |
| 3750 | + $outvallabel .= " - ".$objp->duration;  | 
                                                        |
| 3751 | 3751 | }  | 
                                                        
| 3752 | 3752 |  					if (!$socid) { | 
                                                        
| 3753 | - $optlabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3754 | - $outvallabel .= " - " . dol_trunc($objp->name, 8);  | 
                                                        |
| 3753 | + $optlabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3754 | + $outvallabel .= " - ".dol_trunc($objp->name, 8);  | 
                                                        |
| 3755 | 3755 | }  | 
                                                        
| 3756 | 3756 |  					if ($objp->supplier_reputation) { | 
                                                        
| 3757 | 3757 | //TODO dictionary  | 
                                                        
| 3758 | 3758 |  						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier')); | 
                                                        
| 3759 | 3759 | |
| 3760 | - $optlabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3761 | - $outvallabel .= " - " . $reputations[$objp->supplier_reputation];  | 
                                                        |
| 3760 | + $optlabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3761 | + $outvallabel .= " - ".$reputations[$objp->supplier_reputation];  | 
                                                        |
| 3762 | 3762 | }  | 
                                                        
| 3763 | 3763 |  				} else { | 
                                                        
| 3764 | -					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>'; | 
                                                        |
| 3765 | -					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3764 | +					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>'; | 
                                                        |
| 3765 | +					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); | 
                                                        |
| 3766 | 3766 | }  | 
                                                        
| 3767 | 3767 | |
| 3768 | 3768 |  				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { | 
                                                        
| 3769 | 3769 | $novirtualstock = ($showstockinlist == 2);  | 
                                                        
| 3770 | 3770 | |
| 3771 | 3771 |  					if ($user->hasRight('stock', 'lire')) { | 
                                                        
| 3772 | -						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3772 | +						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3773 | 3773 | |
| 3774 | 3774 |  						if ($objp->stock > 0) { | 
                                                        
| 3775 | 3775 | $optlabel .= ' - <span class="product_line_stock_ok">';  | 
                                                        
| 3776 | 3776 |  						} elseif ($objp->stock <= 0) { | 
                                                        
| 3777 | 3777 | $optlabel .= ' - <span class="product_line_stock_too_low">';  | 
                                                        
| 3778 | 3778 | }  | 
                                                        
| 3779 | -						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3779 | +						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS')); | 
                                                        |
| 3780 | 3780 | $optlabel .= '</span>';  | 
                                                        
| 3781 | 3781 |  						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation | 
                                                        
| 3782 | 3782 |  							$langs->load("stocks"); | 
                                                        
@@ -3786,9 +3786,9 @@ discard block  | 
                                                    ||
| 3786 | 3786 | $tmpproduct->load_virtual_stock();  | 
                                                        
| 3787 | 3787 | $virtualstock = $tmpproduct->stock_theorique;  | 
                                                        
| 3788 | 3788 | |
| 3789 | -							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock; | 
                                                        |
| 3789 | +							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock; | 
                                                        |
| 3790 | 3790 | |
| 3791 | -							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':'; | 
                                                        |
| 3791 | +							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':'; | 
                                                        |
| 3792 | 3792 |  							if ($virtualstock > 0) { | 
                                                        
| 3793 | 3793 | $optlabel .= '<span class="product_line_stock_ok">';  | 
                                                        
| 3794 | 3794 |  							} elseif ($virtualstock <= 0) { | 
                                                        
@@ -3802,7 +3802,7 @@ discard block  | 
                                                    ||
| 3802 | 3802 | }  | 
                                                        
| 3803 | 3803 | }  | 
                                                        
| 3804 | 3804 | |
| 3805 | - $optstart = '<option value="' . $outkey . '"';  | 
                                                        |
| 3805 | + $optstart = '<option value="'.$outkey.'"';  | 
                                                        |
| 3806 | 3806 |  				if ($selected && $selected == $objp->idprodfournprice) { | 
                                                        
| 3807 | 3807 | $optstart .= ' selected';  | 
                                                        
| 3808 | 3808 | }  | 
                                                        
@@ -3811,31 +3811,31 @@ discard block  | 
                                                    ||
| 3811 | 3811 | }  | 
                                                        
| 3812 | 3812 | |
| 3813 | 3813 |  				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) { | 
                                                        
| 3814 | - $optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';  | 
                                                        |
| 3815 | - $optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';  | 
                                                        |
| 3816 | - $optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';  | 
                                                        |
| 3817 | - $optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';  | 
                                                        |
| 3818 | - $optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';  | 
                                                        |
| 3819 | - $optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';  | 
                                                        |
| 3820 | - $optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';  | 
                                                        |
| 3821 | - $optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';  | 
                                                        |
| 3822 | - $optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';  | 
                                                        |
| 3823 | - $optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';  | 
                                                        |
| 3814 | + $optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';  | 
                                                        |
| 3815 | + $optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';  | 
                                                        |
| 3816 | + $optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';  | 
                                                        |
| 3817 | + $optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';  | 
                                                        |
| 3818 | + $optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';  | 
                                                        |
| 3819 | + $optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';  | 
                                                        |
| 3820 | + $optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';  | 
                                                        |
| 3821 | + $optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';  | 
                                                        |
| 3822 | + $optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';  | 
                                                        |
| 3823 | + $optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';  | 
                                                        |
| 3824 | 3824 |  					if (isModEnabled('multicurrency')) { | 
                                                        
| 3825 | - $optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';  | 
                                                        |
| 3826 | - $optstart .= ' data-multicurrency-up="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';  | 
                                                        |
| 3825 | + $optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';  | 
                                                        |
| 3826 | + $optstart .= ' data-multicurrency-up="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';  | 
                                                        |
| 3827 | 3827 | }  | 
                                                        
| 3828 | 3828 | }  | 
                                                        
| 3829 | - $optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';  | 
                                                        |
| 3829 | + $optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';  | 
                                                        |
| 3830 | 3830 | |
| 3831 | 3831 | $outarrayentry = array(  | 
                                                        
| 3832 | 3832 | 'key' => $outkey,  | 
                                                        
| 3833 | 3833 | 'value' => $outref,  | 
                                                        
| 3834 | 3834 | 'label' => $outvallabel,  | 
                                                        
| 3835 | 3835 | 'qty' => $outqty,  | 
                                                        
| 3836 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3837 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3838 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3836 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3837 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3838 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3839 | 3839 | 'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),  | 
                                                        
| 3840 | 3840 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 3841 | 3841 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -3864,17 +3864,17 @@ discard block  | 
                                                    ||
| 3864 | 3864 | // Add new entry  | 
                                                        
| 3865 | 3865 | // "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  | 
                                                        
| 3866 | 3866 | // "label" value of json key array is used by jQuery automatically as text for combo box  | 
                                                        
| 3867 | - $out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";  | 
                                                        |
| 3867 | + $out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";  | 
                                                        |
| 3868 | 3868 | $outarraypush = array(  | 
                                                        
| 3869 | 3869 | 'key' => $outkey,  | 
                                                        
| 3870 | 3870 | 'value' => $outref,  | 
                                                        
| 3871 | 3871 | 'label' => $outvallabel,  | 
                                                        
| 3872 | 3872 | 'qty' => $outqty,  | 
                                                        
| 3873 | - 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3873 | + 'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty  | 
                                                        |
| 3874 | 3874 | 'price_qty_ht_locale' => price($objp->fprice),  | 
                                                        
| 3875 | - 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3875 | + 'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price  | 
                                                        |
| 3876 | 3876 | 'price_unit_ht_locale' => price($objp->unitprice),  | 
                                                        
| 3877 | - 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3877 | + 'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)  | 
                                                        |
| 3878 | 3878 | 'tva_tx_formated' => price($objp->tva_tx),  | 
                                                        
| 3879 | 3879 | 'tva_tx' => price2num($objp->tva_tx),  | 
                                                        
| 3880 | 3880 | 'default_vat_code' => $objp->default_vat_code,  | 
                                                        
@@ -3906,7 +3906,7 @@ discard block  | 
                                                    ||
| 3906 | 3906 | |
| 3907 | 3907 | $this->db->free($result);  | 
                                                        
| 3908 | 3908 | |
| 3909 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 3909 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 3910 | 3910 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 3911 | 3911 |  		} else { | 
                                                        
| 3912 | 3912 | dol_print_error($this->db);  | 
                                                        
@@ -3938,43 +3938,43 @@ discard block  | 
                                                    ||
| 3938 | 3938 | $sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";  | 
                                                        
| 3939 | 3939 | $sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";  | 
                                                        
| 3940 | 3940 | $sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";  | 
                                                        
| 3941 | - $sql .= " FROM " . $this->db->prefix() . "product as p";  | 
                                                        |
| 3942 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 3943 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3944 | -		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")"; | 
                                                        |
| 3941 | + $sql .= " FROM ".$this->db->prefix()."product as p";  | 
                                                        |
| 3942 | + $sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";  | 
                                                        |
| 3943 | + $sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";  | 
                                                        |
| 3944 | +		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; | 
                                                        |
| 3945 | 3945 | $sql .= " AND p.tobuy = 1";  | 
                                                        
| 3946 | 3946 | $sql .= " AND s.fournisseur = 1";  | 
                                                        
| 3947 | - $sql .= " AND p.rowid = " . ((int) $productid);  | 
                                                        |
| 3947 | + $sql .= " AND p.rowid = ".((int) $productid);  | 
                                                        |
| 3948 | 3948 |  		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) { | 
                                                        
| 3949 | 3949 | $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";  | 
                                                        
| 3950 | 3950 |  		} else { | 
                                                        
| 3951 | 3951 | $sql .= " ORDER BY pfp.unitprice ASC";  | 
                                                        
| 3952 | 3952 | }  | 
                                                        
| 3953 | 3953 | |
| 3954 | - dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 3954 | + dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);  | 
                                                        |
| 3955 | 3955 | $result = $this->db->query($sql);  | 
                                                        
| 3956 | 3956 | |
| 3957 | 3957 |  		if ($result) { | 
                                                        
| 3958 | 3958 | $num = $this->db->num_rows($result);  | 
                                                        
| 3959 | 3959 | |
| 3960 | - $form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 3960 | + $form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 3961 | 3961 | |
| 3962 | 3962 |  			if (!$num) { | 
                                                        
| 3963 | -				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>'; | 
                                                        |
| 3963 | +				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>'; | 
                                                        |
| 3964 | 3964 |  			} else { | 
                                                        
| 3965 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3965 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3966 | 3966 | $form .= '<option value="0"> </option>';  | 
                                                        
| 3967 | 3967 | |
| 3968 | 3968 | $i = 0;  | 
                                                        
| 3969 | 3969 |  				while ($i < $num) { | 
                                                        
| 3970 | 3970 | $objp = $this->db->fetch_object($result);  | 
                                                        
| 3971 | 3971 | |
| 3972 | - $opt = '<option value="' . $objp->idprodfournprice . '"';  | 
                                                        |
| 3972 | + $opt = '<option value="'.$objp->idprodfournprice.'"';  | 
                                                        |
| 3973 | 3973 | //if there is only one supplier, preselect it  | 
                                                        
| 3974 | 3974 |  					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) { | 
                                                        
| 3975 | 3975 | $opt .= ' selected';  | 
                                                        
| 3976 | 3976 | }  | 
                                                        
| 3977 | - $opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';  | 
                                                        |
| 3977 | + $opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';  | 
                                                        |
| 3978 | 3978 | |
| 3979 | 3979 |  					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) { | 
                                                        
| 3980 | 3980 | $prod_supplier = new ProductFournisseur($this->db);  | 
                                                        
@@ -3984,7 +3984,7 @@ discard block  | 
                                                    ||
| 3984 | 3984 | $prod_supplier->fourn_tva_tx = $objp->tva_tx;  | 
                                                        
| 3985 | 3985 | $prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;  | 
                                                        
| 3986 | 3986 | |
| 3987 | - require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3987 | + require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';  | 
                                                        |
| 3988 | 3988 | $priceparser = new PriceParser($this->db);  | 
                                                        
| 3989 | 3989 | $price_result = $priceparser->parseProductSupplier($prod_supplier);  | 
                                                        
| 3990 | 3990 |  						if ($price_result >= 0) { | 
                                                        
@@ -3995,10 +3995,10 @@ discard block  | 
                                                    ||
| 3995 | 3995 | }  | 
                                                        
| 3996 | 3996 | }  | 
                                                        
| 3997 | 3997 |  					if ($objp->quantity == 1) { | 
                                                        
| 3998 | -						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/"; | 
                                                        |
| 3998 | +						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/"; | 
                                                        |
| 3999 | 3999 | }  | 
                                                        
| 4000 | 4000 | |
| 4001 | - $opt .= $objp->quantity . ' ';  | 
                                                        |
| 4001 | + $opt .= $objp->quantity.' ';  | 
                                                        |
| 4002 | 4002 | |
| 4003 | 4003 |  					if ($objp->quantity == 1) { | 
                                                        
| 4004 | 4004 |  						$opt .= $langs->trans("Unit"); | 
                                                        
@@ -4007,10 +4007,10 @@ discard block  | 
                                                    ||
| 4007 | 4007 | }  | 
                                                        
| 4008 | 4008 |  					if ($objp->quantity > 1) { | 
                                                        
| 4009 | 4009 | $opt .= " - ";  | 
                                                        
| 4010 | -						$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"); | 
                                                        |
| 4010 | +						$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"); | 
                                                        |
| 4011 | 4011 | }  | 
                                                        
| 4012 | 4012 |  					if ($objp->duration) { | 
                                                        
| 4013 | - $opt .= " - " . $objp->duration;  | 
                                                        |
| 4013 | + $opt .= " - ".$objp->duration;  | 
                                                        |
| 4014 | 4014 | }  | 
                                                        
| 4015 | 4015 | $opt .= "</option>\n";  | 
                                                        
| 4016 | 4016 | |
@@ -4048,8 +4048,8 @@ discard block  | 
                                                    ||
| 4048 | 4048 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 4049 | 4049 | |
| 4050 | 4050 | $sql = "SELECT rowid, code, libelle as label, deposit_percent";  | 
                                                        
| 4051 | - $sql .= " FROM " . $this->db->prefix() . 'c_payment_term';  | 
                                                        |
| 4052 | -		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")"; | 
                                                        |
| 4051 | + $sql .= " FROM ".$this->db->prefix().'c_payment_term';  | 
                                                        |
| 4052 | +		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")"; | 
                                                        |
| 4053 | 4053 | $sql .= " AND active > 0";  | 
                                                        
| 4054 | 4054 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4055 | 4055 | |
@@ -4061,7 +4061,7 @@ discard block  | 
                                                    ||
| 4061 | 4061 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4062 | 4062 | |
| 4063 | 4063 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4064 | -				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4064 | +				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4065 | 4065 | $this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4066 | 4066 | $this->cache_conditions_paiements[$obj->rowid]['label'] = $label;  | 
                                                        
| 4067 | 4067 | $this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;  | 
                                                        
@@ -4089,7 +4089,7 @@ discard block  | 
                                                    ||
| 4089 | 4089 | // phpcs:enable  | 
                                                        
| 4090 | 4090 | global $langs;  | 
                                                        
| 4091 | 4091 | |
| 4092 | - $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4092 | + $num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability  | 
                                                        |
| 4093 | 4093 |  		if ($num > 0) { | 
                                                        
| 4094 | 4094 | return 0; // Cache already loaded  | 
                                                        
| 4095 | 4095 | }  | 
                                                        
@@ -4099,7 +4099,7 @@ discard block  | 
                                                    ||
| 4099 | 4099 |  		$langs->load('propal'); | 
                                                        
| 4100 | 4100 | |
| 4101 | 4101 | $sql = "SELECT rowid, code, label, position";  | 
                                                        
| 4102 | - $sql .= " FROM " . $this->db->prefix() . 'c_availability';  | 
                                                        |
| 4102 | + $sql .= " FROM ".$this->db->prefix().'c_availability';  | 
                                                        |
| 4103 | 4103 | $sql .= " WHERE active > 0";  | 
                                                        
| 4104 | 4104 | |
| 4105 | 4105 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4110,7 +4110,7 @@ discard block  | 
                                                    ||
| 4110 | 4110 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4111 | 4111 | |
| 4112 | 4112 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4113 | -				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4113 | +				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4114 | 4114 | $this->cache_availability[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4115 | 4115 | $this->cache_availability[$obj->rowid]['label'] = $label;  | 
                                                        
| 4116 | 4116 | $this->cache_availability[$obj->rowid]['position'] = $obj->position;  | 
                                                        
@@ -4142,17 +4142,17 @@ discard block  | 
                                                    ||
| 4142 | 4142 | |
| 4143 | 4143 | $this->load_cache_availability();  | 
                                                        
| 4144 | 4144 | |
| 4145 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4145 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4146 | 4146 | |
| 4147 | - print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4147 | + print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4148 | 4148 |  		if ($addempty) { | 
                                                        
| 4149 | 4149 | print '<option value="0"> </option>';  | 
                                                        
| 4150 | 4150 | }  | 
                                                        
| 4151 | 4151 |  		foreach ($this->cache_availability as $id => $arrayavailability) { | 
                                                        
| 4152 | 4152 |  			if ($selected == $id) { | 
                                                        
| 4153 | - print '<option value="' . $id . '" selected>';  | 
                                                        |
| 4153 | + print '<option value="'.$id.'" selected>';  | 
                                                        |
| 4154 | 4154 |  			} else { | 
                                                        
| 4155 | - print '<option value="' . $id . '">';  | 
                                                        |
| 4155 | + print '<option value="'.$id.'">';  | 
                                                        |
| 4156 | 4156 | }  | 
                                                        
| 4157 | 4157 | print dol_escape_htmltag($arrayavailability['label']);  | 
                                                        
| 4158 | 4158 | print '</option>';  | 
                                                        
@@ -4173,13 +4173,13 @@ discard block  | 
                                                    ||
| 4173 | 4173 |  	{ | 
                                                        
| 4174 | 4174 | global $langs;  | 
                                                        
| 4175 | 4175 | |
| 4176 | - $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4176 | + $num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason  | 
                                                        |
| 4177 | 4177 |  		if ($num > 0) { | 
                                                        
| 4178 | 4178 | return 0; // Cache already loaded  | 
                                                        
| 4179 | 4179 | }  | 
                                                        
| 4180 | 4180 | |
| 4181 | 4181 | $sql = "SELECT rowid, code, label";  | 
                                                        
| 4182 | - $sql .= " FROM " . $this->db->prefix() . 'c_input_reason';  | 
                                                        |
| 4182 | + $sql .= " FROM ".$this->db->prefix().'c_input_reason';  | 
                                                        |
| 4183 | 4183 | $sql .= " WHERE active > 0";  | 
                                                        
| 4184 | 4184 | |
| 4185 | 4185 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4192,8 +4192,8 @@ discard block  | 
                                                    ||
| 4192 | 4192 | |
| 4193 | 4193 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4194 | 4194 | $label = ($obj->label != '-' ? $obj->label : '');  | 
                                                        
| 4195 | -				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) { | 
                                                        |
| 4196 | -					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4195 | +				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) { | 
                                                        |
| 4196 | +					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work | 
                                                        |
| 4197 | 4197 | }  | 
                                                        
| 4198 | 4198 |  				if ($langs->trans($obj->code) != $obj->code) { | 
                                                        
| 4199 | 4199 | $label = $langs->trans($obj->code); // So translation key SRC_XXX will work  | 
                                                        
@@ -4233,9 +4233,9 @@ discard block  | 
                                                    ||
| 4233 | 4233 | |
| 4234 | 4234 | $this->loadCacheInputReason();  | 
                                                        
| 4235 | 4235 | |
| 4236 | - print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4236 | + print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4237 | 4237 |  		if ($addempty) { | 
                                                        
| 4238 | - print '<option value="0"' . (empty($selected) ? ' selected' : '') . '> </option>';  | 
                                                        |
| 4238 | + print '<option value="0"'.(empty($selected) ? ' selected' : '').'> </option>';  | 
                                                        |
| 4239 | 4239 | }  | 
                                                        
| 4240 | 4240 |  		foreach ($this->cache_demand_reason as $id => $arraydemandreason) { | 
                                                        
| 4241 | 4241 |  			if ($arraydemandreason['code'] == $exclude) { | 
                                                        
@@ -4243,9 +4243,9 @@ discard block  | 
                                                    ||
| 4243 | 4243 | }  | 
                                                        
| 4244 | 4244 | |
| 4245 | 4245 |  			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) { | 
                                                        
| 4246 | - print '<option value="' . $arraydemandreason['id'] . '" selected>';  | 
                                                        |
| 4246 | + print '<option value="'.$arraydemandreason['id'].'" selected>';  | 
                                                        |
| 4247 | 4247 |  			} else { | 
                                                        
| 4248 | - print '<option value="' . $arraydemandreason['id'] . '">';  | 
                                                        |
| 4248 | + print '<option value="'.$arraydemandreason['id'].'">';  | 
                                                        |
| 4249 | 4249 | }  | 
                                                        
| 4250 | 4250 | $label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason  | 
                                                        
| 4251 | 4251 | print $langs->trans($label);  | 
                                                        
@@ -4255,7 +4255,7 @@ discard block  | 
                                                    ||
| 4255 | 4255 |  		if ($user->admin && empty($notooltip)) { | 
                                                        
| 4256 | 4256 |  			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4257 | 4257 | }  | 
                                                        
| 4258 | -		print ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4258 | +		print ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4259 | 4259 | }  | 
                                                        
| 4260 | 4260 | |
| 4261 | 4261 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps  | 
                                                        
@@ -4270,7 +4270,7 @@ discard block  | 
                                                    ||
| 4270 | 4270 | // phpcs:enable  | 
                                                        
| 4271 | 4271 | global $langs;  | 
                                                        
| 4272 | 4272 | |
| 4273 | - $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4273 | + $num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements  | 
                                                        |
| 4274 | 4274 |  		if ($num > 0) { | 
                                                        
| 4275 | 4275 | return $num; // Cache already loaded  | 
                                                        
| 4276 | 4276 | }  | 
                                                        
@@ -4280,8 +4280,8 @@ discard block  | 
                                                    ||
| 4280 | 4280 | $this->cache_types_paiements = array();  | 
                                                        
| 4281 | 4281 | |
| 4282 | 4282 | $sql = "SELECT id, code, libelle as label, type, active";  | 
                                                        
| 4283 | - $sql .= " FROM " . $this->db->prefix() . "c_paiement";  | 
                                                        |
| 4284 | -		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")"; | 
                                                        |
| 4283 | + $sql .= " FROM ".$this->db->prefix()."c_paiement";  | 
                                                        |
| 4284 | +		$sql .= " WHERE entity IN (".getEntity('c_paiement').")"; | 
                                                        |
| 4285 | 4285 | |
| 4286 | 4286 | $resql = $this->db->query($sql);  | 
                                                        
| 4287 | 4287 |  		if ($resql) { | 
                                                        
@@ -4291,7 +4291,7 @@ discard block  | 
                                                    ||
| 4291 | 4291 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4292 | 4292 | |
| 4293 | 4293 | // Si traduction existe, on l'utilise, sinon on prend le libelle par default  | 
                                                        
| 4294 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4294 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4295 | 4295 | $this->cache_types_paiements[$obj->id]['id'] = $obj->id;  | 
                                                        
| 4296 | 4296 | $this->cache_types_paiements[$obj->id]['code'] = $obj->code;  | 
                                                        
| 4297 | 4297 | $this->cache_types_paiements[$obj->id]['label'] = $label;  | 
                                                        
@@ -4363,17 +4363,17 @@ discard block  | 
                                                    ||
| 4363 | 4363 | global $langs, $user, $conf;  | 
                                                        
| 4364 | 4364 | |
| 4365 | 4365 | $out = '';  | 
                                                        
| 4366 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 4366 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 4367 | 4367 | |
| 4368 | 4368 | $this->load_cache_conditions_paiements();  | 
                                                        
| 4369 | 4369 | |
| 4370 | 4370 | // Set default value if not already set by caller  | 
                                                        
| 4371 | 4371 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) { | 
                                                        
| 4372 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4372 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);  | 
                                                        |
| 4373 | 4373 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID'); | 
                                                        
| 4374 | 4374 | }  | 
                                                        
| 4375 | 4375 | |
| 4376 | - $out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4376 | + $out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4377 | 4377 |  		if ($addempty) { | 
                                                        
| 4378 | 4378 | $out .= '<option value="0"> </option>';  | 
                                                        
| 4379 | 4379 | }  | 
                                                        
@@ -4387,9 +4387,9 @@ discard block  | 
                                                    ||
| 4387 | 4387 | |
| 4388 | 4388 |  			if ($selected == $id) { | 
                                                        
| 4389 | 4389 | $selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];  | 
                                                        
| 4390 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';  | 
                                                        |
| 4390 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';  | 
                                                        |
| 4391 | 4391 |  			} else { | 
                                                        
| 4392 | - $out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';  | 
                                                        |
| 4392 | + $out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';  | 
                                                        |
| 4393 | 4393 | }  | 
                                                        
| 4394 | 4394 | $label = $arrayconditions['label'];  | 
                                                        
| 4395 | 4395 | |
@@ -4407,21 +4407,21 @@ discard block  | 
                                                    ||
| 4407 | 4407 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 4408 | 4408 | |
| 4409 | 4409 |  		if ($deposit_percent >= 0) { | 
                                                        
| 4410 | - $out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';  | 
                                                        |
| 4411 | -			$out .= $langs->trans('DepositPercent') . ' : '; | 
                                                        |
| 4412 | - $out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';  | 
                                                        |
| 4410 | + $out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';  | 
                                                        |
| 4411 | +			$out .= $langs->trans('DepositPercent').' : '; | 
                                                        |
| 4412 | + $out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';  | 
                                                        |
| 4413 | 4413 | $out .= '</span>';  | 
                                                        
| 4414 | 4414 | $out .= '  | 
                                                        
| 4415 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 4415 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 4416 | 4416 |  					$(document).ready(function () { | 
                                                        
| 4417 | -						$("#' . $htmlname . '").change(function () { | 
                                                        |
| 4417 | +						$("#' . $htmlname.'").change(function () { | 
                                                        |
| 4418 | 4418 |  							let $selected = $(this).find("option:selected"); | 
                                                        
| 4419 | 4419 |  							let depositPercent = $selected.attr("data-deposit_percent"); | 
                                                        
| 4420 | 4420 | |
| 4421 | 4421 |  							if (depositPercent.length > 0) { | 
                                                        
| 4422 | -								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent); | 
                                                        |
| 4422 | +								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent); | 
                                                        |
| 4423 | 4423 |  							} else { | 
                                                        
| 4424 | -								$("#' . $htmlname . '_deposit_percent_container").hide(); | 
                                                        |
| 4424 | +								$("#' . $htmlname.'_deposit_percent_container").hide(); | 
                                                        |
| 4425 | 4425 | }  | 
                                                        
| 4426 | 4426 | |
| 4427 | 4427 | return true;  | 
                                                        
@@ -4459,7 +4459,7 @@ discard block  | 
                                                    ||
| 4459 | 4459 | |
| 4460 | 4460 | $out = '';  | 
                                                        
| 4461 | 4461 | |
| 4462 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4462 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4463 | 4463 | |
| 4464 | 4464 | $filterarray = array();  | 
                                                        
| 4465 | 4465 |  		if ($filtertype == 'CRDT') { | 
                                                        
@@ -4474,11 +4474,11 @@ discard block  | 
                                                    ||
| 4474 | 4474 | |
| 4475 | 4475 | // Set default value if not already set by caller  | 
                                                        
| 4476 | 4476 |  		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) { | 
                                                        
| 4477 | - dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4477 | + dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);  | 
                                                        |
| 4478 | 4478 |  			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID'); | 
                                                        
| 4479 | 4479 | }  | 
                                                        
| 4480 | 4480 | |
| 4481 | - $out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4481 | + $out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4482 | 4482 |  		if ($empty) { | 
                                                        
| 4483 | 4483 | $out .= '<option value=""> </option>';  | 
                                                        
| 4484 | 4484 | }  | 
                                                        
@@ -4499,13 +4499,13 @@ discard block  | 
                                                    ||
| 4499 | 4499 | }  | 
                                                        
| 4500 | 4500 | |
| 4501 | 4501 |  			if ($format == 0) { | 
                                                        
| 4502 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4502 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4503 | 4503 |  			} elseif ($format == 1) { | 
                                                        
| 4504 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4504 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4505 | 4505 |  			} elseif ($format == 2) { | 
                                                        
| 4506 | - $out .= '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4506 | + $out .= '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4507 | 4507 |  			} elseif ($format == 3) { | 
                                                        
| 4508 | - $out .= '<option value="' . $id . '"';  | 
                                                        |
| 4508 | + $out .= '<option value="'.$id.'"';  | 
                                                        |
| 4509 | 4509 | }  | 
                                                        
| 4510 | 4510 | // Print attribute selected or not  | 
                                                        
| 4511 | 4511 |  			if ($format == 1 || $format == 2) { | 
                                                        
@@ -4535,7 +4535,7 @@ discard block  | 
                                                    ||
| 4535 | 4535 |  		if ($user->admin && !$noadmininfo) { | 
                                                        
| 4536 | 4536 |  			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4537 | 4537 | }  | 
                                                        
| 4538 | -		$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4538 | +		$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4539 | 4539 | |
| 4540 | 4540 |  		if (empty($nooutput)) { | 
                                                        
| 4541 | 4541 | print $out;  | 
                                                        
@@ -4557,22 +4557,22 @@ discard block  | 
                                                    ||
| 4557 | 4557 |  	{ | 
                                                        
| 4558 | 4558 | global $langs;  | 
                                                        
| 4559 | 4559 | |
| 4560 | - $return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4560 | + $return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4561 | 4561 | $options = array(  | 
                                                        
| 4562 | 4562 |  			'HT' => $langs->trans("HT"), | 
                                                        
| 4563 | 4563 |  			'TTC' => $langs->trans("TTC") | 
                                                        
| 4564 | 4564 | );  | 
                                                        
| 4565 | 4565 |  		foreach ($options as $id => $value) { | 
                                                        
| 4566 | 4566 |  			if ($selected == $id) { | 
                                                        
| 4567 | - $return .= '<option value="' . $id . '" selected>' . $value;  | 
                                                        |
| 4567 | + $return .= '<option value="'.$id.'" selected>'.$value;  | 
                                                        |
| 4568 | 4568 |  			} else { | 
                                                        
| 4569 | - $return .= '<option value="' . $id . '">' . $value;  | 
                                                        |
| 4569 | + $return .= '<option value="'.$id.'">'.$value;  | 
                                                        |
| 4570 | 4570 | }  | 
                                                        
| 4571 | 4571 | $return .= '</option>';  | 
                                                        
| 4572 | 4572 | }  | 
                                                        
| 4573 | 4573 | $return .= '</select>';  | 
                                                        
| 4574 | 4574 |  		if ($addjscombo) { | 
                                                        
| 4575 | -			$return .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 4575 | +			$return .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 4576 | 4576 | }  | 
                                                        
| 4577 | 4577 | |
| 4578 | 4578 | return $return;  | 
                                                        
@@ -4590,7 +4590,7 @@ discard block  | 
                                                    ||
| 4590 | 4590 | // phpcs:enable  | 
                                                        
| 4591 | 4591 | global $langs;  | 
                                                        
| 4592 | 4592 | |
| 4593 | - $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4593 | + $num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode  | 
                                                        |
| 4594 | 4594 |  		if ($num > 0) { | 
                                                        
| 4595 | 4595 | return $num; // Cache already loaded  | 
                                                        
| 4596 | 4596 | }  | 
                                                        
@@ -4600,8 +4600,8 @@ discard block  | 
                                                    ||
| 4600 | 4600 | $this->cache_transport_mode = array();  | 
                                                        
| 4601 | 4601 | |
| 4602 | 4602 | $sql = "SELECT rowid, code, label, active";  | 
                                                        
| 4603 | - $sql .= " FROM " . $this->db->prefix() . "c_transport_mode";  | 
                                                        |
| 4604 | -		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")"; | 
                                                        |
| 4603 | + $sql .= " FROM ".$this->db->prefix()."c_transport_mode";  | 
                                                        |
| 4604 | +		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")"; | 
                                                        |
| 4605 | 4605 | |
| 4606 | 4606 | $resql = $this->db->query($sql);  | 
                                                        
| 4607 | 4607 |  		if ($resql) { | 
                                                        
@@ -4611,7 +4611,7 @@ discard block  | 
                                                    ||
| 4611 | 4611 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 4612 | 4612 | |
| 4613 | 4613 | // If traduction exist, we use it else we take the default label  | 
                                                        
| 4614 | -				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4614 | +				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); | 
                                                        |
| 4615 | 4615 | $this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 4616 | 4616 | $this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 4617 | 4617 | $this->cache_transport_mode[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -4645,11 +4645,11 @@ discard block  | 
                                                    ||
| 4645 | 4645 |  	{ | 
                                                        
| 4646 | 4646 | global $langs, $user;  | 
                                                        
| 4647 | 4647 | |
| 4648 | - dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);  | 
                                                        |
| 4648 | + dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);  | 
                                                        |
| 4649 | 4649 | |
| 4650 | 4650 | $this->load_cache_transport_mode();  | 
                                                        
| 4651 | 4651 | |
| 4652 | - print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 4652 | + print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 4653 | 4653 |  		if ($empty) { | 
                                                        
| 4654 | 4654 | print '<option value=""> </option>';  | 
                                                        
| 4655 | 4655 | }  | 
                                                        
@@ -4665,13 +4665,13 @@ discard block  | 
                                                    ||
| 4665 | 4665 | }  | 
                                                        
| 4666 | 4666 | |
| 4667 | 4667 |  			if ($format == 0) { | 
                                                        
| 4668 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4668 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4669 | 4669 |  			} elseif ($format == 1) { | 
                                                        
| 4670 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4670 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4671 | 4671 |  			} elseif ($format == 2) { | 
                                                        
| 4672 | - print '<option value="' . $arraytypes['code'] . '"';  | 
                                                        |
| 4672 | + print '<option value="'.$arraytypes['code'].'"';  | 
                                                        |
| 4673 | 4673 |  			} elseif ($format == 3) { | 
                                                        
| 4674 | - print '<option value="' . $id . '"';  | 
                                                        |
| 4674 | + print '<option value="'.$id.'"';  | 
                                                        |
| 4675 | 4675 | }  | 
                                                        
| 4676 | 4676 | // If text is selected, we compare with code, else with id  | 
                                                        
| 4677 | 4677 |  			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) { | 
                                                        
@@ -4719,31 +4719,31 @@ discard block  | 
                                                    ||
| 4719 | 4719 |  		$langs->load("deliveries"); | 
                                                        
| 4720 | 4720 | |
| 4721 | 4721 | $sql = "SELECT rowid, code, libelle as label";  | 
                                                        
| 4722 | - $sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";  | 
                                                        |
| 4722 | + $sql .= " FROM ".$this->db->prefix()."c_shipment_mode";  | 
                                                        |
| 4723 | 4723 | $sql .= " WHERE active > 0";  | 
                                                        
| 4724 | 4724 |  		if ($filtre) { | 
                                                        
| 4725 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4725 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4726 | 4726 | }  | 
                                                        
| 4727 | 4727 | $sql .= " ORDER BY libelle ASC";  | 
                                                        
| 4728 | 4728 | |
| 4729 | - dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4729 | + dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);  | 
                                                        |
| 4730 | 4730 | $result = $this->db->query($sql);  | 
                                                        
| 4731 | 4731 |  		if ($result) { | 
                                                        
| 4732 | 4732 | $num = $this->db->num_rows($result);  | 
                                                        
| 4733 | 4733 | $i = 0;  | 
                                                        
| 4734 | 4734 |  			if ($num) { | 
                                                        
| 4735 | - print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4735 | + print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4736 | 4736 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4737 | 4737 | print '<option value="-1"> </option>';  | 
                                                        
| 4738 | 4738 | }  | 
                                                        
| 4739 | 4739 |  				while ($i < $num) { | 
                                                        
| 4740 | 4740 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4741 | 4741 |  					if ($selected == $obj->rowid) { | 
                                                        
| 4742 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 4742 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 4743 | 4743 |  					} else { | 
                                                        
| 4744 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 4744 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 4745 | 4745 | }  | 
                                                        
| 4746 | -					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4746 | +					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label; | 
                                                        |
| 4747 | 4747 | print '</option>';  | 
                                                        
| 4748 | 4748 | $i++;  | 
                                                        
| 4749 | 4749 | }  | 
                                                        
@@ -4752,7 +4752,7 @@ discard block  | 
                                                    ||
| 4752 | 4752 |  					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        
| 4753 | 4753 | }  | 
                                                        
| 4754 | 4754 | |
| 4755 | -				print ajax_combobox('select' . $htmlname); | 
                                                        |
| 4755 | +				print ajax_combobox('select'.$htmlname); | 
                                                        |
| 4756 | 4756 |  			} else { | 
                                                        
| 4757 | 4757 |  				print $langs->trans("NoShippingMethodDefined"); | 
                                                        
| 4758 | 4758 | }  | 
                                                        
@@ -4777,16 +4777,16 @@ discard block  | 
                                                    ||
| 4777 | 4777 |  		$langs->load("deliveries"); | 
                                                        
| 4778 | 4778 | |
| 4779 | 4779 |  		if ($htmlname != "none") { | 
                                                        
| 4780 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 4780 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 4781 | 4781 | print '<input type="hidden" name="action" value="setshippingmethod">';  | 
                                                        
| 4782 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 4782 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 4783 | 4783 | $this->selectShippingMethod($selected, $htmlname, '', $addempty);  | 
                                                        
| 4784 | -			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 4784 | +			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 4785 | 4785 | print '</form>';  | 
                                                        
| 4786 | 4786 |  		} else { | 
                                                        
| 4787 | 4787 |  			if ($selected) { | 
                                                        
| 4788 | 4788 | $code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');  | 
                                                        
| 4789 | -				print $langs->trans("SendingMethod" . strtoupper($code)); | 
                                                        |
| 4789 | +				print $langs->trans("SendingMethod".strtoupper($code)); | 
                                                        |
| 4790 | 4790 |  			} else { | 
                                                        
| 4791 | 4791 | print " ";  | 
                                                        
| 4792 | 4792 | }  | 
                                                        
@@ -4809,10 +4809,10 @@ discard block  | 
                                                    ||
| 4809 | 4809 | |
| 4810 | 4810 | $opt = '<option value="" selected></option>';  | 
                                                        
| 4811 | 4811 | $sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";  | 
                                                        
| 4812 | - $sql .= ' FROM ' . $this->db->prefix() . 'facture';  | 
                                                        |
| 4813 | -		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')'; | 
                                                        |
| 4812 | + $sql .= ' FROM '.$this->db->prefix().'facture';  | 
                                                        |
| 4813 | +		$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; | 
                                                        |
| 4814 | 4814 | $sql .= ' AND situation_counter >= 1';  | 
                                                        
| 4815 | - $sql .= ' AND fk_soc = ' . (int) $socid;  | 
                                                        |
| 4815 | + $sql .= ' AND fk_soc = '.(int) $socid;  | 
                                                        |
| 4816 | 4816 | $sql .= ' AND type <> 2';  | 
                                                        
| 4817 | 4817 | $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';  | 
                                                        
| 4818 | 4818 | $resql = $this->db->query($sql);  | 
                                                        
@@ -4830,19 +4830,19 @@ discard block  | 
                                                    ||
| 4830 | 4830 | //Not prov?  | 
                                                        
| 4831 | 4831 |  						if (substr($obj->ref, 1, 4) != 'PROV') { | 
                                                        
| 4832 | 4832 |  							if ($selected == $obj->rowid) { | 
                                                        
| 4833 | - $opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';  | 
                                                        |
| 4833 | + $opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';  | 
                                                        |
| 4834 | 4834 |  							} else { | 
                                                        
| 4835 | - $opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';  | 
                                                        |
| 4835 | + $opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';  | 
                                                        |
| 4836 | 4836 | }  | 
                                                        
| 4837 | 4837 | }  | 
                                                        
| 4838 | 4838 | }  | 
                                                        
| 4839 | 4839 | }  | 
                                                        
| 4840 | 4840 | }  | 
                                                        
| 4841 | 4841 |  		} else { | 
                                                        
| 4842 | -			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR); | 
                                                        |
| 4842 | +			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); | 
                                                        |
| 4843 | 4843 | }  | 
                                                        
| 4844 | 4844 |  		if ($opt == '<option value ="" selected></option>') { | 
                                                        
| 4845 | -			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>'; | 
                                                        |
| 4845 | +			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>'; | 
                                                        |
| 4846 | 4846 | }  | 
                                                        
| 4847 | 4847 | return $opt;  | 
                                                        
| 4848 | 4848 | }  | 
                                                        
@@ -4862,12 +4862,12 @@ discard block  | 
                                                    ||
| 4862 | 4862 | |
| 4863 | 4863 |  		$langs->load('products'); | 
                                                        
| 4864 | 4864 | |
| 4865 | - $return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 4865 | + $return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 4866 | 4866 | |
| 4867 | - $sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";  | 
                                                        |
| 4867 | + $sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";  | 
                                                        |
| 4868 | 4868 | $sql .= ' WHERE active > 0';  | 
                                                        
| 4869 | 4869 |  		if (!empty($unit_type)) { | 
                                                        
| 4870 | - $sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";  | 
                                                        |
| 4870 | + $sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";  | 
                                                        |
| 4871 | 4871 | }  | 
                                                        
| 4872 | 4872 | $sql .= " ORDER BY sortorder";  | 
                                                        
| 4873 | 4873 | |
@@ -4879,14 +4879,14 @@ discard block  | 
                                                    ||
| 4879 | 4879 | |
| 4880 | 4880 |  			while ($res = $this->db->fetch_object($resql)) { | 
                                                        
| 4881 | 4881 | $unitLabel = $res->label;  | 
                                                        
| 4882 | -				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before | 
                                                        |
| 4883 | -					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label; | 
                                                        |
| 4882 | +				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before | 
                                                        |
| 4883 | +					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label; | 
                                                        |
| 4884 | 4884 | }  | 
                                                        
| 4885 | 4885 | |
| 4886 | 4886 |  				if ($selected == $res->rowid) { | 
                                                        
| 4887 | - $return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';  | 
                                                        |
| 4887 | + $return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';  | 
                                                        |
| 4888 | 4888 |  				} else { | 
                                                        
| 4889 | - $return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';  | 
                                                        |
| 4889 | + $return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';  | 
                                                        |
| 4890 | 4890 | }  | 
                                                        
| 4891 | 4891 | }  | 
                                                        
| 4892 | 4892 | $return .= '</select>';  | 
                                                        
@@ -4921,23 +4921,23 @@ discard block  | 
                                                    ||
| 4921 | 4921 | $num = 0;  | 
                                                        
| 4922 | 4922 | |
| 4923 | 4923 | $sql = "SELECT rowid, label, bank, clos as status, currency_code";  | 
                                                        
| 4924 | - $sql .= " FROM " . $this->db->prefix() . "bank_account";  | 
                                                        |
| 4925 | -		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")"; | 
                                                        |
| 4924 | + $sql .= " FROM ".$this->db->prefix()."bank_account";  | 
                                                        |
| 4925 | +		$sql .= " WHERE entity IN (".getEntity('bank_account').")"; | 
                                                        |
| 4926 | 4926 |  		if ($status != 2) { | 
                                                        
| 4927 | - $sql .= " AND clos = " . (int) $status;  | 
                                                        |
| 4927 | + $sql .= " AND clos = ".(int) $status;  | 
                                                        |
| 4928 | 4928 | }  | 
                                                        
| 4929 | 4929 |  		if ($filtre) {	// TODO Support USF | 
                                                        
| 4930 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 4930 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 4931 | 4931 | }  | 
                                                        
| 4932 | 4932 | $sql .= " ORDER BY label";  | 
                                                        
| 4933 | 4933 | |
| 4934 | - dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);  | 
                                                        |
| 4934 | + dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);  | 
                                                        |
| 4935 | 4935 | $result = $this->db->query($sql);  | 
                                                        
| 4936 | 4936 |  		if ($result) { | 
                                                        
| 4937 | 4937 | $num = $this->db->num_rows($result);  | 
                                                        
| 4938 | 4938 | $i = 0;  | 
                                                        
| 4939 | 4939 |  			if ($num) { | 
                                                        
| 4940 | - $out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 4940 | + $out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 4941 | 4941 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 4942 | 4942 | $out .= '<option value="-1"> </option>';  | 
                                                        
| 4943 | 4943 | }  | 
                                                        
@@ -4945,27 +4945,27 @@ discard block  | 
                                                    ||
| 4945 | 4945 |  				while ($i < $num) { | 
                                                        
| 4946 | 4946 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 4947 | 4947 |  					if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) { | 
                                                        
| 4948 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" selected>';  | 
                                                        |
| 4948 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" selected>';  | 
                                                        |
| 4949 | 4949 |  					} else { | 
                                                        
| 4950 | - $out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '">';  | 
                                                        |
| 4950 | + $out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'">';  | 
                                                        |
| 4951 | 4951 | }  | 
                                                        
| 4952 | 4952 | $out .= trim($obj->label);  | 
                                                        
| 4953 | 4953 |  					if ($showcurrency) { | 
                                                        
| 4954 | -						$out .= ' (' . $obj->currency_code . ')'; | 
                                                        |
| 4954 | +						$out .= ' ('.$obj->currency_code.')'; | 
                                                        |
| 4955 | 4955 | }  | 
                                                        
| 4956 | 4956 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 4957 | -						$out .= ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 4957 | +						$out .= ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 4958 | 4958 | }  | 
                                                        
| 4959 | 4959 | $out .= '</option>';  | 
                                                        
| 4960 | 4960 | $i++;  | 
                                                        
| 4961 | 4961 | }  | 
                                                        
| 4962 | 4962 | $out .= "</select>";  | 
                                                        
| 4963 | -				$out .= ajax_combobox('select' . $htmlname); | 
                                                        |
| 4963 | +				$out .= ajax_combobox('select'.$htmlname); | 
                                                        |
| 4964 | 4964 |  			} else { | 
                                                        
| 4965 | 4965 |  				if ($status == 0) { | 
                                                        
| 4966 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoActiveBankAccountDefined") . '</span>'; | 
                                                        |
| 4966 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; | 
                                                        |
| 4967 | 4967 |  				} else { | 
                                                        
| 4968 | -					$out .= '<span class="opacitymedium">' . $langs->trans("NoBankAccountFound") . '</span>'; | 
                                                        |
| 4968 | +					$out .= '<span class="opacitymedium">'.$langs->trans("NoBankAccountFound").'</span>'; | 
                                                        |
| 4969 | 4969 | }  | 
                                                        
| 4970 | 4970 | }  | 
                                                        
| 4971 | 4971 |  		} else { | 
                                                        
@@ -5001,23 +5001,23 @@ discard block  | 
                                                    ||
| 5001 | 5001 | $num = 0;  | 
                                                        
| 5002 | 5002 | |
| 5003 | 5003 | $sql = "SELECT rowid, name, fk_country, status, entity";  | 
                                                        
| 5004 | - $sql .= " FROM " . $this->db->prefix() . "establishment";  | 
                                                        |
| 5004 | + $sql .= " FROM ".$this->db->prefix()."establishment";  | 
                                                        |
| 5005 | 5005 | $sql .= " WHERE 1=1";  | 
                                                        
| 5006 | 5006 |  		if ($status != 2) { | 
                                                        
| 5007 | - $sql .= " AND status = " . (int) $status;  | 
                                                        |
| 5007 | + $sql .= " AND status = ".(int) $status;  | 
                                                        |
| 5008 | 5008 | }  | 
                                                        
| 5009 | 5009 |  		if ($filtre) {	// TODO Support USF | 
                                                        
| 5010 | - $sql .= " AND " . $filtre;  | 
                                                        |
| 5010 | + $sql .= " AND ".$filtre;  | 
                                                        |
| 5011 | 5011 | }  | 
                                                        
| 5012 | 5012 | $sql .= " ORDER BY name";  | 
                                                        
| 5013 | 5013 | |
| 5014 | - dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);  | 
                                                        |
| 5014 | + dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);  | 
                                                        |
| 5015 | 5015 | $result = $this->db->query($sql);  | 
                                                        
| 5016 | 5016 |  		if ($result) { | 
                                                        
| 5017 | 5017 | $num = $this->db->num_rows($result);  | 
                                                        
| 5018 | 5018 | $i = 0;  | 
                                                        
| 5019 | 5019 |  			if ($num) { | 
                                                        
| 5020 | - print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';  | 
                                                        |
| 5020 | + print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';  | 
                                                        |
| 5021 | 5021 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5022 | 5022 | print '<option value="-1"> </option>';  | 
                                                        
| 5023 | 5023 | }  | 
                                                        
@@ -5025,13 +5025,13 @@ discard block  | 
                                                    ||
| 5025 | 5025 |  				while ($i < $num) { | 
                                                        
| 5026 | 5026 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 5027 | 5027 |  					if ($selected == $obj->rowid) { | 
                                                        
| 5028 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 5028 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 5029 | 5029 |  					} else { | 
                                                        
| 5030 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 5030 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 5031 | 5031 | }  | 
                                                        
| 5032 | 5032 | print trim($obj->name);  | 
                                                        
| 5033 | 5033 |  					if ($status == 2 && $obj->status == 1) { | 
                                                        
| 5034 | -						print ' (' . $langs->trans("Closed") . ')'; | 
                                                        |
| 5034 | +						print ' ('.$langs->trans("Closed").')'; | 
                                                        |
| 5035 | 5035 | }  | 
                                                        
| 5036 | 5036 | print '</option>';  | 
                                                        
| 5037 | 5037 | $i++;  | 
                                                        
@@ -5039,9 +5039,9 @@ discard block  | 
                                                    ||
| 5039 | 5039 | print "</select>";  | 
                                                        
| 5040 | 5040 |  			} else { | 
                                                        
| 5041 | 5041 |  				if ($status == 0) { | 
                                                        
| 5042 | -					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>'; | 
                                                        |
| 5042 | +					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>'; | 
                                                        |
| 5043 | 5043 |  				} else { | 
                                                        
| 5044 | -					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>'; | 
                                                        |
| 5044 | +					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>'; | 
                                                        |
| 5045 | 5045 | }  | 
                                                        
| 5046 | 5046 | }  | 
                                                        
| 5047 | 5047 | |
@@ -5065,20 +5065,20 @@ discard block  | 
                                                    ||
| 5065 | 5065 |  	{ | 
                                                        
| 5066 | 5066 | global $langs;  | 
                                                        
| 5067 | 5067 |  		if ($htmlname != "none") { | 
                                                        
| 5068 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5068 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5069 | 5069 | print '<input type="hidden" name="action" value="setbankaccount">';  | 
                                                        
| 5070 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5070 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5071 | 5071 |  			print img_picto('', 'bank_account', 'class="pictofixedwidth"'); | 
                                                        
| 5072 | 5072 | $nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);  | 
                                                        
| 5073 | 5073 |  			if ($nbaccountfound > 0) { | 
                                                        
| 5074 | -				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5074 | +				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5075 | 5075 | }  | 
                                                        
| 5076 | 5076 | print '</form>';  | 
                                                        
| 5077 | 5077 |  		} else { | 
                                                        
| 5078 | 5078 |  			$langs->load('banks'); | 
                                                        
| 5079 | 5079 | |
| 5080 | 5080 |  			if ($selected) { | 
                                                        
| 5081 | - require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';  | 
                                                        |
| 5081 | + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';  | 
                                                        |
| 5082 | 5082 | $bankstatic = new Account($this->db);  | 
                                                        
| 5083 | 5083 | $result = $bankstatic->fetch($selected);  | 
                                                        
| 5084 | 5084 |  				if ($result) { | 
                                                        
@@ -5117,19 +5117,19 @@ discard block  | 
                                                    ||
| 5117 | 5117 | global $conf, $langs;  | 
                                                        
| 5118 | 5118 |  		$langs->load("categories"); | 
                                                        
| 5119 | 5119 | |
| 5120 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 5120 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 5121 | 5121 | |
| 5122 | 5122 | // For backward compatibility  | 
                                                        
| 5123 | 5123 |  		if (is_numeric($type)) { | 
                                                        
| 5124 | - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5124 | + dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);  | 
                                                        |
| 5125 | 5125 | }  | 
                                                        
| 5126 | 5126 | |
| 5127 | 5127 |  		if ($type === Categorie::TYPE_BANK_LINE) { | 
                                                        
| 5128 | 5128 | // TODO Move this into common category feature  | 
                                                        
| 5129 | 5129 | $cate_arbo = array();  | 
                                                        
| 5130 | 5130 | $sql = "SELECT c.label, c.rowid";  | 
                                                        
| 5131 | - $sql .= " FROM " . $this->db->prefix() . "bank_categ as c";  | 
                                                        |
| 5132 | - $sql .= " WHERE entity = " . $conf->entity;  | 
                                                        |
| 5131 | + $sql .= " FROM ".$this->db->prefix()."bank_categ as c";  | 
                                                        |
| 5132 | + $sql .= " WHERE entity = ".$conf->entity;  | 
                                                        |
| 5133 | 5133 | $sql .= " ORDER BY c.label";  | 
                                                        
| 5134 | 5134 | $result = $this->db->query($sql);  | 
                                                        
| 5135 | 5135 |  			if ($result) { | 
                                                        
@@ -5155,12 +5155,12 @@ discard block  | 
                                                    ||
| 5155 | 5155 | $outarrayrichhtml = array();  | 
                                                        
| 5156 | 5156 | |
| 5157 | 5157 | |
| 5158 | - $output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 5158 | + $output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 5159 | 5159 |  		if (is_array($cate_arbo)) { | 
                                                        
| 5160 | 5160 | $num = count($cate_arbo);  | 
                                                        
| 5161 | 5161 | |
| 5162 | 5162 |  			if (!$num) { | 
                                                        
| 5163 | -				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>'; | 
                                                        |
| 5163 | +				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>'; | 
                                                        |
| 5164 | 5164 |  			} else { | 
                                                        
| 5165 | 5165 |  				if ($useempty == 1 || ($useempty == 2 && $num > 1)) { | 
                                                        
| 5166 | 5166 | $output .= '<option value="-1"> </option>';  | 
                                                        
@@ -5172,15 +5172,15 @@ discard block  | 
                                                    ||
| 5172 | 5172 | $add = '';  | 
                                                        
| 5173 | 5173 | }  | 
                                                        
| 5174 | 5174 | |
| 5175 | -					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"'); | 
                                                        |
| 5175 | +					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"'); | 
                                                        |
| 5176 | 5176 | $labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5177 | 5177 | |
| 5178 | 5178 | $outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];  | 
                                                        
| 5179 | 5179 | |
| 5180 | 5180 | $outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;  | 
                                                        
| 5181 | 5181 | |
| 5182 | - $output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';  | 
                                                        |
| 5183 | - $output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';  | 
                                                        |
| 5182 | + $output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';  | 
                                                        |
| 5183 | + $output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';  | 
                                                        |
| 5184 | 5184 | $output .= '>';  | 
                                                        
| 5185 | 5185 | $output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');  | 
                                                        
| 5186 | 5186 | $output .= '</option>';  | 
                                                        
@@ -5222,7 +5222,7 @@ discard block  | 
                                                    ||
| 5222 | 5222 | public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)  | 
                                                        
| 5223 | 5223 |  	{ | 
                                                        
| 5224 | 5224 | // phpcs:enable  | 
                                                        
| 5225 | - dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5225 | + dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);  | 
                                                        |
| 5226 | 5226 | print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);  | 
                                                        
| 5227 | 5227 | }  | 
                                                        
| 5228 | 5228 | |
@@ -5257,7 +5257,7 @@ discard block  | 
                                                    ||
| 5257 | 5257 |  	{ | 
                                                        
| 5258 | 5258 | global $langs, $conf;  | 
                                                        
| 5259 | 5259 | |
| 5260 | - $more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';  | 
                                                        |
| 5260 | + $more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';  | 
                                                        |
| 5261 | 5261 | $formconfirm = '';  | 
                                                        
| 5262 | 5262 | $inputok = array();  | 
                                                        
| 5263 | 5263 | $inputko = array();  | 
                                                        
@@ -5281,27 +5281,27 @@ discard block  | 
                                                    ||
| 5281 | 5281 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5282 | 5282 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5283 | 5283 |  					if ($input['type'] == 'hidden') { | 
                                                        
| 5284 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5285 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5284 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5285 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5286 | 5286 | |
| 5287 | - $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";  | 
                                                        |
| 5287 | + $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";  | 
                                                        |
| 5288 | 5288 | }  | 
                                                        
| 5289 | 5289 | }  | 
                                                        
| 5290 | 5290 | }  | 
                                                        
| 5291 | 5291 | |
| 5292 | 5292 | // Now add questions  | 
                                                        
| 5293 | 5293 | $moreonecolumn = '';  | 
                                                        
| 5294 | - $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";  | 
                                                        |
| 5294 | + $more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";  | 
                                                        |
| 5295 | 5295 |  			foreach ($formquestion as $key => $input) { | 
                                                        
| 5296 | 5296 |  				if (is_array($input) && !empty($input)) { | 
                                                        
| 5297 | - $size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5298 | - $moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');  | 
                                                        |
| 5299 | - $morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');  | 
                                                        |
| 5297 | + $size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.  | 
                                                        |
| 5298 | + $moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');  | 
                                                        |
| 5299 | + $morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');  | 
                                                        |
| 5300 | 5300 | |
| 5301 | 5301 |  					if ($input['type'] == 'text') { | 
                                                        
| 5302 | -						$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"; | 
                                                        |
| 5302 | +						$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"; | 
                                                        |
| 5303 | 5303 |  					} elseif ($input['type'] == 'password') { | 
                                                        
| 5304 | -						$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"; | 
                                                        |
| 5304 | +						$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"; | 
                                                        |
| 5305 | 5305 |  					} elseif ($input['type'] == 'textarea') { | 
                                                        
| 5306 | 5306 |  						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">'; | 
                                                        
| 5307 | 5307 | $more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        
@@ -5309,8 +5309,8 @@ discard block  | 
                                                    ||
| 5309 | 5309 | $more .= '</textarea>';  | 
                                                        
| 5310 | 5310 | $more .= '</div></div>'."\n";*/  | 
                                                        
| 5311 | 5311 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5312 | - $moreonecolumn .= $input['label'] . '<br>';  | 
                                                        |
| 5313 | - $moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';  | 
                                                        |
| 5312 | + $moreonecolumn .= $input['label'].'<br>';  | 
                                                        |
| 5313 | + $moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';  | 
                                                        |
| 5314 | 5314 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5315 | 5315 | $moreonecolumn .= '</textarea>';  | 
                                                        
| 5316 | 5316 | $moreonecolumn .= '</div>';  | 
                                                        
@@ -5327,20 +5327,20 @@ discard block  | 
                                                    ||
| 5327 | 5327 | $disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;  | 
                                                        
| 5328 | 5328 | $sort = isset($input['select_sort']) ? $input['select_sort'] : '';  | 
                                                        
| 5329 | 5329 | |
| 5330 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">'; | 
                                                        |
| 5330 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        |
| 5331 | 5331 |  						if (!empty($input['label'])) { | 
                                                        
| 5332 | - $more .= $input['label'] . '</div><div class="tagtd left">';  | 
                                                        |
| 5332 | + $more .= $input['label'].'</div><div class="tagtd left">';  | 
                                                        |
| 5333 | 5333 | }  | 
                                                        
| 5334 | 5334 |  						if ($input['type'] == 'select') { | 
                                                        
| 5335 | 5335 | $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);  | 
                                                        
| 5336 | 5336 |  						} else { | 
                                                        
| 5337 | 5337 | $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);  | 
                                                        
| 5338 | 5338 | }  | 
                                                        
| 5339 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5339 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5340 | 5340 |  					} elseif ($input['type'] == 'checkbox') { | 
                                                        
| 5341 | 5341 | $more .= '<div class="tagtr">';  | 
                                                        
| 5342 | -						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">'; | 
                                                        |
| 5343 | - $more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;  | 
                                                        |
| 5342 | +						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">'; | 
                                                        |
| 5343 | + $more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;  | 
                                                        |
| 5344 | 5344 |  						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') { | 
                                                        
| 5345 | 5345 | $more .= ' checked';  | 
                                                        
| 5346 | 5346 | }  | 
                                                        
@@ -5351,19 +5351,19 @@ discard block  | 
                                                    ||
| 5351 | 5351 | $more .= ' disabled';  | 
                                                        
| 5352 | 5352 | }  | 
                                                        
| 5353 | 5353 | $more .= ' /></div>';  | 
                                                        
| 5354 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5354 | + $more .= '</div>'."\n";  | 
                                                        |
| 5355 | 5355 |  					} elseif ($input['type'] == 'radio') { | 
                                                        
| 5356 | 5356 | $i = 0;  | 
                                                        
| 5357 | 5357 |  						foreach ($input['values'] as $selkey => $selval) { | 
                                                        
| 5358 | 5358 | $more .= '<div class="tagtr">';  | 
                                                        
| 5359 | 5359 |  							if (isset($input['label'])) { | 
                                                        
| 5360 | 5360 |  								if ($i == 0) { | 
                                                        
| 5361 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5361 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5362 | 5362 |  								} else { | 
                                                        
| 5363 | -									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '"> </div>'; | 
                                                        |
| 5363 | +									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'"> </div>'; | 
                                                        |
| 5364 | 5364 | }  | 
                                                        
| 5365 | 5365 | }  | 
                                                        
| 5366 | - $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;  | 
                                                        |
| 5366 | + $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;  | 
                                                        |
| 5367 | 5367 |  							if (!empty($input['disabled'])) { | 
                                                        
| 5368 | 5368 | $more .= ' disabled';  | 
                                                        
| 5369 | 5369 | }  | 
                                                        
@@ -5371,12 +5371,12 @@ discard block  | 
                                                    ||
| 5371 | 5371 | $more .= ' checked="checked"';  | 
                                                        
| 5372 | 5372 | }  | 
                                                        
| 5373 | 5373 | $more .= ' /> ';  | 
                                                        
| 5374 | - $more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';  | 
                                                        |
| 5375 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5374 | + $more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';  | 
                                                        |
| 5375 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5376 | 5376 | $i++;  | 
                                                        
| 5377 | 5377 | }  | 
                                                        
| 5378 | 5378 |  					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') { | 
                                                        
| 5379 | -						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>'; | 
                                                        |
| 5379 | +						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>'; | 
                                                        |
| 5380 | 5380 | $more .= '<div class="tagtd">';  | 
                                                        
| 5381 | 5381 | $addnowlink = (empty($input['datenow']) ? 0 : 1);  | 
                                                        
| 5382 | 5382 | $h = $m = 0;  | 
                                                        
@@ -5394,24 +5394,24 @@ discard block  | 
                                                    ||
| 5394 | 5394 |  					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not | 
                                                        
| 5395 | 5395 |  						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'; | 
                                                        
| 5396 | 5396 |  						if (!empty($input['label'])) { | 
                                                        
| 5397 | - $more .= $input['label'] . '</div><div class="tagtd">';  | 
                                                        |
| 5397 | + $more .= $input['label'].'</div><div class="tagtd">';  | 
                                                        |
| 5398 | 5398 | }  | 
                                                        
| 5399 | 5399 | $more .= $input['value'];  | 
                                                        
| 5400 | - $more .= '</div></div>' . "\n";  | 
                                                        |
| 5400 | + $more .= '</div></div>'."\n";  | 
                                                        |
| 5401 | 5401 |  					} elseif ($input['type'] == 'onecolumn') { | 
                                                        
| 5402 | 5402 | $moreonecolumn .= '<div class="margintoponly">';  | 
                                                        
| 5403 | 5403 | $moreonecolumn .= $input['value'];  | 
                                                        
| 5404 | - $moreonecolumn .= '</div>' . "\n";  | 
                                                        |
| 5404 | + $moreonecolumn .= '</div>'."\n";  | 
                                                        |
| 5405 | 5405 |  					} elseif ($input['type'] == 'hidden') { | 
                                                        
| 5406 | 5406 | // Do nothing more, already added by a previous loop  | 
                                                        
| 5407 | 5407 |  					} elseif ($input['type'] == 'separator') { | 
                                                        
| 5408 | 5408 | $more .= '<br>';  | 
                                                        
| 5409 | 5409 |  					} else { | 
                                                        
| 5410 | - $more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';  | 
                                                        |
| 5410 | + $more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';  | 
                                                        |
| 5411 | 5411 | }  | 
                                                        
| 5412 | 5412 | }  | 
                                                        
| 5413 | 5413 | }  | 
                                                        
| 5414 | - $more .= '</div>' . "\n";  | 
                                                        |
| 5414 | + $more .= '</div>'."\n";  | 
                                                        |
| 5415 | 5415 | $more .= $moreonecolumn;  | 
                                                        
| 5416 | 5416 | }  | 
                                                        
| 5417 | 5417 | |
@@ -5433,10 +5433,10 @@ discard block  | 
                                                    ||
| 5433 | 5433 | $button = $useajax;  | 
                                                        
| 5434 | 5434 | $useajax = 1;  | 
                                                        
| 5435 | 5435 | $autoOpen = false;  | 
                                                        
| 5436 | - $dialogconfirm .= '-' . $button;  | 
                                                        |
| 5436 | + $dialogconfirm .= '-'.$button;  | 
                                                        |
| 5437 | 5437 | }  | 
                                                        
| 5438 | -			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes'; | 
                                                        |
| 5439 | -			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : ''); | 
                                                        |
| 5438 | +			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes'; | 
                                                        |
| 5439 | +			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : ''); | 
                                                        |
| 5440 | 5440 | |
| 5441 | 5441 | // Add input fields into list of fields to read during submit (inputok and inputko)  | 
                                                        
| 5442 | 5442 |  			if (is_array($formquestion)) { | 
                                                        
@@ -5458,24 +5458,24 @@ discard block  | 
                                                    ||
| 5458 | 5458 | }  | 
                                                        
| 5459 | 5459 | |
| 5460 | 5460 | // Show JQuery confirm box.  | 
                                                        
| 5461 | - $formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';  | 
                                                        |
| 5461 | + $formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';  | 
                                                        |
| 5462 | 5462 |  			if (is_array($formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5463 | - $formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";  | 
                                                        |
| 5463 | + $formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";  | 
                                                        |
| 5464 | 5464 | }  | 
                                                        
| 5465 | 5465 |  			if (!empty($more)) { | 
                                                        
| 5466 | - $formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";  | 
                                                        |
| 5466 | + $formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";  | 
                                                        |
| 5467 | 5467 | }  | 
                                                        
| 5468 | - $formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');  | 
                                                        |
| 5469 | - $formconfirm .= '</div>' . "\n";  | 
                                                        |
| 5468 | + $formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');  | 
                                                        |
| 5469 | + $formconfirm .= '</div>'."\n";  | 
                                                        |
| 5470 | 5470 | |
| 5471 | - $formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";  | 
                                                        |
| 5472 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5471 | + $formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";  | 
                                                        |
| 5472 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5473 | 5473 |  			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n"; | 
                                                        
| 5474 | 5474 |  			$formconfirm .= 'jQuery(document).ready(function() { | 
                                                        
| 5475 | 5475 |              $(function() { | 
                                                        
| 5476 | - $( "#' . $dialogconfirm . '" ).dialog(  | 
                                                        |
| 5476 | + $( "#' . $dialogconfirm.'" ).dialog(  | 
                                                        |
| 5477 | 5477 |              	{ | 
                                                        
| 5478 | - autoOpen: ' . ($autoOpen ? "true" : "false") . ',';  | 
                                                        |
| 5478 | + autoOpen: ' . ($autoOpen ? "true" : "false").',';  | 
                                                        |
| 5479 | 5479 |  			if ($newselectedchoice == 'no') { | 
                                                        
| 5480 | 5480 | $formconfirm .= '  | 
                                                        
| 5481 | 5481 |  						open: function() { | 
                                                        
@@ -5485,24 +5485,24 @@ discard block  | 
                                                    ||
| 5485 | 5485 | |
| 5486 | 5486 | $jsforcursor = '';  | 
                                                        
| 5487 | 5487 |  			if ($useajax == 1) { | 
                                                        
| 5488 | - $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";  | 
                                                        |
| 5489 | -				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n"; | 
                                                        |
| 5488 | + $jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";  | 
                                                        |
| 5489 | +				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n"; | 
                                                        |
| 5490 | 5490 | }  | 
                                                        
| 5491 | 5491 | |
| 5492 | 5492 | $postconfirmas = 'GET';  | 
                                                        
| 5493 | 5493 | |
| 5494 | 5494 | $formconfirm .= '  | 
                                                        
| 5495 | 5495 | resizable: false,  | 
                                                        
| 5496 | - height: "' . $height . '",  | 
                                                        |
| 5497 | - width: "' . $width . '",  | 
                                                        |
| 5496 | + height: "' . $height.'",  | 
                                                        |
| 5497 | + width: "' . $width.'",  | 
                                                        |
| 5498 | 5498 | modal: true,  | 
                                                        
| 5499 | 5499 | closeOnEscape: false,  | 
                                                        
| 5500 | 5500 |                      buttons: { | 
                                                        
| 5501 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { | 
                                                        |
| 5502 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5503 | - var inputok = ' . json_encode($inputok) . '; /* List of fields into form */  | 
                                                        |
| 5504 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5505 | - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";  | 
                                                        |
| 5501 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() { | 
                                                        |
| 5502 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5503 | + var inputok = ' . json_encode($inputok).'; /* List of fields into form */  | 
                                                        |
| 5504 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5505 | + var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";  | 
                                                        |
| 5506 | 5506 | |
| 5507 | 5507 |                           	if (inputok.length > 0) { | 
                                                        
| 5508 | 5508 |                           		$.each(inputok, function(i, inputname) { | 
                                                        
@@ -5536,11 +5536,11 @@ discard block  | 
                                                    ||
| 5536 | 5536 | }  | 
                                                        
| 5537 | 5537 |  	                        $(this).dialog("close"); | 
                                                        
| 5538 | 5538 | },  | 
                                                        
| 5539 | -                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() { | 
                                                        |
| 5540 | - var options = "token=' . urlencode(newToken()) . '";  | 
                                                        |
| 5541 | - var inputko = ' . json_encode($inputko) . '; /* List of fields into form */  | 
                                                        |
| 5542 | - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";  | 
                                                        |
| 5543 | - var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";  | 
                                                        |
| 5539 | +                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() { | 
                                                        |
| 5540 | + var options = "token=' . urlencode(newToken()).'";  | 
                                                        |
| 5541 | + var inputko = ' . json_encode($inputko).'; /* List of fields into form */  | 
                                                        |
| 5542 | + var page = "' . dol_escape_js(!empty($page) ? $page : '').'";  | 
                                                        |
| 5543 | + var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";  | 
                                                        |
| 5544 | 5544 |                           	if (inputko.length > 0) { | 
                                                        
| 5545 | 5545 |                           		$.each(inputko, function(i, inputname) { | 
                                                        
| 5546 | 5546 | var more = "";  | 
                                                        
@@ -5572,10 +5572,10 @@ discard block  | 
                                                    ||
| 5572 | 5572 | }  | 
                                                        
| 5573 | 5573 | );  | 
                                                        
| 5574 | 5574 | |
| 5575 | - var button = "' . $button . '";  | 
                                                        |
| 5575 | + var button = "' . $button.'";  | 
                                                        |
| 5576 | 5576 |              	if (button.length > 0) { | 
                                                        
| 5577 | 5577 |                  	$( "#" + button ).click(function() { | 
                                                        
| 5578 | -                		$("#' . $dialogconfirm . '").dialog("open"); | 
                                                        |
| 5578 | +                		$("#' . $dialogconfirm.'").dialog("open"); | 
                                                        |
| 5579 | 5579 | });  | 
                                                        
| 5580 | 5580 | }  | 
                                                        
| 5581 | 5581 | });  | 
                                                        
@@ -5583,44 +5583,44 @@ discard block  | 
                                                    ||
| 5583 | 5583 | </script>';  | 
                                                        
| 5584 | 5584 | $formconfirm .= "<!-- end ajax formconfirm -->\n";  | 
                                                        
| 5585 | 5585 |  		} else { | 
                                                        
| 5586 | - $formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";  | 
                                                        |
| 5586 | + $formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";  | 
                                                        |
| 5587 | 5587 | |
| 5588 | 5588 |  			if (empty($disableformtag)) { | 
                                                        
| 5589 | - $formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftroright">' . "\n";  | 
                                                        |
| 5589 | + $formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";  | 
                                                        |
| 5590 | 5590 | }  | 
                                                        
| 5591 | 5591 | |
| 5592 | - $formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";  | 
                                                        |
| 5593 | - $formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";  | 
                                                        |
| 5592 | + $formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";  | 
                                                        |
| 5593 | + $formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";  | 
                                                        |
| 5594 | 5594 | |
| 5595 | - $formconfirm .= '<table class="valid centpercent">' . "\n";  | 
                                                        |
| 5595 | + $formconfirm .= '<table class="valid centpercent">'."\n";  | 
                                                        |
| 5596 | 5596 | |
| 5597 | 5597 | // Line title  | 
                                                        
| 5598 | 5598 | $formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';  | 
                                                        
| 5599 | -			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title; | 
                                                        |
| 5600 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5599 | +			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title; | 
                                                        |
| 5600 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5601 | 5601 | |
| 5602 | 5602 | // Line text  | 
                                                        
| 5603 | 5603 |  			if (is_array($formquestion) && !empty($formquestion['text'])) { | 
                                                        
| 5604 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";  | 
                                                        |
| 5604 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";  | 
                                                        |
| 5605 | 5605 | }  | 
                                                        
| 5606 | 5606 | |
| 5607 | 5607 | // Line form fields  | 
                                                        
| 5608 | 5608 |  			if ($more) { | 
                                                        
| 5609 | - $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";  | 
                                                        |
| 5609 | + $formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";  | 
                                                        |
| 5610 | 5610 | $formconfirm .= $more;  | 
                                                        
| 5611 | - $formconfirm .= '</td></tr>' . "\n";  | 
                                                        |
| 5611 | + $formconfirm .= '</td></tr>'."\n";  | 
                                                        |
| 5612 | 5612 | }  | 
                                                        
| 5613 | 5613 | |
| 5614 | 5614 | // Line with question  | 
                                                        
| 5615 | 5615 | $formconfirm .= '<tr class="valid">';  | 
                                                        
| 5616 | - $formconfirm .= '<td class="valid">' . $question . '</td>';  | 
                                                        |
| 5616 | + $formconfirm .= '<td class="valid">'.$question.'</td>';  | 
                                                        |
| 5617 | 5617 | $formconfirm .= '<td class="valid center">';  | 
                                                        
| 5618 | 5618 |  			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno); | 
                                                        
| 5619 | -			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">'; | 
                                                        |
| 5619 | +			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">'; | 
                                                        |
| 5620 | 5620 | $formconfirm .= '</td>';  | 
                                                        
| 5621 | - $formconfirm .= '</tr>' . "\n";  | 
                                                        |
| 5621 | + $formconfirm .= '</tr>'."\n";  | 
                                                        |
| 5622 | 5622 | |
| 5623 | - $formconfirm .= '</table>' . "\n";  | 
                                                        |
| 5623 | + $formconfirm .= '</table>'."\n";  | 
                                                        |
| 5624 | 5624 | |
| 5625 | 5625 |  			if (empty($disableformtag)) { | 
                                                        
| 5626 | 5626 | $formconfirm .= "</form>\n";  | 
                                                        
@@ -5629,7 +5629,7 @@ discard block  | 
                                                    ||
| 5629 | 5629 | |
| 5630 | 5630 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 5631 | 5631 | $formconfirm .= '<!-- code to disable button to avoid double clic -->';  | 
                                                        
| 5632 | - $formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";  | 
                                                        |
| 5632 | + $formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";  | 
                                                        |
| 5633 | 5633 | $formconfirm .= '  | 
                                                        
| 5634 | 5634 |  				$(document).ready(function () { | 
                                                        
| 5635 | 5635 |  					$(".confirmvalidatebutton").on("click", function() { | 
                                                        
@@ -5641,7 +5641,7 @@ discard block  | 
                                                    ||
| 5641 | 5641 | });  | 
                                                        
| 5642 | 5642 | });  | 
                                                        
| 5643 | 5643 | ';  | 
                                                        
| 5644 | - $formconfirm .= '</script>' . "\n";  | 
                                                        |
| 5644 | + $formconfirm .= '</script>'."\n";  | 
                                                        |
| 5645 | 5645 | }  | 
                                                        
| 5646 | 5646 | |
| 5647 | 5647 | $formconfirm .= "<!-- end formconfirm -->\n";  | 
                                                        
@@ -5673,8 +5673,8 @@ discard block  | 
                                                    ||
| 5673 | 5673 | // phpcs:enable  | 
                                                        
| 5674 | 5674 | global $langs;  | 
                                                        
| 5675 | 5675 | |
| 5676 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 5677 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';  | 
                                                        |
| 5676 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 5677 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';  | 
                                                        |
| 5678 | 5678 | |
| 5679 | 5679 | $out = '';  | 
                                                        
| 5680 | 5680 | |
@@ -5682,11 +5682,11 @@ discard block  | 
                                                    ||
| 5682 | 5682 | |
| 5683 | 5683 |  		$langs->load("project"); | 
                                                        
| 5684 | 5684 |  		if ($htmlname != "none") { | 
                                                        
| 5685 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5685 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5686 | 5686 | $out .= '<input type="hidden" name="action" value="classin">';  | 
                                                        
| 5687 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5687 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5688 | 5688 | $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);  | 
                                                        
| 5689 | -			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5689 | +			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5690 | 5690 | $out .= '</form>';  | 
                                                        
| 5691 | 5691 |  		} else { | 
                                                        
| 5692 | 5692 | $out .= '<span class="project_head_block">';  | 
                                                        
@@ -5695,7 +5695,7 @@ discard block  | 
                                                    ||
| 5695 | 5695 | $projet->fetch($selected);  | 
                                                        
| 5696 | 5696 | $out .= $projet->getNomUrl(0, '', 1);  | 
                                                        
| 5697 | 5697 |  			} else { | 
                                                        
| 5698 | - $out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';  | 
                                                        |
| 5698 | + $out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';  | 
                                                        |
| 5699 | 5699 | }  | 
                                                        
| 5700 | 5700 | $out .= '</span>';  | 
                                                        
| 5701 | 5701 | }  | 
                                                        
@@ -5732,14 +5732,14 @@ discard block  | 
                                                    ||
| 5732 | 5732 | $out = '';  | 
                                                        
| 5733 | 5733 | |
| 5734 | 5734 |  		if ($htmlname != "none") { | 
                                                        
| 5735 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5735 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5736 | 5736 | $out .= '<input type="hidden" name="action" value="setconditions">';  | 
                                                        
| 5737 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5737 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5738 | 5738 |  			if ($type) { | 
                                                        
| 5739 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5739 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5740 | 5740 | }  | 
                                                        
| 5741 | 5741 | $out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);  | 
                                                        
| 5742 | -			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5742 | +			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5743 | 5743 | $out .= '</form>';  | 
                                                        
| 5744 | 5744 |  		} else { | 
                                                        
| 5745 | 5745 |  			if ($selected) { | 
                                                        
@@ -5784,12 +5784,12 @@ discard block  | 
                                                    ||
| 5784 | 5784 | // phpcs:enable  | 
                                                        
| 5785 | 5785 | global $langs;  | 
                                                        
| 5786 | 5786 |  		if ($htmlname != "none") { | 
                                                        
| 5787 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5787 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5788 | 5788 | print '<input type="hidden" name="action" value="setavailability">';  | 
                                                        
| 5789 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5789 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5790 | 5790 | $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5791 | -			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5792 | -			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">'; | 
                                                        |
| 5791 | +			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5792 | +			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">'; | 
                                                        |
| 5793 | 5793 | print '</form>';  | 
                                                        
| 5794 | 5794 |  		} else { | 
                                                        
| 5795 | 5795 |  			if ($selected) { | 
                                                        
@@ -5815,11 +5815,11 @@ discard block  | 
                                                    ||
| 5815 | 5815 |  	{ | 
                                                        
| 5816 | 5816 | global $langs;  | 
                                                        
| 5817 | 5817 |  		if ($htmlname != "none") { | 
                                                        
| 5818 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 5818 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 5819 | 5819 | print '<input type="hidden" name="action" value="setdemandreason">';  | 
                                                        
| 5820 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5820 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5821 | 5821 | $this->selectInputReason($selected, $htmlname, -1, $addempty);  | 
                                                        
| 5822 | -			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5822 | +			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5823 | 5823 | print '</form>';  | 
                                                        
| 5824 | 5824 |  		} else { | 
                                                        
| 5825 | 5825 |  			if ($selected) { | 
                                                        
@@ -5859,17 +5859,17 @@ discard block  | 
                                                    ||
| 5859 | 5859 | $ret = '';  | 
                                                        
| 5860 | 5860 | |
| 5861 | 5861 |  		if ($htmlname != "none") { | 
                                                        
| 5862 | - $ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 5863 | - $ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 5864 | - $ret .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5862 | + $ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 5863 | + $ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 5864 | + $ret .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5865 | 5865 |  			if ($type) { | 
                                                        
| 5866 | - $ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5866 | + $ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5867 | 5867 | }  | 
                                                        
| 5868 | 5868 | $ret .= '<table class="nobordernopadding">';  | 
                                                        
| 5869 | 5869 | $ret .= '<tr><td>';  | 
                                                        
| 5870 | - $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);  | 
                                                        |
| 5870 | + $ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);  | 
                                                        |
| 5871 | 5871 | $ret .= '</td>';  | 
                                                        
| 5872 | -			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 5872 | +			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 5873 | 5873 | $ret .= '</tr></table></form>';  | 
                                                        
| 5874 | 5874 |  		} else { | 
                                                        
| 5875 | 5875 |  			if ($displayhour) { | 
                                                        
@@ -5904,15 +5904,15 @@ discard block  | 
                                                    ||
| 5904 | 5904 | global $langs;  | 
                                                        
| 5905 | 5905 | |
| 5906 | 5906 |  		if ($htmlname != "none") { | 
                                                        
| 5907 | - print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';  | 
                                                        |
| 5908 | - print '<input type="hidden" name="action" value="set' . $htmlname . '">';  | 
                                                        |
| 5909 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5907 | + print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';  | 
                                                        |
| 5908 | + print '<input type="hidden" name="action" value="set'.$htmlname.'">';  | 
                                                        |
| 5909 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5910 | 5910 | print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);  | 
                                                        
| 5911 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5911 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5912 | 5912 | print '</form>';  | 
                                                        
| 5913 | 5913 |  		} else { | 
                                                        
| 5914 | 5914 |  			if ($selected) { | 
                                                        
| 5915 | - require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';  | 
                                                        |
| 5915 | + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';  | 
                                                        |
| 5916 | 5916 | $theuser = new User($this->db);  | 
                                                        
| 5917 | 5917 | $theuser->fetch($selected);  | 
                                                        
| 5918 | 5918 | print $theuser->getNomUrl(1);  | 
                                                        
@@ -5945,14 +5945,14 @@ discard block  | 
                                                    ||
| 5945 | 5945 | |
| 5946 | 5946 | $out = '';  | 
                                                        
| 5947 | 5947 |  		if ($htmlname != "none") { | 
                                                        
| 5948 | - $out .= '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5948 | + $out .= '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5949 | 5949 | $out .= '<input type="hidden" name="action" value="setmode">';  | 
                                                        
| 5950 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5950 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5951 | 5951 |  			if ($type) { | 
                                                        
| 5952 | - $out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';  | 
                                                        |
| 5952 | + $out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';  | 
                                                        |
| 5953 | 5953 | }  | 
                                                        
| 5954 | 5954 | $out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);  | 
                                                        
| 5955 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5955 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5956 | 5956 | $out .= '</form>';  | 
                                                        
| 5957 | 5957 |  		} else { | 
                                                        
| 5958 | 5958 |  			if ($selected) { | 
                                                        
@@ -5985,11 +5985,11 @@ discard block  | 
                                                    ||
| 5985 | 5985 |  	{ | 
                                                        
| 5986 | 5986 | global $langs;  | 
                                                        
| 5987 | 5987 |  		if ($htmlname != "none") { | 
                                                        
| 5988 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 5988 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 5989 | 5989 | print '<input type="hidden" name="action" value="settransportmode">';  | 
                                                        
| 5990 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 5990 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 5991 | 5991 | $this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);  | 
                                                        
| 5992 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 5992 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 5993 | 5993 | print '</form>';  | 
                                                        
| 5994 | 5994 |  		} else { | 
                                                        
| 5995 | 5995 |  			if ($selected) { | 
                                                        
@@ -6016,14 +6016,14 @@ discard block  | 
                                                    ||
| 6016 | 6016 | // phpcs:enable  | 
                                                        
| 6017 | 6017 | global $langs;  | 
                                                        
| 6018 | 6018 |  		if ($htmlname != "none") { | 
                                                        
| 6019 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6019 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6020 | 6020 | print '<input type="hidden" name="action" value="setmulticurrencycode">';  | 
                                                        
| 6021 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6021 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6022 | 6022 | print $this->selectMultiCurrency($selected, $htmlname, 0);  | 
                                                        
| 6023 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6023 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6024 | 6024 | print '</form>';  | 
                                                        
| 6025 | 6025 |  		} else { | 
                                                        
| 6026 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6026 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6027 | 6027 | print !empty($selected) ? currency_name($selected, 1) : ' ';  | 
                                                        
| 6028 | 6028 | }  | 
                                                        
| 6029 | 6029 | }  | 
                                                        
@@ -6045,21 +6045,21 @@ discard block  | 
                                                    ||
| 6045 | 6045 | global $langs, $mysoc, $conf;  | 
                                                        
| 6046 | 6046 | |
| 6047 | 6047 |  		if ($htmlname != "none") { | 
                                                        
| 6048 | - print '<form method="POST" action="' . $page . '">';  | 
                                                        |
| 6048 | + print '<form method="POST" action="'.$page.'">';  | 
                                                        |
| 6049 | 6049 | print '<input type="hidden" name="action" value="setmulticurrencyrate">';  | 
                                                        
| 6050 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6051 | - print '<input type="text" class="maxwidth100" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';  | 
                                                        |
| 6050 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6051 | + print '<input type="text" class="maxwidth100" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';  | 
                                                        |
| 6052 | 6052 | print '<select name="calculation_mode">';  | 
                                                        
| 6053 | -			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>'; | 
                                                        |
| 6054 | -			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>'; | 
                                                        |
| 6053 | +			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>'; | 
                                                        |
| 6054 | +			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>'; | 
                                                        |
| 6055 | 6055 | print '</select> ';  | 
                                                        
| 6056 | -			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6056 | +			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6057 | 6057 | print '</form>';  | 
                                                        
| 6058 | 6058 |  		} else { | 
                                                        
| 6059 | 6059 |  			if (!empty($rate)) { | 
                                                        
| 6060 | 6060 | print price($rate, 1, $langs, 0, 0);  | 
                                                        
| 6061 | 6061 |  				if ($currency && $rate != 1) { | 
                                                        
| 6062 | -					print '   (' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')'; | 
                                                        |
| 6062 | +					print '   ('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')'; | 
                                                        |
| 6063 | 6063 | }  | 
                                                        
| 6064 | 6064 |  			} else { | 
                                                        
| 6065 | 6065 | print 1;  | 
                                                        
@@ -6090,9 +6090,9 @@ discard block  | 
                                                    ||
| 6090 | 6090 | // phpcs:enable  | 
                                                        
| 6091 | 6091 | global $conf, $langs;  | 
                                                        
| 6092 | 6092 |  		if ($htmlname != "none") { | 
                                                        
| 6093 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6093 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6094 | 6094 | print '<input type="hidden" name="action" value="setabsolutediscount">';  | 
                                                        
| 6095 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6095 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6096 | 6096 | print '<div class="inline-block">';  | 
                                                        
| 6097 | 6097 |  			if (!empty($discount_type)) { | 
                                                        
| 6098 | 6098 |  				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) { | 
                                                        
@@ -6130,24 +6130,24 @@ discard block  | 
                                                    ||
| 6130 | 6130 | print '</div>';  | 
                                                        
| 6131 | 6131 |  			if (empty($hidelist)) { | 
                                                        
| 6132 | 6132 | print '<div class="inline-block" style="padding-right: 10px">';  | 
                                                        
| 6133 | - $newfilter = 'discount_type=' . intval($discount_type);  | 
                                                        |
| 6133 | + $newfilter = 'discount_type='.intval($discount_type);  | 
                                                        |
| 6134 | 6134 |  				if (!empty($discount_type)) { | 
                                                        
| 6135 | 6135 | $newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available  | 
                                                        
| 6136 | 6136 |  				} else { | 
                                                        
| 6137 | 6137 | $newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available  | 
                                                        
| 6138 | 6138 | }  | 
                                                        
| 6139 | 6139 |  				if ($filter) { | 
                                                        
| 6140 | -					$newfilter .= ' AND (' . $filter . ')'; | 
                                                        |
| 6140 | +					$newfilter .= ' AND ('.$filter.')'; | 
                                                        |
| 6141 | 6141 | }  | 
                                                        
| 6142 | 6142 | // output the combo of discounts  | 
                                                        
| 6143 | 6143 | $nbqualifiedlines = $this->select_remises($selected, $htmlname, $newfilter, $socid, $maxvalue);  | 
                                                        
| 6144 | 6144 |  				if ($nbqualifiedlines > 0) { | 
                                                        
| 6145 | -					print '   <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"'; | 
                                                        |
| 6145 | +					print '   <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"'; | 
                                                        |
| 6146 | 6146 |  					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") { | 
                                                        
| 6147 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6147 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6148 | 6148 | }  | 
                                                        
| 6149 | 6149 |  					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") { | 
                                                        
| 6150 | -						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"'; | 
                                                        |
| 6150 | +						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"'; | 
                                                        |
| 6151 | 6151 | }  | 
                                                        
| 6152 | 6152 | |
| 6153 | 6153 | print '>';  | 
                                                        
@@ -6187,23 +6187,23 @@ discard block  | 
                                                    ||
| 6187 | 6187 | global $langs, $conf;  | 
                                                        
| 6188 | 6188 | |
| 6189 | 6189 |  		if ($htmlname != "none") { | 
                                                        
| 6190 | - print '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6190 | + print '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6191 | 6191 | print '<input type="hidden" name="action" value="set_contact">';  | 
                                                        
| 6192 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6192 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6193 | 6193 | print '<table class="nobordernopadding">';  | 
                                                        
| 6194 | 6194 | print '<tr><td>';  | 
                                                        
| 6195 | 6195 | print $this->selectcontacts($societe->id, $selected, $htmlname);  | 
                                                        
| 6196 | 6196 | $num = $this->num;  | 
                                                        
| 6197 | 6197 |  			if ($num == 0) { | 
                                                        
| 6198 | 6198 |  				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); | 
                                                        
| 6199 | - print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&action=create&backtoreferer=1">' . $addcontact . '</a>';  | 
                                                        |
| 6199 | + print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&action=create&backtoreferer=1">'.$addcontact.'</a>';  | 
                                                        |
| 6200 | 6200 | }  | 
                                                        
| 6201 | 6201 | print '</td>';  | 
                                                        
| 6202 | -			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>'; | 
                                                        |
| 6202 | +			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>'; | 
                                                        |
| 6203 | 6203 | print '</tr></table></form>';  | 
                                                        
| 6204 | 6204 |  		} else { | 
                                                        
| 6205 | 6205 |  			if ($selected) { | 
                                                        
| 6206 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';  | 
                                                        |
| 6206 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';  | 
                                                        |
| 6207 | 6207 | $contact = new Contact($this->db);  | 
                                                        
| 6208 | 6208 | $contact->fetch($selected);  | 
                                                        
| 6209 | 6209 | print $contact->getFullName($langs);  | 
                                                        
@@ -6238,20 +6238,20 @@ discard block  | 
                                                    ||
| 6238 | 6238 | |
| 6239 | 6239 | $out = '';  | 
                                                        
| 6240 | 6240 |  		if ($htmlname != "none") { | 
                                                        
| 6241 | - $out .= '<form method="post" action="' . $page . '">';  | 
                                                        |
| 6241 | + $out .= '<form method="post" action="'.$page.'">';  | 
                                                        |
| 6242 | 6242 | $out .= '<input type="hidden" name="action" value="set_thirdparty">';  | 
                                                        
| 6243 | - $out .= '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 6243 | + $out .= '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 6244 | 6244 | $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);  | 
                                                        
| 6245 | -			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">'; | 
                                                        |
| 6245 | +			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; | 
                                                        |
| 6246 | 6246 | $out .= '</form>';  | 
                                                        
| 6247 | 6247 |  		} else { | 
                                                        
| 6248 | 6248 |  			if ($selected) { | 
                                                        
| 6249 | - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';  | 
                                                        |
| 6249 | + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';  | 
                                                        |
| 6250 | 6250 | $soc = new Societe($this->db);  | 
                                                        
| 6251 | 6251 | $soc->fetch($selected);  | 
                                                        
| 6252 | 6252 | $out .= $soc->getNomUrl(0, '');  | 
                                                        
| 6253 | 6253 |  			} else { | 
                                                        
| 6254 | - $out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';  | 
                                                        |
| 6254 | + $out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';  | 
                                                        |
| 6255 | 6255 | }  | 
                                                        
| 6256 | 6256 | }  | 
                                                        
| 6257 | 6257 | |
@@ -6301,22 +6301,22 @@ discard block  | 
                                                    ||
| 6301 | 6301 | $selected = 'EUR'; // Pour compatibilite  | 
                                                        
| 6302 | 6302 | }  | 
                                                        
| 6303 | 6303 | |
| 6304 | - $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6304 | + $out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6305 | 6305 |  		if ($useempty) { | 
                                                        
| 6306 | 6306 | $out .= '<option value="-1" selected></option>';  | 
                                                        
| 6307 | 6307 | }  | 
                                                        
| 6308 | 6308 |  		foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6309 | 6309 | $labeltoshow = $currency['label'];  | 
                                                        
| 6310 | 6310 |  			if ($mode == 1) { | 
                                                        
| 6311 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>'; | 
                                                        |
| 6311 | +				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>'; | 
                                                        |
| 6312 | 6312 |  			} else { | 
                                                        
| 6313 | -				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>'; | 
                                                        |
| 6313 | +				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>'; | 
                                                        |
| 6314 | 6314 | }  | 
                                                        
| 6315 | 6315 | |
| 6316 | 6316 |  			if ($selected && $selected == $code_iso) { | 
                                                        
| 6317 | - $out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6317 | + $out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6318 | 6318 |  			} else { | 
                                                        
| 6319 | - $out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';  | 
                                                        |
| 6319 | + $out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';  | 
                                                        |
| 6320 | 6320 | }  | 
                                                        
| 6321 | 6321 | $out .= $labeltoshow;  | 
                                                        
| 6322 | 6322 | $out .= '</option>';  | 
                                                        
@@ -6327,7 +6327,7 @@ discard block  | 
                                                    ||
| 6327 | 6327 | }  | 
                                                        
| 6328 | 6328 | |
| 6329 | 6329 | // Make select dynamic  | 
                                                        
| 6330 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6330 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6331 | 6331 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6332 | 6332 | |
| 6333 | 6333 | return $out;  | 
                                                        
@@ -6353,10 +6353,10 @@ discard block  | 
                                                    ||
| 6353 | 6353 | |
| 6354 | 6354 | $TCurrency = array();  | 
                                                        
| 6355 | 6355 | |
| 6356 | - $sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";  | 
                                                        |
| 6357 | -		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')"; | 
                                                        |
| 6356 | + $sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";  | 
                                                        |
| 6357 | +		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')"; | 
                                                        |
| 6358 | 6358 |  		if ($filter) { | 
                                                        
| 6359 | - $sql .= " AND " . $filter;  | 
                                                        |
| 6359 | + $sql .= " AND ".$filter;  | 
                                                        |
| 6360 | 6360 | }  | 
                                                        
| 6361 | 6361 | $resql = $this->db->query($sql);  | 
                                                        
| 6362 | 6362 |  		if ($resql) { | 
                                                        
@@ -6366,7 +6366,7 @@ discard block  | 
                                                    ||
| 6366 | 6366 | }  | 
                                                        
| 6367 | 6367 | |
| 6368 | 6368 | $out = '';  | 
                                                        
| 6369 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 6369 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 6370 | 6370 |  		if ($useempty) { | 
                                                        
| 6371 | 6371 | $out .= '<option value=""> </option>';  | 
                                                        
| 6372 | 6372 | }  | 
                                                        
@@ -6378,13 +6378,13 @@ discard block  | 
                                                    ||
| 6378 | 6378 |  			foreach ($langs->cache_currencies as $code_iso => $currency) { | 
                                                        
| 6379 | 6379 |  				if (isset($TCurrency[$code_iso])) { | 
                                                        
| 6380 | 6380 |  					if (!empty($selected) && $selected == $code_iso) { | 
                                                        
| 6381 | - $out .= '<option value="' . $code_iso . '" selected="selected">';  | 
                                                        |
| 6381 | + $out .= '<option value="'.$code_iso.'" selected="selected">';  | 
                                                        |
| 6382 | 6382 |  					} else { | 
                                                        
| 6383 | - $out .= '<option value="' . $code_iso . '">';  | 
                                                        |
| 6383 | + $out .= '<option value="'.$code_iso.'">';  | 
                                                        |
| 6384 | 6384 | }  | 
                                                        
| 6385 | 6385 | |
| 6386 | 6386 | $out .= $currency['label'];  | 
                                                        
| 6387 | -					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')'; | 
                                                        |
| 6387 | +					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')'; | 
                                                        |
| 6388 | 6388 | $out .= '</option>';  | 
                                                        
| 6389 | 6389 | }  | 
                                                        
| 6390 | 6390 | }  | 
                                                        
@@ -6393,7 +6393,7 @@ discard block  | 
                                                    ||
| 6393 | 6393 | $out .= '</select>';  | 
                                                        
| 6394 | 6394 | |
| 6395 | 6395 | // Make select dynamic  | 
                                                        
| 6396 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 6396 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 6397 | 6397 | $out .= ajax_combobox($htmlname);  | 
                                                        
| 6398 | 6398 | |
| 6399 | 6399 | return $out;  | 
                                                        
@@ -6424,7 +6424,7 @@ discard block  | 
                                                    ||
| 6424 | 6424 | $sql .= " WHERE t.fk_pays = c.rowid";  | 
                                                        
| 6425 | 6425 | $sql .= " AND t.active > 0";  | 
                                                        
| 6426 | 6426 |  		$sql .= " AND t.entity IN (".getEntity('c_tva').")"; | 
                                                        
| 6427 | -		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")"; | 
                                                        |
| 6427 | +		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")"; | 
                                                        |
| 6428 | 6428 | $sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";  | 
                                                        
| 6429 | 6429 | |
| 6430 | 6430 | $resql = $this->db->query($sql);  | 
                                                        
@@ -6436,30 +6436,30 @@ discard block  | 
                                                    ||
| 6436 | 6436 | |
| 6437 | 6437 | $tmparray = array();  | 
                                                        
| 6438 | 6438 | $tmparray['rowid'] = $obj->rowid;  | 
                                                        
| 6439 | - $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6440 | - $tmparray['code'] = $obj->code;  | 
                                                        |
| 6439 | + $tmparray['type_vat'] = $obj->type_vat;  | 
                                                        |
| 6440 | + $tmparray['code'] = $obj->code;  | 
                                                        |
| 6441 | 6441 | $tmparray['txtva'] = $obj->taux;  | 
                                                        
| 6442 | - $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6442 | + $tmparray['nprtva'] = $obj->recuperableonly;  | 
                                                        |
| 6443 | 6443 | $tmparray['localtax1'] = $obj->localtax1;  | 
                                                        
| 6444 | 6444 | $tmparray['localtax1_type'] = $obj->localtax1_type;  | 
                                                        
| 6445 | 6445 | $tmparray['localtax2'] = $obj->localtax2;  | 
                                                        
| 6446 | 6446 | $tmparray['localtax2_type'] = $obj->localtax1_type;  | 
                                                        
| 6447 | -					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6448 | -					$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 | 
                                                        |
| 6447 | +					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or * | 
                                                        |
| 6448 | +					$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 | 
                                                        |
| 6449 | 6449 | $positiverates = '';  | 
                                                        
| 6450 | 6450 |  					if ($obj->taux) { | 
                                                        
| 6451 | - $positiverates .= ($positiverates ? '/' : '') . $obj->taux;  | 
                                                        |
| 6451 | + $positiverates .= ($positiverates ? '/' : '').$obj->taux;  | 
                                                        |
| 6452 | 6452 | }  | 
                                                        
| 6453 | 6453 |  					if ($obj->localtax1) { | 
                                                        
| 6454 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;  | 
                                                        |
| 6454 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax1;  | 
                                                        |
| 6455 | 6455 | }  | 
                                                        
| 6456 | 6456 |  					if ($obj->localtax2) { | 
                                                        
| 6457 | - $positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;  | 
                                                        |
| 6457 | + $positiverates .= ($positiverates ? '/' : '').$obj->localtax2;  | 
                                                        |
| 6458 | 6458 | }  | 
                                                        
| 6459 | 6459 |  					if (empty($positiverates)) { | 
                                                        
| 6460 | 6460 | $positiverates = '0';  | 
                                                        
| 6461 | 6461 | }  | 
                                                        
| 6462 | -					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label | 
                                                        |
| 6462 | +					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label | 
                                                        |
| 6463 | 6463 | |
| 6464 | 6464 | $this->cache_vatrates[$obj->rowid] = $tmparray;  | 
                                                        
| 6465 | 6465 | }  | 
                                                        
@@ -6479,7 +6479,7 @@ discard block  | 
                                                    ||
| 6479 | 6479 | return -1;  | 
                                                        
| 6480 | 6480 | }  | 
                                                        
| 6481 | 6481 |  		} else { | 
                                                        
| 6482 | - $this->error = '<span class="error">' . $this->db->error() . '</span>';  | 
                                                        |
| 6482 | + $this->error = '<span class="error">'.$this->db->error().'</span>';  | 
                                                        |
| 6483 | 6483 | return -2;  | 
                                                        
| 6484 | 6484 | }  | 
                                                        
| 6485 | 6485 | }  | 
                                                        
@@ -6532,9 +6532,9 @@ discard block  | 
                                                    ||
| 6532 | 6532 | // Check parameters  | 
                                                        
| 6533 | 6533 |  		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) { | 
                                                        
| 6534 | 6534 |  			if ($societe_vendeuse->id == $mysoc->id) { | 
                                                        
| 6535 | -				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6535 | +				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>'; | 
                                                        |
| 6536 | 6536 |  			} else { | 
                                                        
| 6537 | -				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>'; | 
                                                        |
| 6537 | +				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>'; | 
                                                        |
| 6538 | 6538 | }  | 
                                                        
| 6539 | 6539 | return $return;  | 
                                                        
| 6540 | 6540 | }  | 
                                                        
@@ -6546,12 +6546,12 @@ discard block  | 
                                                    ||
| 6546 | 6546 | // Define list of countries to use to search VAT rates to show  | 
                                                        
| 6547 | 6547 | // First we defined code_country to use to find list  | 
                                                        
| 6548 | 6548 |  		if (is_object($societe_vendeuse)) { | 
                                                        
| 6549 | - $code_country = "'" . $societe_vendeuse->country_code . "'";  | 
                                                        |
| 6549 | + $code_country = "'".$societe_vendeuse->country_code."'";  | 
                                                        |
| 6550 | 6550 |  		} else { | 
                                                        
| 6551 | - $code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente  | 
                                                        |
| 6551 | + $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente  | 
                                                        |
| 6552 | 6552 | }  | 
                                                        
| 6553 | 6553 |  		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on | 
                                                        
| 6554 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';  | 
                                                        |
| 6554 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';  | 
                                                        |
| 6555 | 6555 | // If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries  | 
                                                        
| 6556 | 6556 | // If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country  | 
                                                        
| 6557 | 6557 |  			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC'); | 
                                                        
@@ -6561,27 +6561,27 @@ discard block  | 
                                                    ||
| 6561 | 6561 |  					if ($type == 1) { // We know product is a service | 
                                                        
| 6562 | 6562 |  						switch ($selectVatComboMode) { | 
                                                        
| 6563 | 6563 | case '1':  | 
                                                        
| 6564 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6564 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6565 | 6565 | break;  | 
                                                        
| 6566 | 6566 | case '2':  | 
                                                        
| 6567 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6567 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6568 | 6568 | break;  | 
                                                        
| 6569 | 6569 | }  | 
                                                        
| 6570 | 6570 | }  | 
                                                        
| 6571 | 6571 |  				} elseif (!$idprod) {  // We don't know type of product | 
                                                        
| 6572 | 6572 |  					switch ($selectVatComboMode) { | 
                                                        
| 6573 | 6573 | case '1':  | 
                                                        
| 6574 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6574 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6575 | 6575 | break;  | 
                                                        
| 6576 | 6576 | case '2':  | 
                                                        
| 6577 | - $code_country = "'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6577 | + $code_country = "'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6578 | 6578 | break;  | 
                                                        
| 6579 | 6579 | }  | 
                                                        
| 6580 | 6580 |  				} else { | 
                                                        
| 6581 | 6581 | $prodstatic = new Product($this->db);  | 
                                                        
| 6582 | 6582 | $prodstatic->fetch($idprod);  | 
                                                        
| 6583 | 6583 |  					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service | 
                                                        
| 6584 | - $code_country .= ",'" . $societe_acheteuse->country_code . "'";  | 
                                                        |
| 6584 | + $code_country .= ",'".$societe_acheteuse->country_code."'";  | 
                                                        |
| 6585 | 6585 | }  | 
                                                        
| 6586 | 6586 | }  | 
                                                        
| 6587 | 6587 | }  | 
                                                        
@@ -6643,13 +6643,13 @@ discard block  | 
                                                    ||
| 6643 | 6643 | // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead  | 
                                                        
| 6644 | 6644 | // of using supplier invoices (this is a very bad idea !)  | 
                                                        
| 6645 | 6645 |  				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) { | 
                                                        
| 6646 | -					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"'; | 
                                                        |
| 6646 | +					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"'; | 
                                                        |
| 6647 | 6647 | $disabled = true;  | 
                                                        
| 6648 | 6648 | }  | 
                                                        
| 6649 | 6649 | }  | 
                                                        
| 6650 | 6650 | |
| 6651 | 6651 |  			if (!$options_only) { | 
                                                        
| 6652 | - $return .= '<select class="flat minwidth50imp maxwidth100" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';  | 
                                                        |
| 6652 | + $return .= '<select class="flat minwidth50imp maxwidth100" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';  | 
                                                        |
| 6653 | 6653 | }  | 
                                                        
| 6654 | 6654 | |
| 6655 | 6655 | $selectedfound = false;  | 
                                                        
@@ -6663,13 +6663,13 @@ discard block  | 
                                                    ||
| 6663 | 6663 | $key = $rate['txtva'];  | 
                                                        
| 6664 | 6664 | $key .= $rate['nprtva'] ? '*' : '';  | 
                                                        
| 6665 | 6665 |  				if ($mode > 0 && $rate['code']) { | 
                                                        
| 6666 | -					$key .= ' (' . $rate['code'] . ')'; | 
                                                        |
| 6666 | +					$key .= ' ('.$rate['code'].')'; | 
                                                        |
| 6667 | 6667 | }  | 
                                                        
| 6668 | 6668 |  				if ($mode < 0) { | 
                                                        
| 6669 | 6669 | $key = $rate['rowid'];  | 
                                                        
| 6670 | 6670 | }  | 
                                                        
| 6671 | 6671 | |
| 6672 | - $return .= '<option value="' . $key . '"';  | 
                                                        |
| 6672 | + $return .= '<option value="'.$key.'"';  | 
                                                        |
| 6673 | 6673 |  				if (!$selectedfound) { | 
                                                        
| 6674 | 6674 |  					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag | 
                                                        
| 6675 | 6675 |  						if ($defaultcode == $rate['code']) { | 
                                                        
@@ -6740,7 +6740,7 @@ discard block  | 
                                                    ||
| 6740 | 6740 | 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 = '')  | 
                                                        
| 6741 | 6741 |  	{ | 
                                                        
| 6742 | 6742 | // phpcs:enable  | 
                                                        
| 6743 | - dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6743 | + dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);  | 
                                                        |
| 6744 | 6744 | $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);  | 
                                                        
| 6745 | 6745 |  		if (!empty($nooutput)) { | 
                                                        
| 6746 | 6746 | return $retstring;  | 
                                                        
@@ -6769,11 +6769,11 @@ discard block  | 
                                                    ||
| 6769 | 6769 |  	{ | 
                                                        
| 6770 | 6770 | global $langs;  | 
                                                        
| 6771 | 6771 | |
| 6772 | -		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6772 | +		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel'); | 
                                                        |
| 6773 | 6773 |  		if ($forcenewline) { | 
                                                        
| 6774 | 6774 | $ret .= '<br>';  | 
                                                        
| 6775 | 6775 | }  | 
                                                        
| 6776 | -		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6776 | +		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel'); | 
                                                        |
| 6777 | 6777 | return $ret;  | 
                                                        
| 6778 | 6778 | }  | 
                                                        
| 6779 | 6779 | |
@@ -6839,7 +6839,7 @@ discard block  | 
                                                    ||
| 6839 | 6839 | $orig_set_time = $set_time;  | 
                                                        
| 6840 | 6840 | |
| 6841 | 6841 |  		if ($set_time === '' && $emptydate == 0) { | 
                                                        
| 6842 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 6842 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 6843 | 6843 |  			if ($gm == 'tzuser' || $gm == 'tzuserrel') { | 
                                                        
| 6844 | 6844 | $set_time = dol_now($gm);  | 
                                                        
| 6845 | 6845 |  			} else { | 
                                                        
@@ -6911,38 +6911,38 @@ discard block  | 
                                                    ||
| 6911 | 6911 | // Calendrier popup version eldy  | 
                                                        
| 6912 | 6912 |  				if ($usecalendar == "eldy") { | 
                                                        
| 6913 | 6913 | // Input area to enter date manually  | 
                                                        
| 6914 | - $retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate" maxlength="11" value="' . $formated_date . '"';  | 
                                                        |
| 6914 | + $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        |
| 6915 | 6915 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 6916 | -					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6916 | +					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6917 | 6917 | $retstring .= ' autocomplete="off">';  | 
                                                        
| 6918 | 6918 | |
| 6919 | 6919 | // Icon calendar  | 
                                                        
| 6920 | 6920 | $retstringbuttom = '';  | 
                                                        
| 6921 | 6921 |  					if (!$disabled) { | 
                                                        
| 6922 | - $retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 6923 | - $base = DOL_URL_ROOT . '/core/';  | 
                                                        |
| 6924 | -						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"'; | 
                                                        |
| 6925 | -						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6922 | + $retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';  | 
                                                        |
| 6923 | + $base = DOL_URL_ROOT.'/core/';  | 
                                                        |
| 6924 | +						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; | 
                                                        |
| 6925 | +						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6926 | 6926 |  					} else { | 
                                                        
| 6927 | -						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6927 | +						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6928 | 6928 | }  | 
                                                        
| 6929 | - $retstring = $retstringbuttom . $retstring;  | 
                                                        |
| 6929 | + $retstring = $retstringbuttom.$retstring;  | 
                                                        |
| 6930 | 6930 | |
| 6931 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 6932 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 6933 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 6931 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 6932 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 6933 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 6934 | 6934 |  				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') { | 
                                                        
| 6935 | 6935 |  					if (!$disabled && $usecalendar != 'html') { | 
                                                        
| 6936 | 6936 | // Output javascript for datepicker  | 
                                                        
| 6937 | 6937 |  						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100)); | 
                                                        
| 6938 | 6938 |  						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100)); | 
                                                        
| 6939 | 6939 | |
| 6940 | - $retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';  | 
                                                        |
| 6941 | -						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({ | 
                                                        |
| 6942 | -							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "', | 
                                                        |
| 6940 | + $retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';  | 
                                                        |
| 6941 | +						$retstring .= "$(function(){ $('#".$prefix."').datepicker({ | 
                                                        |
| 6942 | +							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."', | 
                                                        |
| 6943 | 6943 | autoclose: true,  | 
                                                        
| 6944 | 6944 | todayHighlight: true,  | 
                                                        
| 6945 | - yearRange: '" . $minYear . ":" . $maxYear . "',";  | 
                                                        |
| 6945 | + yearRange: '" . $minYear.":".$maxYear."',";  | 
                                                        |
| 6946 | 6946 |  						if (!empty($conf->dol_use_jmobile)) { | 
                                                        
| 6947 | 6947 | $retstring .= "  | 
                                                        
| 6948 | 6948 |  								beforeShow: function (input, datePicker) { | 
                                                        
@@ -6957,7 +6957,7 @@ discard block  | 
                                                    ||
| 6957 | 6957 |  						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) { | 
                                                        
| 6958 | 6958 | $retstring .= "  | 
                                                        
| 6959 | 6959 | showOn: 'button', /* both has problem with autocompletion */  | 
                                                        
| 6960 | - buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',  | 
                                                        |
| 6960 | + buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',  | 
                                                        |
| 6961 | 6961 | buttonImageOnly: true";  | 
                                                        
| 6962 | 6962 | }  | 
                                                        
| 6963 | 6963 | $retstring .= "  | 
                                                        
@@ -6969,46 +6969,46 @@ discard block  | 
                                                    ||
| 6969 | 6969 | $retstring .= '<div class="nowraponall inline-block divfordateinput">';  | 
                                                        
| 6970 | 6970 | $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';  | 
                                                        
| 6971 | 6971 | $retstring .= ($disabled ? ' disabled' : '');  | 
                                                        
| 6972 | - $retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');  | 
                                                        |
| 6973 | -					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6972 | + $retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');  | 
                                                        |
| 6973 | +					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript | 
                                                        |
| 6974 | 6974 | $retstring .= ' autocomplete="off">';  | 
                                                        
| 6975 | 6975 | |
| 6976 | 6976 | // Icone calendrier  | 
                                                        
| 6977 | 6977 |  					if ($disabled) { | 
                                                        
| 6978 | -						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>'; | 
                                                        |
| 6979 | - $retstring = $retstringbutton . $retstring;  | 
                                                        |
| 6978 | +						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>'; | 
                                                        |
| 6979 | + $retstring = $retstringbutton.$retstring;  | 
                                                        |
| 6980 | 6980 | }  | 
                                                        
| 6981 | 6981 | |
| 6982 | 6982 | $retstring .= '</div>';  | 
                                                        
| 6983 | - $retstring .= '<input type="hidden" id="' . $prefix . 'day" name="' . $prefix . 'day" value="' . $sday . '">' . "\n";  | 
                                                        |
| 6984 | - $retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";  | 
                                                        |
| 6985 | - $retstring .= '<input type="hidden" id="' . $prefix . 'year" name="' . $prefix . 'year" value="' . $syear . '">' . "\n";  | 
                                                        |
| 6983 | + $retstring .= '<input type="hidden" id="'.$prefix.'day" name="'.$prefix.'day" value="'.$sday.'">'."\n";  | 
                                                        |
| 6984 | + $retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";  | 
                                                        |
| 6985 | + $retstring .= '<input type="hidden" id="'.$prefix.'year" name="'.$prefix.'year" value="'.$syear.'">'."\n";  | 
                                                        |
| 6986 | 6986 |  				} else { | 
                                                        
| 6987 | 6987 | $retstring .= "Bad value of MAIN_POPUP_CALENDAR";  | 
                                                        
| 6988 | 6988 | }  | 
                                                        
| 6989 | 6989 |  			} else { | 
                                                        
| 6990 | 6990 | // Show date with combo selects  | 
                                                        
| 6991 | 6991 | // Day  | 
                                                        
| 6992 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';  | 
                                                        |
| 6992 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';  | 
                                                        |
| 6993 | 6993 | |
| 6994 | 6994 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 6995 | 6995 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 6996 | 6996 | }  | 
                                                        
| 6997 | 6997 | |
| 6998 | 6998 |  				for ($day = 1; $day <= 31; $day++) { | 
                                                        
| 6999 | - $retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';  | 
                                                        |
| 6999 | + $retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';  | 
                                                        |
| 7000 | 7000 | }  | 
                                                        
| 7001 | 7001 | |
| 7002 | 7002 | $retstring .= "</select>";  | 
                                                        
| 7003 | 7003 | |
| 7004 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';  | 
                                                        |
| 7004 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';  | 
                                                        |
| 7005 | 7005 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7006 | 7006 | $retstring .= '<option value="0" selected> </option>';  | 
                                                        
| 7007 | 7007 | }  | 
                                                        
| 7008 | 7008 | |
| 7009 | 7009 | // Month  | 
                                                        
| 7010 | 7010 |  				for ($month = 1; $month <= 12; $month++) { | 
                                                        
| 7011 | - $retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';  | 
                                                        |
| 7011 | + $retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';  | 
                                                        |
| 7012 | 7012 | $retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");  | 
                                                        
| 7013 | 7013 | $retstring .= "</option>";  | 
                                                        
| 7014 | 7014 | }  | 
                                                        
@@ -7016,13 +7016,13 @@ discard block  | 
                                                    ||
| 7016 | 7016 | |
| 7017 | 7017 | // Year  | 
                                                        
| 7018 | 7018 |  				if ($emptydate || $set_time == -1) { | 
                                                        
| 7019 | -					$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 . '">'; | 
                                                        |
| 7019 | +					$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.'">'; | 
                                                        |
| 7020 | 7020 |  				} else { | 
                                                        
| 7021 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';  | 
                                                        |
| 7021 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';  | 
                                                        |
| 7022 | 7022 | |
| 7023 | 7023 | $syear = (int) $syear;  | 
                                                        
| 7024 | 7024 |  					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) { | 
                                                        
| 7025 | - $retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';  | 
                                                        |
| 7025 | + $retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';  | 
                                                        |
| 7026 | 7026 | }  | 
                                                        
| 7027 | 7027 | $retstring .= "</select>\n";  | 
                                                        
| 7028 | 7028 | }  | 
                                                        
@@ -7046,15 +7046,15 @@ discard block  | 
                                                    ||
| 7046 | 7046 | }  | 
                                                        
| 7047 | 7047 | }  | 
                                                        
| 7048 | 7048 | // Show hour  | 
                                                        
| 7049 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';  | 
                                                        |
| 7049 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';  | 
                                                        |
| 7050 | 7050 |  			if ($emptyhours) { | 
                                                        
| 7051 | 7051 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7052 | 7052 | }  | 
                                                        
| 7053 | 7053 |  			for ($hour = $hourstart; $hour < $hourend; $hour++) { | 
                                                        
| 7054 | 7054 |  				if (strlen($hour) < 2) { | 
                                                        
| 7055 | - $hour = "0" . $hour;  | 
                                                        |
| 7055 | + $hour = "0".$hour;  | 
                                                        |
| 7056 | 7056 | }  | 
                                                        
| 7057 | - $retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;  | 
                                                        |
| 7057 | + $retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;  | 
                                                        |
| 7058 | 7058 | //$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');  | 
                                                        
| 7059 | 7059 | $retstring .= '</option>';  | 
                                                        
| 7060 | 7060 | }  | 
                                                        
@@ -7067,17 +7067,17 @@ discard block  | 
                                                    ||
| 7067 | 7067 | |
| 7068 | 7068 |  		if ($m) { | 
                                                        
| 7069 | 7069 | // Show minutes  | 
                                                        
| 7070 | - $retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';  | 
                                                        |
| 7070 | + $retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';  | 
                                                        |
| 7071 | 7071 |  			if ($emptyhours) { | 
                                                        
| 7072 | 7072 | $retstring .= '<option value="-1"> </option>';  | 
                                                        
| 7073 | 7073 | }  | 
                                                        
| 7074 | 7074 |  			for ($min = 0; $min < 60; $min += $stepminutes) { | 
                                                        
| 7075 | 7075 |  				$min_str = sprintf("%02d", $min); | 
                                                        
| 7076 | - $retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';  | 
                                                        |
| 7076 | + $retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';  | 
                                                        |
| 7077 | 7077 | }  | 
                                                        
| 7078 | 7078 | $retstring .= '</select>';  | 
                                                        
| 7079 | 7079 | |
| 7080 | - $retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';  | 
                                                        |
| 7080 | + $retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';  | 
                                                        |
| 7081 | 7081 | }  | 
                                                        
| 7082 | 7082 | |
| 7083 | 7083 |  		if ($d && $h) { | 
                                                        
@@ -7100,10 +7100,10 @@ discard block  | 
                                                    ||
| 7100 | 7100 | |
| 7101 | 7101 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7102 | 7102 |  			if ($addnowlink == 1) { // server time expressed in user time setup | 
                                                        
| 7103 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7104 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7105 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7106 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7103 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7104 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7105 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7106 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7107 | 7107 |  			} elseif ($addnowlink == 2) { | 
                                                        
| 7108 | 7108 | /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.  | 
                                                        
| 7109 | 7109 | * This break application for foreign languages.  | 
                                                        
@@ -7112,10 +7112,10 @@ discard block  | 
                                                    ||
| 7112 | 7112 | $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';  | 
                                                        
| 7113 | 7113 | $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';  | 
                                                        
| 7114 | 7114 | */  | 
                                                        
| 7115 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';  | 
                                                        |
| 7116 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7117 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7118 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7115 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';  | 
                                                        |
| 7116 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7117 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7118 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7119 | 7119 | }  | 
                                                        
| 7120 | 7120 | /*if ($usecalendar == "eldy")  | 
                                                        
| 7121 | 7121 |  			{ | 
                                                        
@@ -7135,11 +7135,11 @@ discard block  | 
                                                    ||
| 7135 | 7135 | }  | 
                                                        
| 7136 | 7136 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';  | 
                                                        
| 7137 | 7137 |  				if ($addnowlink == 1) { | 
                                                        
| 7138 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7139 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7138 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7139 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7140 | 7140 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7141 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7142 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';  | 
                                                        |
| 7141 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';  | 
                                                        |
| 7142 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';  | 
                                                        |
| 7143 | 7143 | }  | 
                                                        
| 7144 | 7144 | |
| 7145 | 7145 |  				if ($fullday) { | 
                                                        
@@ -7153,11 +7153,11 @@ discard block  | 
                                                    ||
| 7153 | 7153 | }  | 
                                                        
| 7154 | 7154 | //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';  | 
                                                        
| 7155 | 7155 |  				if ($addnowlink == 1) { | 
                                                        
| 7156 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7157 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7156 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7157 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7158 | 7158 |  				} elseif ($addnowlink == 2) { | 
                                                        
| 7159 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7160 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';  | 
                                                        |
| 7159 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';  | 
                                                        |
| 7160 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';  | 
                                                        |
| 7161 | 7161 | }  | 
                                                        
| 7162 | 7162 |  				if ($fullday) { | 
                                                        
| 7163 | 7163 | $reset_scripts .= ' } ';  | 
                                                        
@@ -7165,7 +7165,7 @@ discard block  | 
                                                    ||
| 7165 | 7165 | }  | 
                                                        
| 7166 | 7166 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7167 | 7167 |  			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { | 
                                                        
| 7168 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7168 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7169 | 7169 |  				$retstring .= $langs->trans("Now"); | 
                                                        
| 7170 | 7170 | $retstring .= '</button> ';  | 
                                                        
| 7171 | 7171 | }  | 
                                                        
@@ -7177,16 +7177,16 @@ discard block  | 
                                                    ||
| 7177 | 7177 | $reset_scripts = "";  | 
                                                        
| 7178 | 7178 | |
| 7179 | 7179 | // Generate the date part, depending on the use or not of the javascript calendar  | 
                                                        
| 7180 | - $reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';  | 
                                                        |
| 7181 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';  | 
                                                        |
| 7182 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';  | 
                                                        |
| 7183 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';  | 
                                                        |
| 7180 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';  | 
                                                        |
| 7181 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';  | 
                                                        |
| 7182 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';  | 
                                                        |
| 7183 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';  | 
                                                        |
| 7184 | 7184 | // Update the hour part  | 
                                                        
| 7185 | 7185 |  			if ($h) { | 
                                                        
| 7186 | 7186 |  				if ($fullday) { | 
                                                        
| 7187 | 7187 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7188 | 7188 | }  | 
                                                        
| 7189 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';  | 
                                                        |
| 7189 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';  | 
                                                        |
| 7190 | 7190 |  				if ($fullday) { | 
                                                        
| 7191 | 7191 | $reset_scripts .= ' } ';  | 
                                                        
| 7192 | 7192 | }  | 
                                                        
@@ -7196,14 +7196,14 @@ discard block  | 
                                                    ||
| 7196 | 7196 |  				if ($fullday) { | 
                                                        
| 7197 | 7197 |  					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; | 
                                                        
| 7198 | 7198 | }  | 
                                                        
| 7199 | - $reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';  | 
                                                        |
| 7199 | + $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';  | 
                                                        |
| 7200 | 7200 |  				if ($fullday) { | 
                                                        
| 7201 | 7201 | $reset_scripts .= ' } ';  | 
                                                        
| 7202 | 7202 | }  | 
                                                        
| 7203 | 7203 | }  | 
                                                        
| 7204 | 7204 | // If reset_scripts is not empty, print the link with the reset_scripts in the onClick  | 
                                                        
| 7205 | 7205 |  			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) { | 
                                                        
| 7206 | - $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';  | 
                                                        |
| 7206 | + $retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';  | 
                                                        |
| 7207 | 7207 |  				$retstring .= $langs->trans("DateStartPlusOne"); | 
                                                        
| 7208 | 7208 | $retstring .= '</button> ';  | 
                                                        
| 7209 | 7209 | }  | 
                                                        
@@ -7261,17 +7261,17 @@ discard block  | 
                                                    ||
| 7261 | 7261 | unset($TDurationTypes[$value]);  | 
                                                        
| 7262 | 7262 | }  | 
                                                        
| 7263 | 7263 | |
| 7264 | - $retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';  | 
                                                        |
| 7264 | + $retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';  | 
                                                        |
| 7265 | 7265 |  		foreach ($TDurationTypes as $key => $typeduration) { | 
                                                        
| 7266 | - $retstring .= '<option value="' . $key . '"';  | 
                                                        |
| 7266 | + $retstring .= '<option value="'.$key.'"';  | 
                                                        |
| 7267 | 7267 |  			if ($key == $selected) { | 
                                                        
| 7268 | 7268 | $retstring .= " selected";  | 
                                                        
| 7269 | 7269 | }  | 
                                                        
| 7270 | - $retstring .= ">" . $typeduration . "</option>";  | 
                                                        |
| 7270 | + $retstring .= ">".$typeduration."</option>";  | 
                                                        |
| 7271 | 7271 | }  | 
                                                        
| 7272 | 7272 | $retstring .= "</select>";  | 
                                                        
| 7273 | 7273 | |
| 7274 | -		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration'); | 
                                                        |
| 7274 | +		$retstring .= ajax_combobox('select_'.$prefix.'type_duration'); | 
                                                        |
| 7275 | 7275 | |
| 7276 | 7276 | return $retstring;  | 
                                                        
| 7277 | 7277 | }  | 
                                                        
@@ -7303,30 +7303,30 @@ discard block  | 
                                                    ||
| 7303 | 7303 | |
| 7304 | 7304 | // Hours  | 
                                                        
| 7305 | 7305 |  		if ($iSecond != '') { | 
                                                        
| 7306 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';  | 
                                                        |
| 7306 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';  | 
                                                        |
| 7307 | 7307 | |
| 7308 | 7308 | $hourSelected = convertSecondToTime($iSecond, 'allhour');  | 
                                                        
| 7309 | 7309 | $minSelected = convertSecondToTime($iSecond, 'min');  | 
                                                        
| 7310 | 7310 | }  | 
                                                        
| 7311 | 7311 | |
| 7312 | 7312 |  		if ($typehour == 'select') { | 
                                                        
| 7313 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7313 | + $retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7314 | 7314 |  			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours | 
                                                        
| 7315 | - $retstring .= '<option value="' . $hour . '"';  | 
                                                        |
| 7315 | + $retstring .= '<option value="'.$hour.'"';  | 
                                                        |
| 7316 | 7316 |  				if (is_numeric($hourSelected) && $hourSelected == $hour) { | 
                                                        
| 7317 | 7317 | $retstring .= " selected";  | 
                                                        
| 7318 | 7318 | }  | 
                                                        
| 7319 | - $retstring .= ">" . $hour . "</option>";  | 
                                                        |
| 7319 | + $retstring .= ">".$hour."</option>";  | 
                                                        |
| 7320 | 7320 | }  | 
                                                        
| 7321 | 7321 | $retstring .= "</select>";  | 
                                                        
| 7322 | 7322 |  		} elseif ($typehour == 'text' || $typehour == 'textselect') { | 
                                                        
| 7323 | -			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">'; | 
                                                        |
| 7323 | +			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; | 
                                                        |
| 7324 | 7324 |  		} else { | 
                                                        
| 7325 | 7325 | return 'BadValueForParameterTypeHour';  | 
                                                        
| 7326 | 7326 | }  | 
                                                        
| 7327 | 7327 | |
| 7328 | 7328 |  		if ($typehour != 'text') { | 
                                                        
| 7329 | -			$retstring .= ' ' . $langs->trans('HourShort'); | 
                                                        |
| 7329 | +			$retstring .= ' '.$langs->trans('HourShort'); | 
                                                        |
| 7330 | 7330 |  		} else { | 
                                                        
| 7331 | 7331 | $retstring .= '<span class="">:</span>';  | 
                                                        
| 7332 | 7332 | }  | 
                                                        
@@ -7341,21 +7341,21 @@ discard block  | 
                                                    ||
| 7341 | 7341 | }  | 
                                                        
| 7342 | 7342 | |
| 7343 | 7343 |  		if ($typehour == 'select' || $typehour == 'textselect') { | 
                                                        
| 7344 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 7344 | + $retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 7345 | 7345 |  			for ($min = 0; $min <= 55; $min += 5) { | 
                                                        
| 7346 | - $retstring .= '<option value="' . $min . '"';  | 
                                                        |
| 7346 | + $retstring .= '<option value="'.$min.'"';  | 
                                                        |
| 7347 | 7347 |  				if (is_numeric($minSelected) && $minSelected == $min) { | 
                                                        
| 7348 | 7348 | $retstring .= ' selected';  | 
                                                        
| 7349 | 7349 | }  | 
                                                        
| 7350 | - $retstring .= '>' . $min . '</option>';  | 
                                                        |
| 7350 | + $retstring .= '>'.$min.'</option>';  | 
                                                        |
| 7351 | 7351 | }  | 
                                                        
| 7352 | 7352 | $retstring .= "</select>";  | 
                                                        
| 7353 | 7353 |  		} elseif ($typehour == 'text') { | 
                                                        
| 7354 | -			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">'; | 
                                                        |
| 7354 | +			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; | 
                                                        |
| 7355 | 7355 | }  | 
                                                        
| 7356 | 7356 | |
| 7357 | 7357 |  		if ($typehour != 'text') { | 
                                                        
| 7358 | -			$retstring .= ' ' . $langs->trans('MinuteShort'); | 
                                                        |
| 7358 | +			$retstring .= ' '.$langs->trans('MinuteShort'); | 
                                                        |
| 7359 | 7359 | }  | 
                                                        
| 7360 | 7360 | |
| 7361 | 7361 | $retstring .= "</span>";  | 
                                                        
@@ -7403,7 +7403,7 @@ discard block  | 
                                                    ||
| 7403 | 7403 | $placeholder = '';  | 
                                                        
| 7404 | 7404 | |
| 7405 | 7405 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7406 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7406 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7407 | 7407 | $tickettmpselect = new Ticket($this->db);  | 
                                                        
| 7408 | 7408 | $tickettmpselect->fetch($selected);  | 
                                                        
| 7409 | 7409 | $selected_input_value = $tickettmpselect->ref;  | 
                                                        
@@ -7411,17 +7411,17 @@ discard block  | 
                                                    ||
| 7411 | 7411 | }  | 
                                                        
| 7412 | 7412 | |
| 7413 | 7413 | $urloption = '';  | 
                                                        
| 7414 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7414 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7415 | 7415 | |
| 7416 | 7416 |  			if (empty($hidelabel)) { | 
                                                        
| 7417 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7417 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7418 | 7418 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7419 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7419 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7420 | 7420 |  				if ($hidelabel == 2) { | 
                                                        
| 7421 | 7421 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7422 | 7422 | }  | 
                                                        
| 7423 | 7423 | }  | 
                                                        
| 7424 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7424 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7425 | 7425 |  			if ($hidelabel == 3) { | 
                                                        
| 7426 | 7426 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7427 | 7427 | }  | 
                                                        
@@ -7465,8 +7465,8 @@ discard block  | 
                                                    ||
| 7465 | 7465 | |
| 7466 | 7466 | $sql = "SELECT ";  | 
                                                        
| 7467 | 7467 | $sql .= $selectFields;  | 
                                                        
| 7468 | - $sql .= " FROM " . $this->db->prefix() . "ticket as p";  | 
                                                        |
| 7469 | -		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')'; | 
                                                        |
| 7468 | + $sql .= " FROM ".$this->db->prefix()."ticket as p";  | 
                                                        |
| 7469 | +		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')'; | 
                                                        |
| 7470 | 7470 | |
| 7471 | 7471 | // Add criteria on ref/label  | 
                                                        
| 7472 | 7472 |  		if ($filterkey != '') { | 
                                                        
@@ -7482,7 +7482,7 @@ discard block  | 
                                                    ||
| 7482 | 7482 |  				if ($i > 0) { | 
                                                        
| 7483 | 7483 | $sql .= " AND ";  | 
                                                        
| 7484 | 7484 | }  | 
                                                        
| 7485 | - $sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7485 | + $sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7486 | 7486 | $sql .= ")";  | 
                                                        
| 7487 | 7487 | $i++;  | 
                                                        
| 7488 | 7488 | }  | 
                                                        
@@ -7495,22 +7495,22 @@ discard block  | 
                                                    ||
| 7495 | 7495 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7496 | 7496 | |
| 7497 | 7497 | // Build output string  | 
                                                        
| 7498 | - dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7498 | + dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);  | 
                                                        |
| 7499 | 7499 | $result = $this->db->query($sql);  | 
                                                        
| 7500 | 7500 |  		if ($result) { | 
                                                        
| 7501 | - require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';  | 
                                                        |
| 7502 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';  | 
                                                        |
| 7501 | + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';  | 
                                                        |
| 7502 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';  | 
                                                        |
| 7503 | 7503 | |
| 7504 | 7504 | $num = $this->db->num_rows($result);  | 
                                                        
| 7505 | 7505 | |
| 7506 | 7506 | $events = array();  | 
                                                        
| 7507 | 7507 | |
| 7508 | 7508 |  			if (!$forcecombo) { | 
                                                        
| 7509 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7509 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7510 | 7510 | $out .= ajax_combobox($htmlname, $events, $conf->global->TICKET_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7511 | 7511 | }  | 
                                                        
| 7512 | 7512 | |
| 7513 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7513 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7514 | 7514 | |
| 7515 | 7515 | $textifempty = '';  | 
                                                        
| 7516 | 7516 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7527,7 +7527,7 @@ discard block  | 
                                                    ||
| 7527 | 7527 | }  | 
                                                        
| 7528 | 7528 | }  | 
                                                        
| 7529 | 7529 |  			if ($showempty) { | 
                                                        
| 7530 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7530 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7531 | 7531 | }  | 
                                                        
| 7532 | 7532 | |
| 7533 | 7533 | $i = 0;  | 
                                                        
@@ -7582,13 +7582,13 @@ discard block  | 
                                                    ||
| 7582 | 7582 | $outref = $objp->ref;  | 
                                                        
| 7583 | 7583 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7584 | 7584 | |
| 7585 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7585 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7586 | 7586 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7587 | 7587 | $opt .= '>';  | 
                                                        
| 7588 | 7588 | $opt .= $objp->ref;  | 
                                                        
| 7589 | 7589 | $objRef = $objp->ref;  | 
                                                        
| 7590 | 7590 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7591 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7591 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7592 | 7592 | }  | 
                                                        
| 7593 | 7593 | |
| 7594 | 7594 | $opt .= "</option>\n";  | 
                                                        
@@ -7629,7 +7629,7 @@ discard block  | 
                                                    ||
| 7629 | 7629 | $placeholder = '';  | 
                                                        
| 7630 | 7630 | |
| 7631 | 7631 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7632 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7632 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7633 | 7633 | $projecttmpselect = new Project($this->db);  | 
                                                        
| 7634 | 7634 | $projecttmpselect->fetch($selected);  | 
                                                        
| 7635 | 7635 | $selected_input_value = $projecttmpselect->ref;  | 
                                                        
@@ -7637,17 +7637,17 @@ discard block  | 
                                                    ||
| 7637 | 7637 | }  | 
                                                        
| 7638 | 7638 | |
| 7639 | 7639 | $urloption = '';  | 
                                                        
| 7640 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7640 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7641 | 7641 | |
| 7642 | 7642 |  			if (empty($hidelabel)) { | 
                                                        
| 7643 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7643 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7644 | 7644 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7645 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7645 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7646 | 7646 |  				if ($hidelabel == 2) { | 
                                                        
| 7647 | 7647 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7648 | 7648 | }  | 
                                                        
| 7649 | 7649 | }  | 
                                                        
| 7650 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7650 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7651 | 7651 |  			if ($hidelabel == 3) { | 
                                                        
| 7652 | 7652 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7653 | 7653 | }  | 
                                                        
@@ -7690,8 +7690,8 @@ discard block  | 
                                                    ||
| 7690 | 7690 | |
| 7691 | 7691 | $sql = "SELECT ";  | 
                                                        
| 7692 | 7692 | $sql .= $selectFields;  | 
                                                        
| 7693 | - $sql .= " FROM " . $this->db->prefix() . "projet as p";  | 
                                                        |
| 7694 | -		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')'; | 
                                                        |
| 7693 | + $sql .= " FROM ".$this->db->prefix()."projet as p";  | 
                                                        |
| 7694 | +		$sql .= ' WHERE p.entity IN ('.getEntity('project').')'; | 
                                                        |
| 7695 | 7695 | |
| 7696 | 7696 | // Add criteria on ref/label  | 
                                                        
| 7697 | 7697 |  		if ($filterkey != '') { | 
                                                        
@@ -7707,7 +7707,7 @@ discard block  | 
                                                    ||
| 7707 | 7707 |  				if ($i > 0) { | 
                                                        
| 7708 | 7708 | $sql .= " AND ";  | 
                                                        
| 7709 | 7709 | }  | 
                                                        
| 7710 | - $sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7710 | + $sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7711 | 7711 | $sql .= "";  | 
                                                        
| 7712 | 7712 | $i++;  | 
                                                        
| 7713 | 7713 | }  | 
                                                        
@@ -7720,22 +7720,22 @@ discard block  | 
                                                    ||
| 7720 | 7720 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7721 | 7721 | |
| 7722 | 7722 | // Build output string  | 
                                                        
| 7723 | - dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7723 | + dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);  | 
                                                        |
| 7724 | 7724 | $result = $this->db->query($sql);  | 
                                                        
| 7725 | 7725 |  		if ($result) { | 
                                                        
| 7726 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 7727 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';  | 
                                                        |
| 7726 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 7727 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';  | 
                                                        |
| 7728 | 7728 | |
| 7729 | 7729 | $num = $this->db->num_rows($result);  | 
                                                        
| 7730 | 7730 | |
| 7731 | 7731 | $events = array();  | 
                                                        
| 7732 | 7732 | |
| 7733 | 7733 |  			if (!$forcecombo) { | 
                                                        
| 7734 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7734 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7735 | 7735 | $out .= ajax_combobox($htmlname, $events, $conf->global->PROJECT_USE_SEARCH_TO_SELECT);  | 
                                                        
| 7736 | 7736 | }  | 
                                                        
| 7737 | 7737 | |
| 7738 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7738 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7739 | 7739 | |
| 7740 | 7740 | $textifempty = '';  | 
                                                        
| 7741 | 7741 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7752,7 +7752,7 @@ discard block  | 
                                                    ||
| 7752 | 7752 | }  | 
                                                        
| 7753 | 7753 | }  | 
                                                        
| 7754 | 7754 |  			if ($showempty) { | 
                                                        
| 7755 | - $out .= '<option value="0" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7755 | + $out .= '<option value="0" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7756 | 7756 | }  | 
                                                        
| 7757 | 7757 | |
| 7758 | 7758 | $i = 0;  | 
                                                        
@@ -7810,13 +7810,13 @@ discard block  | 
                                                    ||
| 7810 | 7810 | $outlabel = $objp->label;  | 
                                                        
| 7811 | 7811 | $outtype = $objp->fk_product_type;  | 
                                                        
| 7812 | 7812 | |
| 7813 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 7813 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 7814 | 7814 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 7815 | 7815 | $opt .= '>';  | 
                                                        
| 7816 | 7816 | $opt .= $objp->ref;  | 
                                                        
| 7817 | 7817 | $objRef = $objp->ref;  | 
                                                        
| 7818 | 7818 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 7819 | -			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7819 | +			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1); | 
                                                        |
| 7820 | 7820 | }  | 
                                                        
| 7821 | 7821 | |
| 7822 | 7822 | $opt .= "</option>\n";  | 
                                                        
@@ -7858,7 +7858,7 @@ discard block  | 
                                                    ||
| 7858 | 7858 | $placeholder = '';  | 
                                                        
| 7859 | 7859 | |
| 7860 | 7860 |  			if ($selected && empty($selected_input_value)) { | 
                                                        
| 7861 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 7861 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 7862 | 7862 | $adherenttmpselect = new Adherent($this->db);  | 
                                                        
| 7863 | 7863 | $adherenttmpselect->fetch($selected);  | 
                                                        
| 7864 | 7864 | $selected_input_value = $adherenttmpselect->ref;  | 
                                                        
@@ -7867,17 +7867,17 @@ discard block  | 
                                                    ||
| 7867 | 7867 | |
| 7868 | 7868 | $urloption = '';  | 
                                                        
| 7869 | 7869 | |
| 7870 | - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7870 | + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);  | 
                                                        |
| 7871 | 7871 | |
| 7872 | 7872 |  			if (empty($hidelabel)) { | 
                                                        
| 7873 | -				$out .= $langs->trans("RefOrLabel") . ' : '; | 
                                                        |
| 7873 | +				$out .= $langs->trans("RefOrLabel").' : '; | 
                                                        |
| 7874 | 7874 |  			} elseif ($hidelabel > 1) { | 
                                                        
| 7875 | -				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; | 
                                                        |
| 7875 | +				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"'; | 
                                                        |
| 7876 | 7876 |  				if ($hidelabel == 2) { | 
                                                        
| 7877 | 7877 |  					$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7878 | 7878 | }  | 
                                                        
| 7879 | 7879 | }  | 
                                                        
| 7880 | -			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />'; | 
                                                        |
| 7880 | +			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />'; | 
                                                        |
| 7881 | 7881 |  			if ($hidelabel == 3) { | 
                                                        
| 7882 | 7882 |  				$out .= img_picto($langs->trans("Search"), 'search'); | 
                                                        
| 7883 | 7883 | }  | 
                                                        
@@ -7922,8 +7922,8 @@ discard block  | 
                                                    ||
| 7922 | 7922 | |
| 7923 | 7923 | $sql = "SELECT ";  | 
                                                        
| 7924 | 7924 | $sql .= $selectFields;  | 
                                                        
| 7925 | - $sql .= " FROM " . $this->db->prefix() . "adherent as p";  | 
                                                        |
| 7926 | -		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')'; | 
                                                        |
| 7925 | + $sql .= " FROM ".$this->db->prefix()."adherent as p";  | 
                                                        |
| 7926 | +		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')'; | 
                                                        |
| 7927 | 7927 | |
| 7928 | 7928 | // Add criteria on ref/label  | 
                                                        
| 7929 | 7929 |  		if ($filterkey != '') { | 
                                                        
@@ -7939,8 +7939,8 @@ discard block  | 
                                                    ||
| 7939 | 7939 |  				if ($i > 0) { | 
                                                        
| 7940 | 7940 | $sql .= " AND ";  | 
                                                        
| 7941 | 7941 | }  | 
                                                        
| 7942 | - $sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";  | 
                                                        |
| 7943 | - $sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";  | 
                                                        |
| 7942 | + $sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";  | 
                                                        |
| 7943 | + $sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";  | 
                                                        |
| 7944 | 7944 | $i++;  | 
                                                        
| 7945 | 7945 | }  | 
                                                        
| 7946 | 7946 |  			if (count($search_crit) > 1) { | 
                                                        
@@ -7949,27 +7949,27 @@ discard block  | 
                                                    ||
| 7949 | 7949 | $sql .= ')';  | 
                                                        
| 7950 | 7950 | }  | 
                                                        
| 7951 | 7951 |  		if ($status != -1) { | 
                                                        
| 7952 | - $sql .= ' AND statut = ' . ((int) $status);  | 
                                                        |
| 7952 | + $sql .= ' AND statut = '.((int) $status);  | 
                                                        |
| 7953 | 7953 | }  | 
                                                        
| 7954 | 7954 | $sql .= $this->db->plimit($limit, 0);  | 
                                                        
| 7955 | 7955 | |
| 7956 | 7956 | // Build output string  | 
                                                        
| 7957 | - dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 7957 | + dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);  | 
                                                        |
| 7958 | 7958 | $result = $this->db->query($sql);  | 
                                                        
| 7959 | 7959 |  		if ($result) { | 
                                                        
| 7960 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';  | 
                                                        |
| 7961 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';  | 
                                                        |
| 7960 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';  | 
                                                        |
| 7961 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';  | 
                                                        |
| 7962 | 7962 | |
| 7963 | 7963 | $num = $this->db->num_rows($result);  | 
                                                        
| 7964 | 7964 | |
| 7965 | 7965 | $events = array();  | 
                                                        
| 7966 | 7966 | |
| 7967 | 7967 |  			if (!$forcecombo) { | 
                                                        
| 7968 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 7968 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 7969 | 7969 |  				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : ''); | 
                                                        
| 7970 | 7970 | }  | 
                                                        
| 7971 | 7971 | |
| 7972 | - $out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';  | 
                                                        |
| 7972 | + $out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';  | 
                                                        |
| 7973 | 7973 | |
| 7974 | 7974 | $textifempty = '';  | 
                                                        
| 7975 | 7975 | // Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.  | 
                                                        
@@ -7986,7 +7986,7 @@ discard block  | 
                                                    ||
| 7986 | 7986 | }  | 
                                                        
| 7987 | 7987 | }  | 
                                                        
| 7988 | 7988 |  			if ($showempty) { | 
                                                        
| 7989 | - $out .= '<option value="-1" selected>' . $textifempty . '</option>';  | 
                                                        |
| 7989 | + $out .= '<option value="-1" selected>'.$textifempty.'</option>';  | 
                                                        |
| 7990 | 7990 | }  | 
                                                        
| 7991 | 7991 | |
| 7992 | 7992 | $i = 0;  | 
                                                        
@@ -8042,11 +8042,11 @@ discard block  | 
                                                    ||
| 8042 | 8042 | $outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);  | 
                                                        
| 8043 | 8043 | $outtype = $objp->fk_adherent_type;  | 
                                                        
| 8044 | 8044 | |
| 8045 | - $opt = '<option value="' . $objp->rowid . '"';  | 
                                                        |
| 8045 | + $opt = '<option value="'.$objp->rowid.'"';  | 
                                                        |
| 8046 | 8046 | $opt .= ($objp->rowid == $selected) ? ' selected' : '';  | 
                                                        
| 8047 | 8047 | $opt .= '>';  | 
                                                        
| 8048 | 8048 |  		if (!empty($filterkey) && $filterkey != '') { | 
                                                        
| 8049 | -			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8049 | +			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1); | 
                                                        |
| 8050 | 8050 | }  | 
                                                        
| 8051 | 8051 | $opt .= $outlabel;  | 
                                                        
| 8052 | 8052 | $opt .= "</option>\n";  | 
                                                        
@@ -8081,8 +8081,8 @@ discard block  | 
                                                    ||
| 8081 | 8081 | $objectdescorig = $objectdesc;  | 
                                                        
| 8082 | 8082 | $objecttmp = null;  | 
                                                        
| 8083 | 8083 | $InfoFieldList = array();  | 
                                                        
| 8084 | - $filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8085 | - $sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8084 | + $filter = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8085 | + $sortfield = ''; // Ensure filter has value (for static analysis)  | 
                                                        |
| 8086 | 8086 | |
| 8087 | 8087 |  		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield | 
                                                        
| 8088 | 8088 | // Example: $objectfield = 'product:options_package'  | 
                                                        
@@ -8121,9 +8121,9 @@ discard block  | 
                                                    ||
| 8121 | 8121 | $vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);  | 
                                                        
| 8122 | 8122 | $reg = array();  | 
                                                        
| 8123 | 8123 |  			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) { | 
                                                        
| 8124 | - $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8124 | + $InfoFieldList[4] = $reg[1]; // take the sort field  | 
                                                        |
| 8125 | 8125 | }  | 
                                                        
| 8126 | -			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field | 
                                                        |
| 8126 | +			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field | 
                                                        |
| 8127 | 8127 | |
| 8128 | 8128 | $classname = $InfoFieldList[0];  | 
                                                        
| 8129 | 8129 | $classpath = $InfoFieldList[1];  | 
                                                        
@@ -8154,8 +8154,8 @@ discard block  | 
                                                    ||
| 8154 | 8154 | );  | 
                                                        
| 8155 | 8155 | |
| 8156 | 8156 |  		if (!is_object($objecttmp)) { | 
                                                        
| 8157 | -			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield, LOG_WARNING); | 
                                                        |
| 8158 | - return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield;  | 
                                                        |
| 8157 | +			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield, LOG_WARNING); | 
                                                        |
| 8158 | + return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield;  | 
                                                        |
| 8159 | 8159 | }  | 
                                                        
| 8160 | 8160 | '@phan-var-force CommonObject $objecttmp';  | 
                                                        
| 8161 | 8161 | |
@@ -8167,9 +8167,9 @@ discard block  | 
                                                    ||
| 8167 | 8167 |  		if ($prefixforautocompletemode == 'product') { | 
                                                        
| 8168 | 8168 | $prefixforautocompletemode = 'produit';  | 
                                                        
| 8169 | 8169 | }  | 
                                                        
| 8170 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8170 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8171 | 8171 | |
| 8172 | - dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);  | 
                                                        |
| 8172 | + dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);  | 
                                                        |
| 8173 | 8173 | |
| 8174 | 8174 | // Generate the combo HTML component  | 
                                                        
| 8175 | 8175 | $out = '';  | 
                                                        
@@ -8198,13 +8198,13 @@ discard block  | 
                                                    ||
| 8198 | 8198 | }  | 
                                                        
| 8199 | 8199 | |
| 8200 | 8200 | // Set url and param to call to get json of the search results  | 
                                                        
| 8201 | - $urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';  | 
                                                        |
| 8202 | - $urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');  | 
                                                        |
| 8201 | + $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';  | 
                                                        |
| 8202 | + $urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');  | 
                                                        |
| 8203 | 8203 | |
| 8204 | 8204 | // Activate the auto complete using ajax call.  | 
                                                        
| 8205 | 8205 | $out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);  | 
                                                        
| 8206 | 8206 |  			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>'; | 
                                                        
| 8207 | - $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) . '"' : '') . ' />';  | 
                                                        |
| 8207 | + $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).'"' : '').' />';  | 
                                                        |
| 8208 | 8208 |  		} else { | 
                                                        
| 8209 | 8209 | // Immediate load of table record.  | 
                                                        
| 8210 | 8210 | $out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);  | 
                                                        
@@ -8244,16 +8244,16 @@ discard block  | 
                                                    ||
| 8244 | 8244 |  		if ($prefixforautocompletemode == 'societe') { | 
                                                        
| 8245 | 8245 | $prefixforautocompletemode = 'company';  | 
                                                        
| 8246 | 8246 | }  | 
                                                        
| 8247 | - $confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8247 | + $confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT  | 
                                                        |
| 8248 | 8248 | |
| 8249 | 8249 |  		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...) | 
                                                        
| 8250 | 8250 | $tmpfieldstoshow = '';  | 
                                                        
| 8251 | 8251 |  			foreach ($objecttmp->fields as $key => $val) { | 
                                                        
| 8252 | -				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        |
| 8252 | +				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) { | 
                                                        |
| 8253 | 8253 | continue;  | 
                                                        
| 8254 | 8254 | }  | 
                                                        
| 8255 | 8255 |  				if (!empty($val['showoncombobox'])) { | 
                                                        
| 8256 | - $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;  | 
                                                        |
| 8256 | + $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;  | 
                                                        |
| 8257 | 8257 | }  | 
                                                        
| 8258 | 8258 | }  | 
                                                        
| 8259 | 8259 |  			if ($tmpfieldstoshow) { | 
                                                        
@@ -8281,18 +8281,18 @@ discard block  | 
                                                    ||
| 8281 | 8281 | $num = 0;  | 
                                                        
| 8282 | 8282 | |
| 8283 | 8283 | // Search data  | 
                                                        
| 8284 | - $sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $objecttmp->table_element . " as t";  | 
                                                        |
| 8284 | + $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$objecttmp->table_element." as t";  | 
                                                        |
| 8285 | 8285 |  		if (!empty($objecttmp->isextrafieldmanaged)) { | 
                                                        
| 8286 | - $sql .= " LEFT JOIN " . $this->db->prefix() . $objecttmp->table_element . "_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8286 | + $sql .= " LEFT JOIN ".$this->db->prefix().$objecttmp->table_element."_extrafields as e ON t.rowid=e.fk_object";  | 
                                                        |
| 8287 | 8287 | }  | 
                                                        
| 8288 | 8288 |  		if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8289 | 8289 |  			if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8290 | 8290 |  				$tmparray = explode('@', $objecttmp->ismultientitymanaged); | 
                                                        
| 8291 | - $sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];  | 
                                                        |
| 8291 | + $sql .= " INNER JOIN ".$this->db->prefix().$tmparray[1]." as parenttable ON parenttable.rowid = t.".$tmparray[0];  | 
                                                        |
| 8292 | 8292 | }  | 
                                                        
| 8293 | 8293 |  			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8294 | 8294 |  				if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8295 | - $sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";  | 
                                                        |
| 8295 | + $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";  | 
                                                        |
| 8296 | 8296 | }  | 
                                                        
| 8297 | 8297 | }  | 
                                                        
| 8298 | 8298 | }  | 
                                                        
@@ -8312,21 +8312,21 @@ discard block  | 
                                                    ||
| 8312 | 8312 | $sql .= " WHERE 1=1";  | 
                                                        
| 8313 | 8313 |  			if (isset($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8314 | 8314 |  				if ($objecttmp->ismultientitymanaged == 1) { | 
                                                        
| 8315 | -					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")"; | 
                                                        |
| 8315 | +					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; | 
                                                        |
| 8316 | 8316 | }  | 
                                                        
| 8317 | 8317 |  				if (!is_numeric($objecttmp->ismultientitymanaged)) { | 
                                                        
| 8318 | - $sql .= " AND parenttable.entity = t." . $tmparray[0];  | 
                                                        |
| 8318 | + $sql .= " AND parenttable.entity = t.".$tmparray[0];  | 
                                                        |
| 8319 | 8319 | }  | 
                                                        
| 8320 | 8320 |  				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) { | 
                                                        
| 8321 | 8321 |  					if ($objecttmp->element == 'societe') { | 
                                                        
| 8322 | - $sql .= " AND t.rowid = " . ((int) $user->socid);  | 
                                                        |
| 8322 | + $sql .= " AND t.rowid = ".((int) $user->socid);  | 
                                                        |
| 8323 | 8323 |  					} else { | 
                                                        
| 8324 | - $sql .= " AND t.fk_soc = " . ((int) $user->socid);  | 
                                                        |
| 8324 | + $sql .= " AND t.fk_soc = ".((int) $user->socid);  | 
                                                        |
| 8325 | 8325 | }  | 
                                                        
| 8326 | 8326 | }  | 
                                                        
| 8327 | 8327 |  				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') { | 
                                                        
| 8328 | 8328 |  					if (!$user->hasRight('societe', 'client', 'voir')) { | 
                                                        
| 8329 | - $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);  | 
                                                        |
| 8329 | + $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);  | 
                                                        |
| 8330 | 8330 | }  | 
                                                        
| 8331 | 8331 | }  | 
                                                        
| 8332 | 8332 | }  | 
                                                        
@@ -8338,7 +8338,7 @@ discard block  | 
                                                    ||
| 8338 | 8338 | $errormessage = '';  | 
                                                        
| 8339 | 8339 | $sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);  | 
                                                        
| 8340 | 8340 |  				if ($errormessage) { | 
                                                        
| 8341 | - return 'Error forging a SQL request from an universal criteria: ' . $errormessage;  | 
                                                        |
| 8341 | + return 'Error forging a SQL request from an universal criteria: '.$errormessage;  | 
                                                        |
| 8342 | 8342 | }  | 
                                                        
| 8343 | 8343 | }  | 
                                                        
| 8344 | 8344 | }  | 
                                                        
@@ -8350,7 +8350,7 @@ discard block  | 
                                                    ||
| 8350 | 8350 | $resql = $this->db->query($sql);  | 
                                                        
| 8351 | 8351 |  		if ($resql) { | 
                                                        
| 8352 | 8352 | // Construct $out and $outarray  | 
                                                        
| 8353 | - $out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";  | 
                                                        |
| 8353 | + $out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";  | 
                                                        |
| 8354 | 8354 | |
| 8355 | 8355 | // Warning: Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4  | 
                                                        
| 8356 | 8356 | $textifempty = ' ';  | 
                                                        
@@ -8364,7 +8364,7 @@ discard block  | 
                                                    ||
| 8364 | 8364 | }  | 
                                                        
| 8365 | 8365 | }  | 
                                                        
| 8366 | 8366 |  			if ($showempty) { | 
                                                        
| 8367 | - $out .= '<option value="-1">' . $textifempty . '</option>' . "\n";  | 
                                                        |
| 8367 | + $out .= '<option value="-1">'.$textifempty.'</option>'."\n";  | 
                                                        |
| 8368 | 8368 | }  | 
                                                        
| 8369 | 8369 | |
| 8370 | 8370 | $num = $this->db->num_rows($resql);  | 
                                                        
@@ -8387,9 +8387,9 @@ discard block  | 
                                                    ||
| 8387 | 8387 | }  | 
                                                        
| 8388 | 8388 |  					if (empty($outputmode)) { | 
                                                        
| 8389 | 8389 |  						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { | 
                                                        
| 8390 | - $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>';  | 
                                                        |
| 8390 | + $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>';  | 
                                                        |
| 8391 | 8391 |  						} else { | 
                                                        
| 8392 | - $out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';  | 
                                                        |
| 8392 | + $out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';  | 
                                                        |
| 8393 | 8393 | }  | 
                                                        
| 8394 | 8394 |  					} else { | 
                                                        
| 8395 | 8395 |  						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label)); | 
                                                        
@@ -8402,10 +8402,10 @@ discard block  | 
                                                    ||
| 8402 | 8402 | }  | 
                                                        
| 8403 | 8403 | }  | 
                                                        
| 8404 | 8404 | |
| 8405 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8405 | + $out .= '</select>'."\n";  | 
                                                        |
| 8406 | 8406 | |
| 8407 | 8407 |  			if (!$forcecombo) { | 
                                                        
| 8408 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8408 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8409 | 8409 | $out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));  | 
                                                        
| 8410 | 8410 | }  | 
                                                        
| 8411 | 8411 |  		} else { | 
                                                        
@@ -8469,8 +8469,8 @@ discard block  | 
                                                    ||
| 8469 | 8469 | }  | 
                                                        
| 8470 | 8470 | }  | 
                                                        
| 8471 | 8471 |  		$idname = str_replace(array('[', ']'), array('', ''), $htmlname); | 
                                                        
| 8472 | -		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"'; | 
                                                        |
| 8473 | -		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : ''); | 
                                                        |
| 8472 | +		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"'; | 
                                                        |
| 8473 | +		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : ''); | 
                                                        |
| 8474 | 8474 | $out .= '>'."\n";  | 
                                                        
| 8475 | 8475 | |
| 8476 | 8476 |  		if ($show_empty) { | 
                                                        
@@ -8481,7 +8481,7 @@ discard block  | 
                                                    ||
| 8481 | 8481 |  			if (!is_numeric($show_empty)) { | 
                                                        
| 8482 | 8482 | $textforempty = $show_empty;  | 
                                                        
| 8483 | 8483 | }  | 
                                                        
| 8484 | - $out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";  | 
                                                        |
| 8484 | + $out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";  | 
                                                        |
| 8485 | 8485 | }  | 
                                                        
| 8486 | 8486 |  		if (is_array($array)) { | 
                                                        
| 8487 | 8487 | // Translate  | 
                                                        
@@ -8506,7 +8506,7 @@ discard block  | 
                                                    ||
| 8506 | 8506 | $value = $tmpvalue['label'];  | 
                                                        
| 8507 | 8507 | //$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];  | 
                                                        
| 8508 | 8508 | $disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';  | 
                                                        
| 8509 | - $style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';  | 
                                                        |
| 8509 | + $style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';  | 
                                                        |
| 8510 | 8510 |  				} else { | 
                                                        
| 8511 | 8511 | $value = $tmpvalue;  | 
                                                        
| 8512 | 8512 | //$valuehtml = $tmpvalue;  | 
                                                        
@@ -8522,9 +8522,9 @@ discard block  | 
                                                    ||
| 8522 | 8522 | }  | 
                                                        
| 8523 | 8523 |  				if ($key_in_label) { | 
                                                        
| 8524 | 8524 |  					if (empty($nohtmlescape)) { | 
                                                        
| 8525 | - $selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8525 | + $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));  | 
                                                        |
| 8526 | 8526 |  					} else { | 
                                                        
| 8527 | - $selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8527 | + $selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);  | 
                                                        |
| 8528 | 8528 | }  | 
                                                        
| 8529 | 8529 |  				} else { | 
                                                        
| 8530 | 8530 |  					if (empty($nohtmlescape)) { | 
                                                        
@@ -8536,8 +8536,8 @@ discard block  | 
                                                    ||
| 8536 | 8536 | $selectOptionValue = ' ';  | 
                                                        
| 8537 | 8537 | }  | 
                                                        
| 8538 | 8538 | }  | 
                                                        
| 8539 | - $out .= '<option value="' . $key . '"';  | 
                                                        |
| 8540 | - $out .= $style . $disabled;  | 
                                                        |
| 8539 | + $out .= '<option value="'.$key.'"';  | 
                                                        |
| 8540 | + $out .= $style.$disabled;  | 
                                                        |
| 8541 | 8541 |  				if (is_array($id)) { | 
                                                        
| 8542 | 8542 |  					if (in_array($key, $id) && !$disabled) { | 
                                                        
| 8543 | 8543 | $out .= ' selected'; // To preselect a value  | 
                                                        
@@ -8549,7 +8549,7 @@ discard block  | 
                                                    ||
| 8549 | 8549 | }  | 
                                                        
| 8550 | 8550 | }  | 
                                                        
| 8551 | 8551 |  				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content. | 
                                                        
| 8552 | - $out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';  | 
                                                        |
| 8552 | + $out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';  | 
                                                        |
| 8553 | 8553 | }  | 
                                                        
| 8554 | 8554 | |
| 8555 | 8555 |  				if (is_array($tmpvalue)) { | 
                                                        
@@ -8568,7 +8568,7 @@ discard block  | 
                                                    ||
| 8568 | 8568 | // Add code for jquery to use multiselect  | 
                                                        
| 8569 | 8569 |  		if ($addjscombo && $jsbeautify) { | 
                                                        
| 8570 | 8570 | // Enhance with select2  | 
                                                        
| 8571 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 8571 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 8572 | 8572 | $out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);  | 
                                                        
| 8573 | 8573 | }  | 
                                                        
| 8574 | 8574 | |
@@ -8596,28 +8596,28 @@ discard block  | 
                                                    ||
| 8596 | 8596 | public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)  | 
                                                        
| 8597 | 8597 |  	{ | 
                                                        
| 8598 | 8598 | global $conf, $langs;  | 
                                                        
| 8599 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8599 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8600 | 8600 | |
| 8601 | 8601 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8602 | 8602 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8603 | 8603 | return '';  | 
                                                        
| 8604 | 8604 | }  | 
                                                        
| 8605 | 8605 | |
| 8606 | - $out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';  | 
                                                        |
| 8606 | + $out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';  | 
                                                        |
| 8607 | 8607 | |
| 8608 | 8608 | $outdelayed = '';  | 
                                                        
| 8609 | 8609 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8610 | 8610 | $tmpplugin = 'select2';  | 
                                                        
| 8611 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8612 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8611 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8612 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8613 | 8613 |  		    	$(document).ready(function () { | 
                                                        
| 8614 | 8614 | |
| 8615 | - ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '  | 
                                                        |
| 8615 | + ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'  | 
                                                        |
| 8616 | 8616 | |
| 8617 | -	                $(".' . $htmlname . '").select2({ | 
                                                        |
| 8617 | +	                $(".' . $htmlname.'").select2({ | 
                                                        |
| 8618 | 8618 |  				    	ajax: { | 
                                                        
| 8619 | 8619 | dir: "ltr",  | 
                                                        
| 8620 | - url: "' . $url . '",  | 
                                                        |
| 8620 | + url: "' . $url.'",  | 
                                                        |
| 8621 | 8621 | dataType: \'json\',  | 
                                                        
| 8622 | 8622 | delay: 250,  | 
                                                        
| 8623 | 8623 |  					    	data: function (params) { | 
                                                        
@@ -8644,9 +8644,9 @@ discard block  | 
                                                    ||
| 8644 | 8644 | },  | 
                                                        
| 8645 | 8645 | language: select2arrayoflanguage,  | 
                                                        
| 8646 | 8646 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8647 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8647 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8648 | 8648 |  				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8649 | - minimumInputLength: ' . ((int) $minimumInputLength) . ',  | 
                                                        |
| 8649 | + minimumInputLength: ' . ((int) $minimumInputLength).',  | 
                                                        |
| 8650 | 8650 |  				        formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8651 | 8651 | return escapeMarkup(result.text);  | 
                                                        
| 8652 | 8652 | },  | 
                                                        
@@ -8654,10 +8654,10 @@ discard block  | 
                                                    ||
| 8654 | 8654 | |
| 8655 | 8655 | ' . ($callurlonselect ? '  | 
                                                        
| 8656 | 8656 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8657 | -	                $(".' . $htmlname . '").change(function() { | 
                                                        |
| 8658 | -				    	var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8657 | +	                $(".' . $htmlname.'").change(function() { | 
                                                        |
| 8658 | +				    	var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8659 | 8659 |  	                	console.log("We select in selectArrayAjax the entry "+selected) | 
                                                        
| 8660 | -				        $(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8660 | +				        $(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8661 | 8661 |  	    			    $.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8662 | 8662 | if (key == selected)  | 
                                                        
| 8663 | 8663 |  	    			            { | 
                                                        
@@ -8665,7 +8665,7 @@ discard block  | 
                                                    ||
| 8665 | 8665 | location.assign(value.url);  | 
                                                        
| 8666 | 8666 | }  | 
                                                        
| 8667 | 8667 | });  | 
                                                        
| 8668 | - });' : '') . '  | 
                                                        |
| 8668 | + });' : '').'  | 
                                                        |
| 8669 | 8669 | |
| 8670 | 8670 | });  | 
                                                        
| 8671 | 8671 | </script>';  | 
                                                        
@@ -8701,14 +8701,14 @@ discard block  | 
                                                    ||
| 8701 | 8701 | public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')  | 
                                                        
| 8702 | 8702 |  	{ | 
                                                        
| 8703 | 8703 | global $conf, $langs;  | 
                                                        
| 8704 | - global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8704 | + global $delayedhtmlcontent; // Will be used later outside of this function  | 
                                                        |
| 8705 | 8705 | |
| 8706 | 8706 | // TODO Use an internal dolibarr component instead of select2  | 
                                                        
| 8707 | 8707 |  		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8708 | 8708 | return '';  | 
                                                        
| 8709 | 8709 | }  | 
                                                        
| 8710 | 8710 | |
| 8711 | - $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8711 | + $out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';  | 
                                                        |
| 8712 | 8712 | |
| 8713 | 8713 | $formattedarrayresult = array();  | 
                                                        
| 8714 | 8714 | |
@@ -8723,20 +8723,20 @@ discard block  | 
                                                    ||
| 8723 | 8723 | $outdelayed = '';  | 
                                                        
| 8724 | 8724 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 8725 | 8725 | $tmpplugin = 'select2';  | 
                                                        
| 8726 | - $outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->  | 
                                                        |
| 8727 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 8726 | + $outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->  | 
                                                        |
| 8727 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 8728 | 8728 |  				$(document).ready(function () { | 
                                                        
| 8729 | - var data = ' . json_encode($formattedarrayresult) . ';  | 
                                                        |
| 8729 | + var data = ' . json_encode($formattedarrayresult).';  | 
                                                        |
| 8730 | 8730 | |
| 8731 | - ' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '  | 
                                                        |
| 8731 | + ' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'  | 
                                                        |
| 8732 | 8732 | |
| 8733 | -					$(".' . $htmlname . '").select2({ | 
                                                        |
| 8733 | +					$(".' . $htmlname.'").select2({ | 
                                                        |
| 8734 | 8734 | data: data,  | 
                                                        
| 8735 | 8735 | language: select2arrayoflanguage,  | 
                                                        
| 8736 | 8736 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag */  | 
                                                        
| 8737 | - placeholder: "' . dol_escape_js($placeholder) . '",  | 
                                                        |
| 8737 | + placeholder: "' . dol_escape_js($placeholder).'",  | 
                                                        |
| 8738 | 8738 |  						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work | 
                                                        
| 8739 | - minimumInputLength: ' . $minimumInputLength . ',  | 
                                                        |
| 8739 | + minimumInputLength: ' . $minimumInputLength.',  | 
                                                        |
| 8740 | 8740 |  						formatResult: function (result, container, query, escapeMarkup) { | 
                                                        
| 8741 | 8741 | return escapeMarkup(result.text);  | 
                                                        
| 8742 | 8742 | },  | 
                                                        
@@ -8775,11 +8775,11 @@ discard block  | 
                                                    ||
| 8775 | 8775 | |
| 8776 | 8776 | ' . ($callurlonselect ? '  | 
                                                        
| 8777 | 8777 | /* Code to execute a GET when we select a value */  | 
                                                        
| 8778 | -					$(".' . $htmlname . '").change(function() { | 
                                                        |
| 8779 | -						var selected = $(".' . $htmlname . '").val(); | 
                                                        |
| 8778 | +					$(".' . $htmlname.'").change(function() { | 
                                                        |
| 8779 | +						var selected = $(".' . $htmlname.'").val(); | 
                                                        |
| 8780 | 8780 |  						console.log("We select "+selected) | 
                                                        
| 8781 | 8781 | |
| 8782 | -						$(".' . $htmlname . '").val("");  /* reset visible combo value */ | 
                                                        |
| 8782 | +						$(".' . $htmlname.'").val("");  /* reset visible combo value */ | 
                                                        |
| 8783 | 8783 |  						$.each( saveRemoteData, function( key, value ) { | 
                                                        
| 8784 | 8784 | if (key == selected)  | 
                                                        
| 8785 | 8785 |  							{ | 
                                                        
@@ -8787,7 +8787,7 @@ discard block  | 
                                                    ||
| 8787 | 8787 | location.assign(value.url);  | 
                                                        
| 8788 | 8788 | }  | 
                                                        
| 8789 | 8789 | });  | 
                                                        
| 8790 | - });' : '') . '  | 
                                                        |
| 8790 | + });' : '').'  | 
                                                        |
| 8791 | 8791 | |
| 8792 | 8792 | });  | 
                                                        
| 8793 | 8793 | </script>';  | 
                                                        
@@ -8836,7 +8836,7 @@ discard block  | 
                                                    ||
| 8836 | 8836 | $useenhancedmultiselect = 0;  | 
                                                        
| 8837 | 8837 |  		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { | 
                                                        
| 8838 | 8838 |  			if ($addjscombo) { | 
                                                        
| 8839 | - $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 8839 | + $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.  | 
                                                        |
| 8840 | 8840 | }  | 
                                                        
| 8841 | 8841 | }  | 
                                                        
| 8842 | 8842 | |
@@ -8845,7 +8845,7 @@ discard block  | 
                                                    ||
| 8845 | 8845 | // submitted to nothing.  | 
                                                        
| 8846 | 8846 | $out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';  | 
                                                        
| 8847 | 8847 | // Output select component  | 
                                                        
| 8848 | -		$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"; | 
                                                        |
| 8848 | +		$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"; | 
                                                        |
| 8849 | 8849 |  		if (is_array($array) && !empty($array)) { | 
                                                        
| 8850 | 8850 |  			if ($value_as_key) { | 
                                                        
| 8851 | 8851 | $array = array_combine($array, $array);  | 
                                                        
@@ -8866,33 +8866,33 @@ discard block  | 
                                                    ||
| 8866 | 8866 | $tmplabelhtml = empty($value['labelhtml']) ? '' : $value['labelhtml'];  | 
                                                        
| 8867 | 8867 | }  | 
                                                        
| 8868 | 8868 | $newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);  | 
                                                        
| 8869 | - $newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);  | 
                                                        |
| 8869 | + $newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);  | 
                                                        |
| 8870 | 8870 | |
| 8871 | - $out .= '<option value="' . $tmpkey . '"';  | 
                                                        |
| 8871 | + $out .= '<option value="'.$tmpkey.'"';  | 
                                                        |
| 8872 | 8872 |  					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) { | 
                                                        
| 8873 | 8873 | $out .= ' selected';  | 
                                                        
| 8874 | 8874 | }  | 
                                                        
| 8875 | 8875 |  					if (!empty($tmplabelhtml)) { | 
                                                        
| 8876 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 8876 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 8877 | 8877 |  					} else { | 
                                                        
| 8878 | -						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval; | 
                                                        |
| 8879 | - $out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';  | 
                                                        |
| 8878 | +						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval; | 
                                                        |
| 8879 | + $out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';  | 
                                                        |
| 8880 | 8880 | }  | 
                                                        
| 8881 | 8881 | $out .= '>';  | 
                                                        
| 8882 | 8882 | $out .= dol_htmlentitiesbr($newval);  | 
                                                        
| 8883 | - $out .= '</option>' . "\n";  | 
                                                        |
| 8883 | + $out .= '</option>'."\n";  | 
                                                        |
| 8884 | 8884 | }  | 
                                                        
| 8885 | 8885 | }  | 
                                                        
| 8886 | 8886 | }  | 
                                                        
| 8887 | - $out .= '</select>' . "\n";  | 
                                                        |
| 8887 | + $out .= '</select>'."\n";  | 
                                                        |
| 8888 | 8888 | |
| 8889 | 8889 | // Add code for jquery to use multiselect  | 
                                                        
| 8890 | 8890 |  		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { | 
                                                        
| 8891 | - $out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';  | 
                                                        |
| 8892 | - $out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";  | 
                                                        |
| 8891 | + $out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';  | 
                                                        |
| 8892 | + $out .= "\n".'<script nonce="'.getNonce().'">'."\n";  | 
                                                        |
| 8893 | 8893 |  			if ($addjscombo == 1) { | 
                                                        
| 8894 | 8894 |  				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; | 
                                                        
| 8895 | -				$out .= 'function formatResult(record, container) {' . "\n"; | 
                                                        |
| 8895 | +				$out .= 'function formatResult(record, container) {'."\n"; | 
                                                        |
| 8896 | 8896 | // If property data-html set, we decode html entities and use this.  | 
                                                        
| 8897 | 8897 | // Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.  | 
                                                        
| 8898 | 8898 |  				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {'; | 
                                                        
@@ -8900,26 +8900,26 @@ discard block  | 
                                                    ||
| 8900 | 8900 |  				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));'; | 
                                                        
| 8901 | 8901 | $out .= ' }'."\n";  | 
                                                        
| 8902 | 8902 | $out .= ' return record.text;';  | 
                                                        
| 8903 | - $out .= '}' . "\n";  | 
                                                        |
| 8904 | -				$out .= 'function formatSelection(record) {' . "\n"; | 
                                                        |
| 8903 | + $out .= '}'."\n";  | 
                                                        |
| 8904 | +				$out .= 'function formatSelection(record) {'."\n"; | 
                                                        |
| 8905 | 8905 |  				if ($elemtype == 'category') { | 
                                                        
| 8906 | - $out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 8906 | + $out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';  | 
                                                        |
| 8907 | 8907 |  				} else { | 
                                                        
| 8908 | 8908 | $out .= 'return record.text;';  | 
                                                        
| 8909 | 8909 | }  | 
                                                        
| 8910 | - $out .= '}' . "\n";  | 
                                                        |
| 8910 | + $out .= '}'."\n";  | 
                                                        |
| 8911 | 8911 |  				$out .= '$(document).ready(function () { | 
                                                        
| 8912 | -							$(\'#' . $htmlname . '\').' . $tmpplugin . '({'; | 
                                                        |
| 8912 | +							$(\'#' . $htmlname.'\').'.$tmpplugin.'({'; | 
                                                        |
| 8913 | 8913 |  				if ($placeholder) { | 
                                                        
| 8914 | 8914 | $out .= '  | 
                                                        
| 8915 | 8915 |  								placeholder: { | 
                                                        
| 8916 | 8916 | id: \'-1\',  | 
                                                        
| 8917 | - text: \'' . dol_escape_js($placeholder) . '\'  | 
                                                        |
| 8917 | + text: \'' . dol_escape_js($placeholder).'\'  | 
                                                        |
| 8918 | 8918 | },';  | 
                                                        
| 8919 | 8919 | }  | 
                                                        
| 8920 | 8920 | $out .= ' dir: \'ltr\',  | 
                                                        
| 8921 | 8921 | containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */  | 
                                                        
| 8922 | - dropdownCssClass: \'' . $morecss . '\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        |
| 8922 | + dropdownCssClass: \'' . $morecss.'\', /* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */  | 
                                                        |
| 8923 | 8923 | // Specify format function for dropdown item  | 
                                                        
| 8924 | 8924 | formatResult: formatResult,  | 
                                                        
| 8925 | 8925 | templateResult: formatResult, /* For 4.0 */  | 
                                                        
@@ -8931,21 +8931,21 @@ discard block  | 
                                                    ||
| 8931 | 8931 | |
| 8932 | 8932 | /* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set  | 
                                                        
| 8933 | 8933 | the size only if component is not hidden by default on load */  | 
                                                        
| 8934 | - $(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');  | 
                                                        |
| 8934 | + $(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');  | 
                                                        |
| 8935 | 8935 | });' . "\n";  | 
                                                        
| 8936 | 8936 |  			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) { | 
                                                        
| 8937 | 8937 | // Add other js lib  | 
                                                        
| 8938 | 8938 | // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin  | 
                                                        
| 8939 | 8939 | // ...  | 
                                                        
| 8940 | - $out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';  | 
                                                        |
| 8940 | + $out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';  | 
                                                        |
| 8941 | 8941 |  				$out .= '$(document).ready(function () { | 
                                                        
| 8942 | -							$(\'#' . $htmlname . '\').multiSelect({ | 
                                                        |
| 8942 | +							$(\'#' . $htmlname.'\').multiSelect({ | 
                                                        |
| 8943 | 8943 | containerHTML: \'<div class="multi-select-container">\',  | 
                                                        
| 8944 | 8944 | menuHTML: \'<div class="multi-select-menu">\',  | 
                                                        
| 8945 | - buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',  | 
                                                        |
| 8945 | + buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',  | 
                                                        |
| 8946 | 8946 | menuItemHTML: \'<label class="multi-select-menuitem">\',  | 
                                                        
| 8947 | 8947 | activeClass: \'multi-select-container--open\',  | 
                                                        
| 8948 | - noneText: \'' . $placeholder . '\'  | 
                                                        |
| 8948 | + noneText: \'' . $placeholder.'\'  | 
                                                        |
| 8949 | 8949 | });  | 
                                                        
| 8950 | 8950 | })';  | 
                                                        
| 8951 | 8951 | }  | 
                                                        
@@ -8977,7 +8977,7 @@ discard block  | 
                                                    ||
| 8977 | 8977 | return '';  | 
                                                        
| 8978 | 8978 | }  | 
                                                        
| 8979 | 8979 | |
| 8980 | - $tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show  | 
                                                        |
| 8980 | + $tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show  | 
                                                        |
| 8981 | 8981 | |
| 8982 | 8982 |  		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user | 
                                                        
| 8983 | 8983 |  			$tmparray = explode(',', $user->conf->$tmpvar); | 
                                                        
@@ -9020,19 +9020,19 @@ discard block  | 
                                                    ||
| 9020 | 9020 | }  | 
                                                        
| 9021 | 9021 | |
| 9022 | 9022 | // Note: $val['checked'] <> 0 means we must show the field into the combo list  | 
                                                        
| 9023 | - $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';  | 
                                                        |
| 9024 | - $listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');  | 
                                                        |
| 9023 | + $listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';  | 
                                                        |
| 9024 | + $listcheckedstring .= (empty($val['checked']) ? '' : $key.',');  | 
                                                        |
| 9025 | 9025 | }  | 
                                                        
| 9026 | 9026 | }  | 
                                                        
| 9027 | 9027 | |
| 9028 | - $out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->  | 
                                                        |
| 9028 | + $out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->  | 
                                                        |
| 9029 | 9029 | |
| 9030 | 9030 | <dl class="dropdown">  | 
                                                        
| 9031 | 9031 | <dt>  | 
                                                        
| 9032 | - <a href="#' . $htmlname . '">  | 
                                                        |
| 9033 | -              ' . img_picto('', 'list') . ' | 
                                                        |
| 9032 | + <a href="#' . $htmlname.'">  | 
                                                        |
| 9033 | +              ' . img_picto('', 'list').' | 
                                                        |
| 9034 | 9034 | </a>  | 
                                                        
| 9035 | - <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">  | 
                                                        |
| 9035 | + <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">  | 
                                                        |
| 9036 | 9036 | </dt>  | 
                                                        
| 9037 | 9037 | <dd class="dropdowndd">  | 
                                                        
| 9038 | 9038 | <div class="multiselectcheckbox'.$htmlname.'">  | 
                                                        
@@ -9044,19 +9044,19 @@ discard block  | 
                                                    ||
| 9044 | 9044 | </dd>  | 
                                                        
| 9045 | 9045 | </dl>  | 
                                                        
| 9046 | 9046 | |
| 9047 | - <script nonce="' . getNonce() . '" type="text/javascript">  | 
                                                        |
| 9047 | + <script nonce="' . getNonce().'" type="text/javascript">  | 
                                                        |
| 9048 | 9048 |            jQuery(document).ready(function () { | 
                                                        
| 9049 | -              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9049 | +              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () { | 
                                                        |
| 9050 | 9050 |                    console.log("A new field was added/removed, we edit field input[name=formfilteraction]"); | 
                                                        
| 9051 | 9051 | |
| 9052 | 9052 |                    $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST | 
                                                        
| 9053 | 9053 | |
| 9054 | 9054 | var title = $(this).val() + ",";  | 
                                                        
| 9055 | 9055 |                    if ($(this).is(\':checked\')) { | 
                                                        
| 9056 | - $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());  | 
                                                        |
| 9056 | + $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());  | 
                                                        |
| 9057 | 9057 | }  | 
                                                        
| 9058 | 9058 |                    else { | 
                                                        
| 9059 | - $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )  | 
                                                        |
| 9059 | + $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )  | 
                                                        |
| 9060 | 9060 | }  | 
                                                        
| 9061 | 9061 | // Now, we submit page  | 
                                                        
| 9062 | 9062 | //$(this).parents(\'form:first\').submit();  | 
                                                        
@@ -9087,7 +9087,7 @@ discard block  | 
                                                    ||
| 9087 | 9087 | */  | 
                                                        
| 9088 | 9088 | public function showCategories($id, $type, $rendermode = 0, $nolink = 0)  | 
                                                        
| 9089 | 9089 |  	{ | 
                                                        
| 9090 | - include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';  | 
                                                        |
| 9090 | + include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';  | 
                                                        |
| 9091 | 9091 | |
| 9092 | 9092 | $cat = new Categorie($this->db);  | 
                                                        
| 9093 | 9093 | $categories = $cat->containing($id, $type);  | 
                                                        
@@ -9097,10 +9097,10 @@ discard block  | 
                                                    ||
| 9097 | 9097 |  			foreach ($categories as $c) { | 
                                                        
| 9098 | 9098 |  				$ways = $c->print_all_ways(' >> ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text | 
                                                        
| 9099 | 9099 |  				foreach ($ways as $way) { | 
                                                        
| 9100 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';  | 
                                                        |
| 9100 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';  | 
                                                        |
| 9101 | 9101 | }  | 
                                                        
| 9102 | 9102 | }  | 
                                                        
| 9103 | -			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; | 
                                                        |
| 9103 | +			return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; | 
                                                        |
| 9104 | 9104 | }  | 
                                                        
| 9105 | 9105 | |
| 9106 | 9106 |  		if ($rendermode == 0) { | 
                                                        
@@ -9148,15 +9148,15 @@ discard block  | 
                                                    ||
| 9148 | 9148 | |
| 9149 | 9149 | |
| 9150 | 9150 | print '<div class="div-table-responsive-no-min">';  | 
                                                        
| 9151 | - print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '" data-elementid="' . $object->id . '" >';  | 
                                                        |
| 9151 | + print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'" data-elementid="'.$object->id.'" >';  | 
                                                        |
| 9152 | 9152 | |
| 9153 | 9153 | print '<tr class="liste_titre">';  | 
                                                        
| 9154 | -			print '<td>' . $langs->trans("Type") . '</td>'; | 
                                                        |
| 9155 | -			print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9154 | +			print '<td>'.$langs->trans("Type").'</td>'; | 
                                                        |
| 9155 | +			print '<td>'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9156 | 9156 | print '<td class="center"></td>';  | 
                                                        
| 9157 | -			print '<td class="center">' . $langs->trans("Date") . '</td>'; | 
                                                        |
| 9158 | -			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9159 | -			print '<td class="right">' . $langs->trans("Status") . '</td>'; | 
                                                        |
| 9157 | +			print '<td class="center">'.$langs->trans("Date").'</td>'; | 
                                                        |
| 9158 | +			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9159 | +			print '<td class="right">'.$langs->trans("Status").'</td>'; | 
                                                        |
| 9160 | 9160 | print '<td></td>';  | 
                                                        
| 9161 | 9161 | print '</tr>';  | 
                                                        
| 9162 | 9162 | |
@@ -9175,13 +9175,13 @@ discard block  | 
                                                    ||
| 9175 | 9175 |  				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) { | 
                                                        
| 9176 | 9176 | $element = $regs[1];  | 
                                                        
| 9177 | 9177 | $subelement = $regs[2];  | 
                                                        
| 9178 | - $tplpath = $element . '/' . $subelement;  | 
                                                        |
| 9178 | + $tplpath = $element.'/'.$subelement;  | 
                                                        |
| 9179 | 9179 | }  | 
                                                        
| 9180 | 9180 | $tplname = 'linkedobjectblock';  | 
                                                        
| 9181 | 9181 | |
| 9182 | 9182 | // To work with non standard path  | 
                                                        
| 9183 | 9183 |  				if ($objecttype == 'facture') { | 
                                                        
| 9184 | - $tplpath = 'compta/' . $element;  | 
                                                        |
| 9184 | + $tplpath = 'compta/'.$element;  | 
                                                        |
| 9185 | 9185 |  					if (!isModEnabled('invoice')) { | 
                                                        
| 9186 | 9186 | continue; // Do not show if module disabled  | 
                                                        
| 9187 | 9187 | }  | 
                                                        
@@ -9192,7 +9192,7 @@ discard block  | 
                                                    ||
| 9192 | 9192 | continue; // Do not show if module disabled  | 
                                                        
| 9193 | 9193 | }  | 
                                                        
| 9194 | 9194 |  				} elseif ($objecttype == 'propal') { | 
                                                        
| 9195 | - $tplpath = 'comm/' . $element;  | 
                                                        |
| 9195 | + $tplpath = 'comm/'.$element;  | 
                                                        |
| 9196 | 9196 |  					if (!isModEnabled('propal')) { | 
                                                        
| 9197 | 9197 | continue; // Do not show if module disabled  | 
                                                        
| 9198 | 9198 | }  | 
                                                        
@@ -9243,7 +9243,7 @@ discard block  | 
                                                    ||
| 9243 | 9243 | $linkedObjectBlock = $objects;  | 
                                                        
| 9244 | 9244 | |
| 9245 | 9245 | // Output template part (modules that overwrite templates must declare this into descriptor)  | 
                                                        
| 9246 | -				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl')); | 
                                                        |
| 9246 | +				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); | 
                                                        |
| 9247 | 9247 |  				foreach ($dirtpls as $reldir) { | 
                                                        
| 9248 | 9248 | $reldir = rtrim($reldir, '/');  | 
                                                        
| 9249 | 9249 |  					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after | 
                                                        
@@ -9251,7 +9251,7 @@ discard block  | 
                                                    ||
| 9251 | 9251 | $noMoreLinkedObjectBlockAfter = 1;  | 
                                                        
| 9252 | 9252 | }  | 
                                                        
| 9253 | 9253 | |
| 9254 | - $res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');  | 
                                                        |
| 9254 | + $res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');  | 
                                                        |
| 9255 | 9255 |  					if ($res) { | 
                                                        
| 9256 | 9256 | $nboftypesoutput++;  | 
                                                        
| 9257 | 9257 | break;  | 
                                                        
@@ -9260,7 +9260,7 @@ discard block  | 
                                                    ||
| 9260 | 9260 | }  | 
                                                        
| 9261 | 9261 | |
| 9262 | 9262 |  			if (!$nboftypesoutput) { | 
                                                        
| 9263 | -				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>'; | 
                                                        |
| 9263 | +				print '<tr><td class="impair" colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; | 
                                                        |
| 9264 | 9264 | }  | 
                                                        
| 9265 | 9265 | |
| 9266 | 9266 | print '</table>';  | 
                                                        
@@ -9300,14 +9300,14 @@ discard block  | 
                                                    ||
| 9300 | 9300 |  		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) { | 
                                                        
| 9301 | 9301 | $listofidcompanytoscan = $object->thirdparty->id;  | 
                                                        
| 9302 | 9302 |  			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) { | 
                                                        
| 9303 | - $listofidcompanytoscan .= ',' . $object->thirdparty->parent;  | 
                                                        |
| 9303 | + $listofidcompanytoscan .= ','.$object->thirdparty->parent;  | 
                                                        |
| 9304 | 9304 | }  | 
                                                        
| 9305 | 9305 |  			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) { | 
                                                        
| 9306 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 9306 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 9307 | 9307 | $tmpproject = new Project($this->db);  | 
                                                        
| 9308 | 9308 | $tmpproject->fetch($object->fk_project);  | 
                                                        
| 9309 | 9309 |  				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) { | 
                                                        
| 9310 | - $listofidcompanytoscan .= ',' . $tmpproject->socid;  | 
                                                        |
| 9310 | + $listofidcompanytoscan .= ','.$tmpproject->socid;  | 
                                                        |
| 9311 | 9311 | }  | 
                                                        
| 9312 | 9312 | unset($tmpproject);  | 
                                                        
| 9313 | 9313 | }  | 
                                                        
@@ -9317,63 +9317,63 @@ discard block  | 
                                                    ||
| 9317 | 9317 |  					'enabled' => isModEnabled('propal'), | 
                                                        
| 9318 | 9318 | 'perms' => 1,  | 
                                                        
| 9319 | 9319 | 'label' => 'LinkToProposal',  | 
                                                        
| 9320 | -					'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') . ')'), | 
                                                        |
| 9320 | +					'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').')'), | 
                                                        |
| 9321 | 9321 | 'shipping' => array(  | 
                                                        
| 9322 | 9322 |  					'enabled' => isModEnabled('shipping'), | 
                                                        
| 9323 | 9323 | 'perms' => 1,  | 
                                                        
| 9324 | 9324 | 'label' => 'LinkToExpedition',  | 
                                                        
| 9325 | -					'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') . ')'), | 
                                                        |
| 9325 | +					'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').')'), | 
                                                        |
| 9326 | 9326 | 'order' => array(  | 
                                                        
| 9327 | 9327 |  					'enabled' => isModEnabled('order'), | 
                                                        
| 9328 | 9328 | 'perms' => 1,  | 
                                                        
| 9329 | 9329 | 'label' => 'LinkToOrder',  | 
                                                        
| 9330 | -					'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') . ')'), | 
                                                        |
| 9330 | +					'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').')'), | 
                                                        |
| 9331 | 9331 | 'invoice' => array(  | 
                                                        
| 9332 | 9332 |  					'enabled' => isModEnabled('invoice'), | 
                                                        
| 9333 | 9333 | 'perms' => 1,  | 
                                                        
| 9334 | 9334 | 'label' => 'LinkToInvoice',  | 
                                                        
| 9335 | -					'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') . ')'), | 
                                                        |
| 9335 | +					'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').')'), | 
                                                        |
| 9336 | 9336 | 'invoice_template' => array(  | 
                                                        
| 9337 | 9337 |  					'enabled' => isModEnabled('invoice'), | 
                                                        
| 9338 | 9338 | 'perms' => 1,  | 
                                                        
| 9339 | 9339 | 'label' => 'LinkToTemplateInvoice',  | 
                                                        
| 9340 | -					'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') . ')'), | 
                                                        |
| 9340 | +					'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').')'), | 
                                                        |
| 9341 | 9341 | 'contrat' => array(  | 
                                                        
| 9342 | 9342 |  					'enabled' => isModEnabled('contract'), | 
                                                        
| 9343 | 9343 | 'perms' => 1,  | 
                                                        
| 9344 | 9344 | 'label' => 'LinkToContract',  | 
                                                        
| 9345 | 9345 | '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  | 
                                                        
| 9346 | -							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' | 
                                                        |
| 9346 | +							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' | 
                                                        |
| 9347 | 9347 | ),  | 
                                                        
| 9348 | 9348 | 'fichinter' => array(  | 
                                                        
| 9349 | 9349 |  					'enabled' => isModEnabled('intervention'), | 
                                                        
| 9350 | 9350 | 'perms' => 1,  | 
                                                        
| 9351 | 9351 | 'label' => 'LinkToIntervention',  | 
                                                        
| 9352 | -					'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') . ')'), | 
                                                        |
| 9352 | +					'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').')'), | 
                                                        |
| 9353 | 9353 | 'supplier_proposal' => array(  | 
                                                        
| 9354 | 9354 |  					'enabled' => isModEnabled('supplier_proposal'), | 
                                                        
| 9355 | 9355 | 'perms' => 1,  | 
                                                        
| 9356 | 9356 | 'label' => 'LinkToSupplierProposal',  | 
                                                        
| 9357 | -					'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') . ')'), | 
                                                        |
| 9357 | +					'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').')'), | 
                                                        |
| 9358 | 9358 | 'order_supplier' => array(  | 
                                                        
| 9359 | 9359 |  					'enabled' => isModEnabled("supplier_order"), | 
                                                        
| 9360 | 9360 | 'perms' => 1,  | 
                                                        
| 9361 | 9361 | 'label' => 'LinkToSupplierOrder',  | 
                                                        
| 9362 | -					'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') . ')'), | 
                                                        |
| 9362 | +					'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').')'), | 
                                                        |
| 9363 | 9363 | 'invoice_supplier' => array(  | 
                                                        
| 9364 | 9364 |  					'enabled' => isModEnabled("supplier_invoice"), | 
                                                        
| 9365 | 9365 | 'perms' => 1, 'label' => 'LinkToSupplierInvoice',  | 
                                                        
| 9366 | -					'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') . ')'), | 
                                                        |
| 9366 | +					'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').')'), | 
                                                        |
| 9367 | 9367 | 'ticket' => array(  | 
                                                        
| 9368 | 9368 |  					'enabled' => isModEnabled('ticket'), | 
                                                        
| 9369 | 9369 | 'perms' => 1,  | 
                                                        
| 9370 | 9370 | 'label' => 'LinkToTicket',  | 
                                                        
| 9371 | -					'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') . ')'), | 
                                                        |
| 9371 | +					'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').')'), | 
                                                        |
| 9372 | 9372 | 'mo' => array(  | 
                                                        
| 9373 | 9373 |  					'enabled' => isModEnabled('mrp'), | 
                                                        
| 9374 | 9374 | 'perms' => 1,  | 
                                                        
| 9375 | 9375 | 'label' => 'LinkToMo',  | 
                                                        
| 9376 | -					'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') . ')') | 
                                                        |
| 9376 | +					'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').')') | 
                                                        |
| 9377 | 9377 | );  | 
                                                        
| 9378 | 9378 | }  | 
                                                        
| 9379 | 9379 | |
@@ -9409,22 +9409,22 @@ discard block  | 
                                                    ||
| 9409 | 9409 | }  | 
                                                        
| 9410 | 9410 | |
| 9411 | 9411 |  			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) { | 
                                                        
| 9412 | - print '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';  | 
                                                        |
| 9412 | + print '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';  | 
                                                        |
| 9413 | 9413 | |
| 9414 | 9414 |  				if (getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9415 | 9415 | print '<br>'."\n";  | 
                                                        
| 9416 | 9416 | print '<!-- form to add a link from anywhere -->'."\n";  | 
                                                        
| 9417 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';  | 
                                                        |
| 9418 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9417 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';  | 
                                                        |
| 9418 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9419 | 9419 | print '<input type="hidden" name="action" value="addlinkbyref">';  | 
                                                        
| 9420 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9421 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9420 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9421 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9422 | 9422 | print '<table class="noborder">';  | 
                                                        
| 9423 | 9423 | print '<tr>';  | 
                                                        
| 9424 | 9424 |  					//print '<td>' . $langs->trans("Ref") . '</td>'; | 
                                                        
| 9425 | -					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '"> '; | 
                                                        |
| 9426 | -					print '<input type="submit" class="button small valignmiddle" value="' . $langs->trans('ToLink') . '"> '; | 
                                                        |
| 9427 | -					print '<input type="submit" class="button small" name="cancel" value="' . $langs->trans('Cancel') . '"></td>'; | 
                                                        |
| 9425 | +					print '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'"> '; | 
                                                        |
| 9426 | +					print '<input type="submit" class="button small valignmiddle" value="'.$langs->trans('ToLink').'"> '; | 
                                                        |
| 9427 | +					print '<input type="submit" class="button small" name="cancel" value="'.$langs->trans('Cancel').'"></td>'; | 
                                                        |
| 9428 | 9428 | print '</tr>';  | 
                                                        
| 9429 | 9429 | print '</table>';  | 
                                                        
| 9430 | 9430 | print '</form>';  | 
                                                        
@@ -9439,48 +9439,48 @@ discard block  | 
                                                    ||
| 9439 | 9439 | |
| 9440 | 9440 | print '<br>';  | 
                                                        
| 9441 | 9441 | print '<!-- form to add a link from object to same thirdparty -->'."\n";  | 
                                                        
| 9442 | - print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';  | 
                                                        |
| 9442 | + print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';  | 
                                                        |
| 9443 | 9443 | print '<input type="hidden" name="action" value="addlink">';  | 
                                                        
| 9444 | - print '<input type="hidden" name="token" value="' . newToken() . '">';  | 
                                                        |
| 9445 | - print '<input type="hidden" name="id" value="' . $object->id . '">';  | 
                                                        |
| 9446 | - print '<input type="hidden" name="addlink" value="' . $key . '">';  | 
                                                        |
| 9444 | + print '<input type="hidden" name="token" value="'.newToken().'">';  | 
                                                        |
| 9445 | + print '<input type="hidden" name="id" value="'.$object->id.'">';  | 
                                                        |
| 9446 | + print '<input type="hidden" name="addlink" value="'.$key.'">';  | 
                                                        |
| 9447 | 9447 | print '<table class="noborder">';  | 
                                                        
| 9448 | 9448 | print '<tr class="liste_titre">';  | 
                                                        
| 9449 | 9449 | print '<td class="nowrap"></td>';  | 
                                                        
| 9450 | -					print '<td class="center">' . $langs->trans("Ref") . '</td>'; | 
                                                        |
| 9451 | -					print '<td class="left">' . $langs->trans("RefCustomer") . '</td>'; | 
                                                        |
| 9452 | -					print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>'; | 
                                                        |
| 9453 | -					print '<td class="left">' . $langs->trans("Company") . '</td>'; | 
                                                        |
| 9450 | +					print '<td class="center">'.$langs->trans("Ref").'</td>'; | 
                                                        |
| 9451 | +					print '<td class="left">'.$langs->trans("RefCustomer").'</td>'; | 
                                                        |
| 9452 | +					print '<td class="right">'.$langs->trans("AmountHTShort").'</td>'; | 
                                                        |
| 9453 | +					print '<td class="left">'.$langs->trans("Company").'</td>'; | 
                                                        |
| 9454 | 9454 | print '</tr>';  | 
                                                        
| 9455 | 9455 |  					while ($i < $num) { | 
                                                        
| 9456 | 9456 | $objp = $this->db->fetch_object($resqllist);  | 
                                                        
| 9457 | 9457 | |
| 9458 | 9458 | print '<tr class="oddeven">';  | 
                                                        
| 9459 | 9459 | print '<td class="left">';  | 
                                                        
| 9460 | - print '<input type="radio" name="idtolinkto" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';  | 
                                                        |
| 9460 | + print '<input type="radio" name="idtolinkto" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';  | 
                                                        |
| 9461 | 9461 | print '</td>';  | 
                                                        
| 9462 | - print '<td class="center"><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';  | 
                                                        |
| 9463 | - print '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';  | 
                                                        |
| 9462 | + print '<td class="center"><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';  | 
                                                        |
| 9463 | + print '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';  | 
                                                        |
| 9464 | 9464 | print '<td class="right">';  | 
                                                        
| 9465 | 9465 |  						if ($possiblelink['label'] == 'LinkToContract') { | 
                                                        
| 9466 | 9466 | $form = new Form($this->db);  | 
                                                        
| 9467 | -							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' '; | 
                                                        |
| 9467 | +							print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' '; | 
                                                        |
| 9468 | 9468 | }  | 
                                                        
| 9469 | - print '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';  | 
                                                        |
| 9469 | + print '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';  | 
                                                        |
| 9470 | 9470 | print '</td>';  | 
                                                        
| 9471 | - print '<td>' . $objp->name . '</td>';  | 
                                                        |
| 9471 | + print '<td>'.$objp->name.'</td>';  | 
                                                        |
| 9472 | 9472 | print '</tr>';  | 
                                                        
| 9473 | 9473 | $i++;  | 
                                                        
| 9474 | 9474 | }  | 
                                                        
| 9475 | 9475 | print '</table>';  | 
                                                        
| 9476 | 9476 | print '<div class="center">';  | 
                                                        
| 9477 | 9477 |  					if ($num) { | 
                                                        
| 9478 | -						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="' . $langs->trans('ToLink') . '">'; | 
                                                        |
| 9478 | +						print '<input type="submit" class="button valignmiddle marginleftonly marginrightonly small" value="'.$langs->trans('ToLink').'">'; | 
                                                        |
| 9479 | 9479 | }  | 
                                                        
| 9480 | 9480 |  					if (empty($conf->use_javascript_ajax)) { | 
                                                        
| 9481 | -						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; | 
                                                        |
| 9481 | +						print '<input type="submit" class="button button-cancel marginleftonly marginrightonly small" name="cancel" value="'.$langs->trans("Cancel").'"></div>'; | 
                                                        |
| 9482 | 9482 |  					} else { | 
                                                        
| 9483 | -						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>'; | 
                                                        |
| 9483 | +						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>'; | 
                                                        |
| 9484 | 9484 | }  | 
                                                        
| 9485 | 9485 | print '</form>';  | 
                                                        
| 9486 | 9486 | $this->db->free($resqllist);  | 
                                                        
@@ -9491,10 +9491,10 @@ discard block  | 
                                                    ||
| 9491 | 9491 | |
| 9492 | 9492 | //$linktoelem.=($linktoelem?'   ':'');  | 
                                                        
| 9493 | 9493 |  				if ($num > 0 || getDolGlobalString('MAIN_LINK_BY_REF_IN_LINKTO')) { | 
                                                        
| 9494 | -					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>'; | 
                                                        |
| 9494 | +					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>'; | 
                                                        |
| 9495 | 9495 | // } else $linktoelem.=$langs->trans($possiblelink['label']);  | 
                                                        
| 9496 | 9496 |  				} else { | 
                                                        
| 9497 | - $linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';  | 
                                                        |
| 9497 | + $linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';  | 
                                                        |
| 9498 | 9498 | }  | 
                                                        
| 9499 | 9499 | }  | 
                                                        
| 9500 | 9500 | }  | 
                                                        
@@ -9504,22 +9504,22 @@ discard block  | 
                                                    ||
| 9504 | 9504 | <dl class="dropdown" id="linktoobjectname">  | 
                                                        
| 9505 | 9505 | ';  | 
                                                        
| 9506 | 9506 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9507 | -				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>'; | 
                                                        |
| 9507 | +				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>'; | 
                                                        |
| 9508 | 9508 | }  | 
                                                        
| 9509 | 9509 | $linktoelem .= '<dd>  | 
                                                        
| 9510 | 9510 | <div class="multiselectlinkto">  | 
                                                        
| 9511 | - <ul class="ulselectedfields">' . $linktoelemlist . '  | 
                                                        |
| 9511 | + <ul class="ulselectedfields">' . $linktoelemlist.'  | 
                                                        |
| 9512 | 9512 | </ul>  | 
                                                        
| 9513 | 9513 | </div>  | 
                                                        
| 9514 | 9514 | </dd>  | 
                                                        
| 9515 | 9515 | </dl>';  | 
                                                        
| 9516 | 9516 |  		} else { | 
                                                        
| 9517 | - $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 9517 | + $linktoelem = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment  | 
                                                        |
| 9518 | 9518 | }  | 
                                                        
| 9519 | 9519 | |
| 9520 | 9520 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 9521 | 9521 | print '<!-- Add js to show linkto box -->  | 
                                                        
| 9522 | - <script nonce="' . getNonce() . '">  | 
                                                        |
| 9522 | + <script nonce="' . getNonce().'">  | 
                                                        |
| 9523 | 9523 |  				jQuery(document).ready(function() { | 
                                                        
| 9524 | 9524 |  					jQuery(".linkto").click(function() { | 
                                                        
| 9525 | 9525 |  						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list"); | 
                                                        
@@ -9560,19 +9560,19 @@ discard block  | 
                                                    ||
| 9560 | 9560 | |
| 9561 | 9561 | $disabled = ($disabled ? ' disabled' : '');  | 
                                                        
| 9562 | 9562 | |
| 9563 | - $resultyesno = '<select class="flat width75' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";  | 
                                                        |
| 9563 | + $resultyesno = '<select class="flat width75'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";  | 
                                                        |
| 9564 | 9564 |  		if ($useempty) { | 
                                                        
| 9565 | - $resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 9565 | + $resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 9566 | 9566 | }  | 
                                                        
| 9567 | 9567 |  		if (("$value" == 'yes') || ($value == 1)) { | 
                                                        
| 9568 | - $resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9569 | - $resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9568 | + $resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9569 | + $resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9570 | 9570 |  		} else { | 
                                                        
| 9571 | 9571 | $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');  | 
                                                        
| 9572 | - $resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";  | 
                                                        |
| 9573 | - $resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";  | 
                                                        |
| 9572 | + $resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";  | 
                                                        |
| 9573 | + $resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";  | 
                                                        |
| 9574 | 9574 | }  | 
                                                        
| 9575 | - $resultyesno .= '</select>' . "\n";  | 
                                                        |
| 9575 | + $resultyesno .= '</select>'."\n";  | 
                                                        |
| 9576 | 9576 | |
| 9577 | 9577 |  		if ($addjscombo) { | 
                                                        
| 9578 | 9578 | $resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);  | 
                                                        
@@ -9596,12 +9596,12 @@ discard block  | 
                                                    ||
| 9596 | 9596 |  	{ | 
                                                        
| 9597 | 9597 | // phpcs:enable  | 
                                                        
| 9598 | 9598 | $sql = "SELECT rowid, label";  | 
                                                        
| 9599 | - $sql .= " FROM " . $this->db->prefix() . "export_model";  | 
                                                        |
| 9600 | - $sql .= " WHERE type = '" . $this->db->escape($type) . "'";  | 
                                                        |
| 9599 | + $sql .= " FROM ".$this->db->prefix()."export_model";  | 
                                                        |
| 9600 | + $sql .= " WHERE type = '".$this->db->escape($type)."'";  | 
                                                        |
| 9601 | 9601 | $sql .= " ORDER BY rowid";  | 
                                                        
| 9602 | 9602 | $result = $this->db->query($sql);  | 
                                                        
| 9603 | 9603 |  		if ($result) { | 
                                                        
| 9604 | - print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 9604 | + print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 9605 | 9605 |  			if ($useempty) { | 
                                                        
| 9606 | 9606 | print '<option value="-1"> </option>';  | 
                                                        
| 9607 | 9607 | }  | 
                                                        
@@ -9611,9 +9611,9 @@ discard block  | 
                                                    ||
| 9611 | 9611 |  			while ($i < $num) { | 
                                                        
| 9612 | 9612 | $obj = $this->db->fetch_object($result);  | 
                                                        
| 9613 | 9613 |  				if ($selected == $obj->rowid) { | 
                                                        
| 9614 | - print '<option value="' . $obj->rowid . '" selected>';  | 
                                                        |
| 9614 | + print '<option value="'.$obj->rowid.'" selected>';  | 
                                                        |
| 9615 | 9615 |  				} else { | 
                                                        
| 9616 | - print '<option value="' . $obj->rowid . '">';  | 
                                                        |
| 9616 | + print '<option value="'.$obj->rowid.'">';  | 
                                                        |
| 9617 | 9617 | }  | 
                                                        
| 9618 | 9618 | print $obj->label;  | 
                                                        
| 9619 | 9619 | print '</option>';  | 
                                                        
@@ -9704,8 +9704,8 @@ discard block  | 
                                                    ||
| 9704 | 9704 | $stringforfirstkey .= ' CTL +';  | 
                                                        
| 9705 | 9705 | }  | 
                                                        
| 9706 | 9706 | |
| 9707 | -			$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>'; | 
                                                        |
| 9708 | -			$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>'; | 
                                                        |
| 9707 | +			$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>'; | 
                                                        |
| 9708 | +			$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>'; | 
                                                        |
| 9709 | 9709 | }  | 
                                                        
| 9710 | 9710 | |
| 9711 | 9711 | //print "xx".$previous_ref."x".$next_ref;  | 
                                                        
@@ -9713,18 +9713,18 @@ discard block  | 
                                                    ||
| 9713 | 9713 | |
| 9714 | 9714 | // Right part of banner  | 
                                                        
| 9715 | 9715 |  		if ($morehtmlright) { | 
                                                        
| 9716 | - $ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';  | 
                                                        |
| 9716 | + $ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';  | 
                                                        |
| 9717 | 9717 | }  | 
                                                        
| 9718 | 9718 | |
| 9719 | 9719 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9720 | 9720 | $ret .= '<div class="pagination paginationref"><ul class="right">';  | 
                                                        
| 9721 | 9721 | }  | 
                                                        
| 9722 | 9722 |  		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) { | 
                                                        
| 9723 | - $ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';  | 
                                                        |
| 9723 | + $ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';  | 
                                                        |
| 9724 | 9724 | }  | 
                                                        
| 9725 | 9725 |  		if ($shownav && ($previous_ref || $next_ref)) { | 
                                                        
| 9726 | - $ret .= '<li class="pagination">' . $previous_ref . '</li>';  | 
                                                        |
| 9727 | - $ret .= '<li class="pagination">' . $next_ref . '</li>';  | 
                                                        |
| 9726 | + $ret .= '<li class="pagination">'.$previous_ref.'</li>';  | 
                                                        |
| 9727 | + $ret .= '<li class="pagination">'.$next_ref.'</li>';  | 
                                                        |
| 9728 | 9728 | }  | 
                                                        
| 9729 | 9729 |  		if ($previous_ref || $next_ref || $morehtml) { | 
                                                        
| 9730 | 9730 | $ret .= '</ul></div>';  | 
                                                        
@@ -9739,7 +9739,7 @@ discard block  | 
                                                    ||
| 9739 | 9739 | $morehtmlstatus = $hookmanager->resPrint;  | 
                                                        
| 9740 | 9740 | }  | 
                                                        
| 9741 | 9741 |  		if ($morehtmlstatus) { | 
                                                        
| 9742 | - $ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';  | 
                                                        |
| 9742 | + $ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';  | 
                                                        |
| 9743 | 9743 | }  | 
                                                        
| 9744 | 9744 | |
| 9745 | 9745 | $parameters = array();  | 
                                                        
@@ -9753,14 +9753,14 @@ discard block  | 
                                                    ||
| 9753 | 9753 | // Left part of banner  | 
                                                        
| 9754 | 9754 |  		if ($morehtmlleft) { | 
                                                        
| 9755 | 9755 |  			if ($conf->browser->layout == 'phone') { | 
                                                        
| 9756 | - $ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9756 | + $ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9757 | 9757 |  			} else { | 
                                                        
| 9758 | - $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';  | 
                                                        |
| 9758 | + $ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';  | 
                                                        |
| 9759 | 9759 | }  | 
                                                        
| 9760 | 9760 | }  | 
                                                        
| 9761 | 9761 | |
| 9762 | 9762 | //if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';  | 
                                                        
| 9763 | - $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';  | 
                                                        |
| 9763 | + $ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';  | 
                                                        |
| 9764 | 9764 | |
| 9765 | 9765 | // For thirdparty, contact, user, member, the ref is the id, so we show something else  | 
                                                        
| 9766 | 9766 |  		if ($object->element == 'societe') { | 
                                                        
@@ -9774,7 +9774,7 @@ discard block  | 
                                                    ||
| 9774 | 9774 | |
| 9775 | 9775 |  			if (is_array($arrayoflangcode) && count($arrayoflangcode)) { | 
                                                        
| 9776 | 9776 |  				if (!is_object($extralanguages)) { | 
                                                        
| 9777 | - include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';  | 
                                                        |
| 9777 | + include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';  | 
                                                        |
| 9778 | 9778 | $extralanguages = new ExtraLanguages($this->db);  | 
                                                        
| 9779 | 9779 | }  | 
                                                        
| 9780 | 9780 |  				$extralanguages->fetch_name_extralanguages('societe'); | 
                                                        
@@ -9789,27 +9789,27 @@ discard block  | 
                                                    ||
| 9789 | 9789 |  						if ($object->array_languages['name'][$extralangcode]) { | 
                                                        
| 9790 | 9790 | $htmltext .= $object->array_languages['name'][$extralangcode];  | 
                                                        
| 9791 | 9791 |  						} else { | 
                                                        
| 9792 | -							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>'; | 
                                                        |
| 9792 | +							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>'; | 
                                                        |
| 9793 | 9793 | }  | 
                                                        
| 9794 | 9794 | }  | 
                                                        
| 9795 | - $ret .= '<!-- Show translations of name -->' . "\n";  | 
                                                        |
| 9795 | + $ret .= '<!-- Show translations of name -->'."\n";  | 
                                                        |
| 9796 | 9796 |  					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft'); | 
                                                        
| 9797 | 9797 | }  | 
                                                        
| 9798 | 9798 | }  | 
                                                        
| 9799 | 9799 |  		} elseif ($object->element == 'member') { | 
                                                        
| 9800 | - $ret .= $object->ref . '<br>';  | 
                                                        |
| 9800 | + $ret .= $object->ref.'<br>';  | 
                                                        |
| 9801 | 9801 | $fullname = $object->getFullName($langs);  | 
                                                        
| 9802 | 9802 |  			if ($object->morphy == 'mor' && $object->societe) { | 
                                                        
| 9803 | -				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : ''); | 
                                                        |
| 9803 | +				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : ''); | 
                                                        |
| 9804 | 9804 |  			} else { | 
                                                        
| 9805 | -				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : ''); | 
                                                        |
| 9805 | +				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : ''); | 
                                                        |
| 9806 | 9806 | }  | 
                                                        
| 9807 | 9807 |  		} elseif (in_array($object->element, array('contact', 'user'))) { | 
                                                        
| 9808 | - $ret .= dol_htmlentities($object->getFullName($langs)) . $addgendertxt;  | 
                                                        |
| 9808 | + $ret .= dol_htmlentities($object->getFullName($langs)).$addgendertxt;  | 
                                                        |
| 9809 | 9809 |  		} elseif ($object->element == 'usergroup') { | 
                                                        
| 9810 | 9810 | $ret .= dol_htmlentities($object->name);  | 
                                                        
| 9811 | 9811 |  		} elseif (in_array($object->element, array('action', 'agenda'))) { | 
                                                        
| 9812 | - $ret .= $object->ref . '<br>' . $object->label;  | 
                                                        |
| 9812 | + $ret .= $object->ref.'<br>'.$object->label;  | 
                                                        |
| 9813 | 9813 |  		} elseif (in_array($object->element, array('adherent_type'))) { | 
                                                        
| 9814 | 9814 | $ret .= $object->label;  | 
                                                        
| 9815 | 9815 |  		} elseif ($object->element == 'ecm_directories') { | 
                                                        
@@ -9861,9 +9861,9 @@ discard block  | 
                                                    ||
| 9861 | 9861 | }  | 
                                                        
| 9862 | 9862 | |
| 9863 | 9863 | // Barcode image  | 
                                                        
| 9864 | - $url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);  | 
                                                        |
| 9865 | - $out = '<!-- url barcode = ' . $url . ' -->';  | 
                                                        |
| 9866 | - $out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';  | 
                                                        |
| 9864 | + $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);  | 
                                                        |
| 9865 | + $out = '<!-- url barcode = '.$url.' -->';  | 
                                                        |
| 9866 | + $out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';  | 
                                                        |
| 9867 | 9867 | |
| 9868 | 9868 | return $out;  | 
                                                        
| 9869 | 9869 | }  | 
                                                        
@@ -9903,28 +9903,28 @@ discard block  | 
                                                    ||
| 9903 | 9903 |  			if (!empty($object->logo)) { | 
                                                        
| 9904 | 9904 |  				if (dolIsAllowedForPreview($object->logo)) { | 
                                                        
| 9905 | 9905 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9906 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 9906 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs  | 
                                                        |
| 9907 | 9907 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9908 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 9908 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');  | 
                                                        |
| 9909 | 9909 |  					} else { | 
                                                        
| 9910 | - $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 9910 | + $file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 9911 | 9911 | }  | 
                                                        
| 9912 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;  | 
                                                        |
| 9912 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;  | 
                                                        |
| 9913 | 9913 | }  | 
                                                        
| 9914 | 9914 | }  | 
                                                        
| 9915 | 9915 | $email = $object->email;  | 
                                                        
| 9916 | 9916 |  		} elseif ($modulepart == 'contact') { | 
                                                        
| 9917 | - $dir = $conf->societe->multidir_output[$entity] . '/contact';  | 
                                                        |
| 9917 | + $dir = $conf->societe->multidir_output[$entity].'/contact';  | 
                                                        |
| 9918 | 9918 |  			if (!empty($object->photo)) { | 
                                                        
| 9919 | 9919 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9920 | 9920 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9921 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9921 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9922 | 9922 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9923 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9923 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9924 | 9924 |  					} else { | 
                                                        
| 9925 | - $file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 9925 | + $file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 9926 | 9926 | }  | 
                                                        
| 9927 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;  | 
                                                        |
| 9927 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;  | 
                                                        |
| 9928 | 9928 | }  | 
                                                        
| 9929 | 9929 | }  | 
                                                        
| 9930 | 9930 | $email = $object->email;  | 
                                                        
@@ -9934,17 +9934,17 @@ discard block  | 
                                                    ||
| 9934 | 9934 |  			if (!empty($object->photo)) { | 
                                                        
| 9935 | 9935 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9936 | 9936 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9937 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9937 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9938 | 9938 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9939 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9939 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9940 | 9940 |  					} else { | 
                                                        
| 9941 | - $file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 9941 | + $file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 9942 | 9942 | }  | 
                                                        
| 9943 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;  | 
                                                        |
| 9943 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;  | 
                                                        |
| 9944 | 9944 | }  | 
                                                        
| 9945 | 9945 | }  | 
                                                        
| 9946 | 9946 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9947 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9947 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9948 | 9948 | }  | 
                                                        
| 9949 | 9949 | $email = $object->email;  | 
                                                        
| 9950 | 9950 | $capture = 'user';  | 
                                                        
@@ -9953,17 +9953,17 @@ discard block  | 
                                                    ||
| 9953 | 9953 |  			if (!empty($object->photo)) { | 
                                                        
| 9954 | 9954 |  				if (dolIsAllowedForPreview($object->photo)) { | 
                                                        
| 9955 | 9955 |  					if ((string) $imagesize == 'mini') { | 
                                                        
| 9956 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9956 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');  | 
                                                        |
| 9957 | 9957 |  					} elseif ((string) $imagesize == 'small') { | 
                                                        
| 9958 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9958 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');  | 
                                                        |
| 9959 | 9959 |  					} else { | 
                                                        
| 9960 | - $file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 9960 | + $file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 9961 | 9961 | }  | 
                                                        
| 9962 | - $originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;  | 
                                                        |
| 9962 | + $originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;  | 
                                                        |
| 9963 | 9963 | }  | 
                                                        
| 9964 | 9964 | }  | 
                                                        
| 9965 | 9965 |  			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) { | 
                                                        
| 9966 | - $altfile = $object->id . ".jpg"; // For backward compatibility  | 
                                                        |
| 9966 | + $altfile = $object->id.".jpg"; // For backward compatibility  | 
                                                        |
| 9967 | 9967 | }  | 
                                                        
| 9968 | 9968 | $email = $object->email;  | 
                                                        
| 9969 | 9969 | $capture = 'user';  | 
                                                        
@@ -9989,35 +9989,35 @@ discard block  | 
                                                    ||
| 9989 | 9989 | $ret = '';  | 
                                                        
| 9990 | 9990 | |
| 9991 | 9991 |  		if ($dir) { | 
                                                        
| 9992 | -			if ($file && file_exists($dir . "/" . $file)) { | 
                                                        |
| 9992 | +			if ($file && file_exists($dir."/".$file)) { | 
                                                        |
| 9993 | 9993 |  				if ($addlinktofullsize) { | 
                                                        
| 9994 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 9994 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 9995 | 9995 |  					if ($urladvanced) { | 
                                                        
| 9996 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 9996 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 9997 | 9997 |  					} else { | 
                                                        
| 9998 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 9998 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 9999 | 9999 | }  | 
                                                        
| 10000 | 10000 | }  | 
                                                        
| 10001 | -				$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 . '">'; | 
                                                        |
| 10001 | +				$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.'">'; | 
                                                        |
| 10002 | 10002 |  				if ($addlinktofullsize) { | 
                                                        
| 10003 | 10003 | $ret .= '</a>';  | 
                                                        
| 10004 | 10004 | }  | 
                                                        
| 10005 | -			} elseif ($altfile && file_exists($dir . "/" . $altfile)) { | 
                                                        |
| 10005 | +			} elseif ($altfile && file_exists($dir."/".$altfile)) { | 
                                                        |
| 10006 | 10006 |  				if ($addlinktofullsize) { | 
                                                        
| 10007 | - $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);  | 
                                                        |
| 10007 | + $urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);  | 
                                                        |
| 10008 | 10008 |  					if ($urladvanced) { | 
                                                        
| 10009 | - $ret .= '<a href="' . $urladvanced . '">';  | 
                                                        |
| 10009 | + $ret .= '<a href="'.$urladvanced.'">';  | 
                                                        |
| 10010 | 10010 |  					} else { | 
                                                        
| 10011 | - $ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';  | 
                                                        |
| 10011 | + $ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';  | 
                                                        |
| 10012 | 10012 | }  | 
                                                        
| 10013 | 10013 | }  | 
                                                        
| 10014 | -				$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 . '">'; | 
                                                        |
| 10014 | +				$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.'">'; | 
                                                        |
| 10015 | 10015 |  				if ($addlinktofullsize) { | 
                                                        
| 10016 | 10016 | $ret .= '</a>';  | 
                                                        
| 10017 | 10017 | }  | 
                                                        
| 10018 | 10018 |  			} else { | 
                                                        
| 10019 | 10019 | $nophoto = '/public/theme/common/nophoto.png';  | 
                                                        
| 10020 | - $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 10020 | + $defaultimg = 'identicon'; // For gravatar  | 
                                                        |
| 10021 | 10021 |  				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found | 
                                                        
| 10022 | 10022 |  					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) { | 
                                                        
| 10023 | 10023 | $nophoto = 'company';  | 
                                                        
@@ -10035,13 +10035,13 @@ discard block  | 
                                                    ||
| 10035 | 10035 |  				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) { | 
                                                        
| 10036 | 10036 | // see https://gravatar.com/site/implement/images/php/  | 
                                                        
| 10037 | 10037 | $ret .= '<!-- Put link to gravatar -->';  | 
                                                        
| 10038 | - $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  | 
                                                        |
| 10038 | + $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  | 
                                                        |
| 10039 | 10039 |  				} else { | 
                                                        
| 10040 | 10040 |  					if ($nophoto == 'company') { | 
                                                        
| 10041 | -						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>'; | 
                                                        |
| 10041 | +						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>'; | 
                                                        |
| 10042 | 10042 | //$ret .= '<div class="difforspanimgright"></div>';  | 
                                                        
| 10043 | 10043 |  					} else { | 
                                                        
| 10044 | - $ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';  | 
                                                        |
| 10044 | + $ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';  | 
                                                        |
| 10045 | 10045 | }  | 
                                                        
| 10046 | 10046 | }  | 
                                                        
| 10047 | 10047 | }  | 
                                                        
@@ -10052,15 +10052,15 @@ discard block  | 
                                                    ||
| 10052 | 10052 | }  | 
                                                        
| 10053 | 10053 | $ret .= '<table class="nobordernopadding centpercent">';  | 
                                                        
| 10054 | 10054 |  				if ($object->photo) { | 
                                                        
| 10055 | -					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>'; | 
                                                        |
| 10055 | +					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>'; | 
                                                        |
| 10056 | 10056 | }  | 
                                                        
| 10057 | 10057 | $ret .= '<tr><td class="tdoverflow">';  | 
                                                        
| 10058 | 10058 | $maxfilesizearray = getMaxFileSizeArray();  | 
                                                        
| 10059 | 10059 | $maxmin = $maxfilesizearray['maxmin'];  | 
                                                        
| 10060 | 10060 |  				if ($maxmin > 0) { | 
                                                        
| 10061 | - $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10061 | + $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file  | 
                                                        |
| 10062 | 10062 | }  | 
                                                        
| 10063 | - $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';  | 
                                                        |
| 10063 | + $ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';  | 
                                                        |
| 10064 | 10064 | $ret .= '</td></tr>';  | 
                                                        
| 10065 | 10065 | $ret .= '</table>';  | 
                                                        
| 10066 | 10066 | }  | 
                                                        
@@ -10114,38 +10114,38 @@ discard block  | 
                                                    ||
| 10114 | 10114 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10115 | 10115 | $sql .= ", e.label";  | 
                                                        
| 10116 | 10116 | }  | 
                                                        
| 10117 | - $sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";  | 
                                                        |
| 10117 | + $sql .= " FROM ".$this->db->prefix()."usergroup as ug ";  | 
                                                        |
| 10118 | 10118 |  		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) { | 
                                                        
| 10119 | - $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10119 | + $sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";  | 
                                                        |
| 10120 | 10120 |  			if ($force_entity) { | 
                                                        
| 10121 | - $sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";  | 
                                                        |
| 10121 | + $sql .= " WHERE ug.entity IN (0, ".$force_entity.")";  | 
                                                        |
| 10122 | 10122 |  			} else { | 
                                                        
| 10123 | 10123 | $sql .= " WHERE ug.entity IS NOT NULL";  | 
                                                        
| 10124 | 10124 | }  | 
                                                        
| 10125 | 10125 |  		} else { | 
                                                        
| 10126 | - $sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";  | 
                                                        |
| 10126 | + $sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";  | 
                                                        |
| 10127 | 10127 | }  | 
                                                        
| 10128 | 10128 |  		if (is_array($exclude) && $excludeGroups) { | 
                                                        
| 10129 | -			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")"; | 
                                                        |
| 10129 | +			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")"; | 
                                                        |
| 10130 | 10130 | }  | 
                                                        
| 10131 | 10131 |  		if (is_array($include) && $includeGroups) { | 
                                                        
| 10132 | -			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")"; | 
                                                        |
| 10132 | +			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")"; | 
                                                        |
| 10133 | 10133 | }  | 
                                                        
| 10134 | 10134 | $sql .= " ORDER BY ug.nom ASC";  | 
                                                        
| 10135 | 10135 | |
| 10136 | - dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10136 | + dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);  | 
                                                        |
| 10137 | 10137 | $resql = $this->db->query($sql);  | 
                                                        
| 10138 | 10138 |  		if ($resql) { | 
                                                        
| 10139 | 10139 | // Enhance with select2  | 
                                                        
| 10140 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10140 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10141 | 10141 | |
| 10142 | - $out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';  | 
                                                        |
| 10142 | + $out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';  | 
                                                        |
| 10143 | 10143 | |
| 10144 | 10144 | $num = $this->db->num_rows($resql);  | 
                                                        
| 10145 | 10145 | $i = 0;  | 
                                                        
| 10146 | 10146 |  			if ($num) { | 
                                                        
| 10147 | 10147 |  				if ($show_empty && !$multiple) { | 
                                                        
| 10148 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '> </option>' . "\n";  | 
                                                        |
| 10148 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'> </option>'."\n";  | 
                                                        |
| 10149 | 10149 | }  | 
                                                        
| 10150 | 10150 | |
| 10151 | 10151 |  				while ($i < $num) { | 
                                                        
@@ -10158,11 +10158,11 @@ discard block  | 
                                                    ||
| 10158 | 10158 | $label = $obj->name;  | 
                                                        
| 10159 | 10159 | $labelhtml = $obj->name;  | 
                                                        
| 10160 | 10160 |  					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) { | 
                                                        
| 10161 | -						$label .= " (" . $obj->label . ")"; | 
                                                        |
| 10162 | -						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>'; | 
                                                        |
| 10161 | +						$label .= " (".$obj->label.")"; | 
                                                        |
| 10162 | +						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>'; | 
                                                        |
| 10163 | 10163 | }  | 
                                                        
| 10164 | 10164 | |
| 10165 | - $out .= '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10165 | + $out .= '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10166 | 10166 |  					if ($disableline) { | 
                                                        
| 10167 | 10167 | $out .= ' disabled';  | 
                                                        
| 10168 | 10168 | }  | 
                                                        
@@ -10178,9 +10178,9 @@ discard block  | 
                                                    ||
| 10178 | 10178 | }  | 
                                                        
| 10179 | 10179 |  			} else { | 
                                                        
| 10180 | 10180 |  				if ($show_empty) { | 
                                                        
| 10181 | - $out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";  | 
                                                        |
| 10181 | + $out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";  | 
                                                        |
| 10182 | 10182 | }  | 
                                                        
| 10183 | -				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>'; | 
                                                        |
| 10183 | +				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>'; | 
                                                        |
| 10184 | 10184 | }  | 
                                                        
| 10185 | 10185 | $out .= '</select>';  | 
                                                        
| 10186 | 10186 | |
@@ -10224,25 +10224,25 @@ discard block  | 
                                                    ||
| 10224 | 10224 | $out = '';  | 
                                                        
| 10225 | 10225 | |
| 10226 | 10226 |  		if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10227 | - $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';  | 
                                                        |
| 10227 | + $out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';  | 
                                                        |
| 10228 | 10228 | }  | 
                                                        
| 10229 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10229 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10230 | 10230 |              $(document).ready(function() { | 
                                                        
| 10231 | -                $("#' . $cssclass . 's").click(function() { | 
                                                        |
| 10231 | +                $("#' . $cssclass.'s").click(function() { | 
                                                        |
| 10232 | 10232 |                      if($(this).is(\':checked\')){ | 
                                                        
| 10233 | -                        console.log("We check all ' . $cssclass . ' and trigger the change method"); | 
                                                        |
| 10234 | -                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10233 | +                        console.log("We check all ' . $cssclass.' and trigger the change method"); | 
                                                        |
| 10234 | +                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\'); | 
                                                        |
| 10235 | 10235 | }  | 
                                                        
| 10236 | 10236 | else  | 
                                                        
| 10237 | 10237 |                      { | 
                                                        
| 10238 | 10238 |                          console.log("We uncheck all"); | 
                                                        
| 10239 | -                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10239 | +                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\'); | 
                                                        |
| 10240 | 10240 | }' . "\n";  | 
                                                        
| 10241 | 10241 |  		if ($calljsfunction) { | 
                                                        
| 10242 | -			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10242 | +			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }'; | 
                                                        |
| 10243 | 10243 | }  | 
                                                        
| 10244 | 10244 | $out .= ' });  | 
                                                        
| 10245 | -        	        $(".' . $cssclass . '").change(function() { | 
                                                        |
| 10245 | +        	        $(".' . $cssclass.'").change(function() { | 
                                                        |
| 10246 | 10246 |  					$(this).closest("tr").toggleClass("highlight", this.checked); | 
                                                        
| 10247 | 10247 | });  | 
                                                        
| 10248 | 10248 | });  | 
                                                        
@@ -10287,67 +10287,67 @@ discard block  | 
                                                    ||
| 10287 | 10287 | global $langs, $user;  | 
                                                        
| 10288 | 10288 | |
| 10289 | 10289 | $out = '';  | 
                                                        
| 10290 | - $sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10291 | -		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")"; | 
                                                        |
| 10290 | + $sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";  | 
                                                        |
| 10291 | +		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")"; | 
                                                        |
| 10292 | 10292 |  		if (!empty($excludeid)) { | 
                                                        
| 10293 | -			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")"; | 
                                                        |
| 10293 | +			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")"; | 
                                                        |
| 10294 | 10294 | }  | 
                                                        
| 10295 | 10295 | $sql .= " ORDER BY label";  | 
                                                        
| 10296 | 10296 | |
| 10297 | 10297 | $resql = $this->db->query($sql);  | 
                                                        
| 10298 | 10298 |  		if ($resql) { | 
                                                        
| 10299 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10299 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';  | 
                                                        |
| 10300 | 10300 |  			if ($useempty) { | 
                                                        
| 10301 | 10301 | $out .= '<option value="0"> </option>';  | 
                                                        
| 10302 | 10302 | }  | 
                                                        
| 10303 | 10303 | |
| 10304 | 10304 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10305 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';  | 
                                                        |
| 10305 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';  | 
                                                        |
| 10306 | 10306 | }  | 
                                                        
| 10307 | 10307 | $out .= '</select>';  | 
                                                        
| 10308 | -			$out .= ajax_combobox('select_' . $htmlname); | 
                                                        |
| 10308 | +			$out .= ajax_combobox('select_'.$htmlname); | 
                                                        |
| 10309 | 10309 | |
| 10310 | 10310 |  			if (!empty($htmlname) && $user->admin && $info_admin) { | 
                                                        
| 10311 | -				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10311 | +				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); | 
                                                        |
| 10312 | 10312 | }  | 
                                                        
| 10313 | 10313 | |
| 10314 | 10314 |  			if (!empty($target)) { | 
                                                        
| 10315 | - $sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10315 | + $sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";  | 
                                                        |
| 10316 | 10316 | $resql = $this->db->query($sql);  | 
                                                        
| 10317 | 10317 |  				if ($resql) { | 
                                                        
| 10318 | 10318 |  					if ($this->db->num_rows($resql) > 0) { | 
                                                        
| 10319 | 10319 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 10320 | - $out .= '<script nonce="' . getNonce() . '">  | 
                                                        |
| 10320 | + $out .= '<script nonce="'.getNonce().'">  | 
                                                        |
| 10321 | 10321 |  							$(function() { | 
                                                        
| 10322 | -								$("select[name=' . $target . ']").on("change", function() { | 
                                                        |
| 10322 | +								$("select[name=' . $target.']").on("change", function() { | 
                                                        |
| 10323 | 10323 | var current_val = $(this).val();  | 
                                                        
| 10324 | -									if (current_val == ' . $obj->id . ') {'; | 
                                                        |
| 10324 | +									if (current_val == ' . $obj->id.') {'; | 
                                                        |
| 10325 | 10325 |  						if (!empty($default_selected) || !empty($selected)) { | 
                                                        
| 10326 | -							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");'; | 
                                                        |
| 10326 | +							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; | 
                                                        |
| 10327 | 10327 | }  | 
                                                        
| 10328 | 10328 | |
| 10329 | 10329 | $out .= '  | 
                                                        
| 10330 | -										$("select[name=' . $htmlname . ']").change(); | 
                                                        |
| 10330 | +										$("select[name=' . $htmlname.']").change(); | 
                                                        |
| 10331 | 10331 | }  | 
                                                        
| 10332 | 10332 | });  | 
                                                        
| 10333 | 10333 | |
| 10334 | -								$("select[name=' . $htmlname . ']").change(function() { | 
                                                        |
| 10334 | +								$("select[name=' . $htmlname.']").change(function() { | 
                                                        |
| 10335 | 10335 | |
| 10336 | -									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') { | 
                                                        |
| 10336 | +									if ($("select[name=' . $target.']").val() == '.$obj->id.') { | 
                                                        |
| 10337 | 10337 | // get price of kilometer to fill the unit price  | 
                                                        
| 10338 | 10338 |  										$.ajax({ | 
                                                        
| 10339 | 10339 | method: "POST",  | 
                                                        
| 10340 | 10340 | dataType: "json",  | 
                                                        
| 10341 | -											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' }, | 
                                                        |
| 10342 | -											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '", | 
                                                        |
| 10341 | +											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' }, | 
                                                        |
| 10342 | +											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'", | 
                                                        |
| 10343 | 10343 |  										}).done(function( data, textStatus, jqXHR ) { | 
                                                        
| 10344 | 10344 | console.log(data);  | 
                                                        
| 10345 | 10345 |  											if (typeof data.up != "undefined") { | 
                                                        
| 10346 | 10346 |  												$("input[name=value_unit]").val(data.up); | 
                                                        
| 10347 | -												$("select[name=' . $htmlname . ']").attr("title", data.title); | 
                                                        |
| 10347 | +												$("select[name=' . $htmlname.']").attr("title", data.title); | 
                                                        |
| 10348 | 10348 |  											} else { | 
                                                        
| 10349 | 10349 |  												$("input[name=value_unit]").val(""); | 
                                                        
| 10350 | -												$("select[name=' . $htmlname . ']").attr("title", ""); | 
                                                        |
| 10350 | +												$("select[name=' . $htmlname.']").attr("title", ""); | 
                                                        |
| 10351 | 10351 | }  | 
                                                        
| 10352 | 10352 | });  | 
                                                        
| 10353 | 10353 | }  | 
                                                        
@@ -10377,18 +10377,18 @@ discard block  | 
                                                    ||
| 10377 | 10377 | global $conf, $langs;  | 
                                                        
| 10378 | 10378 | |
| 10379 | 10379 | $out = '';  | 
                                                        
| 10380 | - $sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";  | 
                                                        |
| 10381 | - $sql .= " WHERE entity = " . $conf->entity . " AND active = 1";  | 
                                                        |
| 10380 | + $sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";  | 
                                                        |
| 10381 | + $sql .= " WHERE entity = ".$conf->entity." AND active = 1";  | 
                                                        |
| 10382 | 10382 | |
| 10383 | 10383 | $resql = $this->db->query($sql);  | 
                                                        
| 10384 | 10384 |  		if ($resql) { | 
                                                        
| 10385 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10385 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10386 | 10386 |  			if ($useempty) { | 
                                                        
| 10387 | 10387 | $out .= '<option value="0"></option>';  | 
                                                        
| 10388 | 10388 | }  | 
                                                        
| 10389 | 10389 | |
| 10390 | 10390 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10391 | - $out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';  | 
                                                        |
| 10391 | + $out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';  | 
                                                        |
| 10392 | 10392 | }  | 
                                                        
| 10393 | 10393 | $out .= '</select>';  | 
                                                        
| 10394 | 10394 |  		} else { | 
                                                        
@@ -10419,12 +10419,12 @@ discard block  | 
                                                    ||
| 10419 | 10419 | |
| 10420 | 10420 | $resql = $this->db->query($sql);  | 
                                                        
| 10421 | 10421 |  		if ($resql) { | 
                                                        
| 10422 | - $out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';  | 
                                                        |
| 10422 | + $out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';  | 
                                                        |
| 10423 | 10423 |  			if ($useempty) { | 
                                                        
| 10424 | 10424 | $out .= '<option value="0"></option>';  | 
                                                        
| 10425 | 10425 | }  | 
                                                        
| 10426 | 10426 |  			if ($allchoice) { | 
                                                        
| 10427 | -				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>'; | 
                                                        |
| 10427 | +				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>'; | 
                                                        |
| 10428 | 10428 | }  | 
                                                        
| 10429 | 10429 | |
| 10430 | 10430 | $field = 'code';  | 
                                                        
@@ -10434,7 +10434,7 @@ discard block  | 
                                                    ||
| 10434 | 10434 | |
| 10435 | 10435 |  			while ($obj = $this->db->fetch_object($resql)) { | 
                                                        
| 10436 | 10436 | $key = $langs->trans($obj->code);  | 
                                                        
| 10437 | -				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>'; | 
                                                        |
| 10437 | +				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>'; | 
                                                        |
| 10438 | 10438 | }  | 
                                                        
| 10439 | 10439 | $out .= '</select>';  | 
                                                        
| 10440 | 10440 | |
@@ -10468,7 +10468,7 @@ discard block  | 
                                                    ||
| 10468 | 10468 |  	{ | 
                                                        
| 10469 | 10469 | global $user, $conf, $langs;  | 
                                                        
| 10470 | 10470 | |
| 10471 | - require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';  | 
                                                        |
| 10471 | + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';  | 
                                                        |
| 10472 | 10472 | |
| 10473 | 10473 |  		if (is_null($usertofilter)) { | 
                                                        
| 10474 | 10474 | $usertofilter = $user;  | 
                                                        
@@ -10492,10 +10492,10 @@ discard block  | 
                                                    ||
| 10492 | 10492 | $sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,  | 
                                                        
| 10493 | 10493 | p.title, p.fk_soc, p.fk_statut, p.public,";  | 
                                                        
| 10494 | 10494 | $sql .= ' s.nom as name';  | 
                                                        
| 10495 | - $sql .= ' FROM ' . $this->db->prefix() . 'projet as p';  | 
                                                        |
| 10496 | - $sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10497 | - $sql .= ' ' . $this->db->prefix() . 'facture as f';  | 
                                                        |
| 10498 | -		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")"; | 
                                                        |
| 10495 | + $sql .= ' FROM '.$this->db->prefix().'projet as p';  | 
                                                        |
| 10496 | + $sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';  | 
                                                        |
| 10497 | + $sql .= ' '.$this->db->prefix().'facture as f';  | 
                                                        |
| 10498 | +		$sql .= " WHERE p.entity IN (".getEntity('project').")"; | 
                                                        |
| 10499 | 10499 | $sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement  | 
                                                        
| 10500 | 10500 |  		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; | 
                                                        
| 10501 | 10501 | //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";  | 
                                                        
@@ -10506,14 +10506,14 @@ discard block  | 
                                                    ||
| 10506 | 10506 |  		if ($resql) { | 
                                                        
| 10507 | 10507 | // Use select2 selector  | 
                                                        
| 10508 | 10508 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10509 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10509 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10510 | 10510 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
| 10511 | 10511 | $out .= $comboenhancement;  | 
                                                        
| 10512 | 10512 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10513 | 10513 | }  | 
                                                        
| 10514 | 10514 | |
| 10515 | 10515 |  			if (empty($option_only)) { | 
                                                        
| 10516 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10516 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10517 | 10517 | }  | 
                                                        
| 10518 | 10518 |  			if (!empty($show_empty)) { | 
                                                        
| 10519 | 10519 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10543,33 +10543,33 @@ discard block  | 
                                                    ||
| 10543 | 10543 |  						if ($showproject == 'all') { | 
                                                        
| 10544 | 10544 | $labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref  | 
                                                        
| 10545 | 10545 |  							if ($obj->name) { | 
                                                        
| 10546 | - $labeltoshow .= ' - ' . $obj->name; // Soc name  | 
                                                        |
| 10546 | + $labeltoshow .= ' - '.$obj->name; // Soc name  | 
                                                        |
| 10547 | 10547 | }  | 
                                                        
| 10548 | 10548 | |
| 10549 | 10549 | $disabled = 0;  | 
                                                        
| 10550 | 10550 |  							if ($obj->fk_statut == Project::STATUS_DRAFT) { | 
                                                        
| 10551 | 10551 | $disabled = 1;  | 
                                                        
| 10552 | -								$labeltoshow .= ' - ' . $langs->trans("Draft"); | 
                                                        |
| 10552 | +								$labeltoshow .= ' - '.$langs->trans("Draft"); | 
                                                        |
| 10553 | 10553 |  							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) { | 
                                                        
| 10554 | 10554 |  								if ($discard_closed == 2) { | 
                                                        
| 10555 | 10555 | $disabled = 1;  | 
                                                        
| 10556 | 10556 | }  | 
                                                        
| 10557 | -								$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10557 | +								$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10558 | 10558 |  							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { | 
                                                        
| 10559 | 10559 | $disabled = 1;  | 
                                                        
| 10560 | -								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10560 | +								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); | 
                                                        |
| 10561 | 10561 | }  | 
                                                        
| 10562 | 10562 | }  | 
                                                        
| 10563 | 10563 | |
| 10564 | 10564 |  						if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10565 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10565 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10566 | 10566 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10567 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10567 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10568 | 10568 |  						} else { | 
                                                        
| 10569 | 10569 |  							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10570 | 10570 | $resultat = '';  | 
                                                        
| 10571 | 10571 |  							} else { | 
                                                        
| 10572 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10572 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10573 | 10573 |  								if ($disabled) { | 
                                                        
| 10574 | 10574 | $resultat .= ' disabled';  | 
                                                        
| 10575 | 10575 | }  | 
                                                        
@@ -10621,22 +10621,22 @@ discard block  | 
                                                    ||
| 10621 | 10621 | |
| 10622 | 10622 | $sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';  | 
                                                        
| 10623 | 10623 | //$sql.= ', el.fk_source';  | 
                                                        
| 10624 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';  | 
                                                        |
| 10625 | -		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")"; | 
                                                        |
| 10624 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';  | 
                                                        |
| 10625 | +		$sql .= " WHERE f.entity IN (".getEntity('invoice').")"; | 
                                                        |
| 10626 | 10626 | $sql .= " ORDER BY f.titre ASC";  | 
                                                        
| 10627 | 10627 | |
| 10628 | 10628 | $resql = $this->db->query($sql);  | 
                                                        
| 10629 | 10629 |  		if ($resql) { | 
                                                        
| 10630 | 10630 | // Use select2 selector  | 
                                                        
| 10631 | 10631 |  			if (!empty($conf->use_javascript_ajax)) { | 
                                                        
| 10632 | - include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';  | 
                                                        |
| 10632 | + include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';  | 
                                                        |
| 10633 | 10633 | $comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);  | 
                                                        
| 10634 | 10634 | $out .= $comboenhancement;  | 
                                                        
| 10635 | 10635 | $morecss = 'minwidth200imp maxwidth500';  | 
                                                        
| 10636 | 10636 | }  | 
                                                        
| 10637 | 10637 | |
| 10638 | 10638 |  			if (empty($option_only)) { | 
                                                        
| 10639 | - $out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';  | 
                                                        |
| 10639 | + $out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';  | 
                                                        |
| 10640 | 10640 | }  | 
                                                        
| 10641 | 10641 |  			if (!empty($show_empty)) { | 
                                                        
| 10642 | 10642 | $out .= '<option value="0" class="optiongrey">';  | 
                                                        
@@ -10655,19 +10655,19 @@ discard block  | 
                                                    ||
| 10655 | 10655 | $disabled = 0;  | 
                                                        
| 10656 | 10656 |  					if (!empty($obj->suspended)) { | 
                                                        
| 10657 | 10657 | $disabled = 1;  | 
                                                        
| 10658 | -						$labeltoshow .= ' - ' . $langs->trans("Closed"); | 
                                                        |
| 10658 | +						$labeltoshow .= ' - '.$langs->trans("Closed"); | 
                                                        |
| 10659 | 10659 | }  | 
                                                        
| 10660 | 10660 | |
| 10661 | 10661 | |
| 10662 | 10662 |  					if (!empty($selected) && $selected == $obj->rowid) { | 
                                                        
| 10663 | - $out .= '<option value="' . $obj->rowid . '" selected';  | 
                                                        |
| 10663 | + $out .= '<option value="'.$obj->rowid.'" selected';  | 
                                                        |
| 10664 | 10664 | //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled  | 
                                                        
| 10665 | - $out .= '>' . $labeltoshow . '</option>';  | 
                                                        |
| 10665 | + $out .= '>'.$labeltoshow.'</option>';  | 
                                                        |
| 10666 | 10666 |  					} else { | 
                                                        
| 10667 | 10667 |  						if ($disabled && ($selected != $obj->rowid)) { | 
                                                        
| 10668 | 10668 | $resultat = '';  | 
                                                        
| 10669 | 10669 |  						} else { | 
                                                        
| 10670 | - $resultat = '<option value="' . $obj->rowid . '"';  | 
                                                        |
| 10670 | + $resultat = '<option value="'.$obj->rowid.'"';  | 
                                                        |
| 10671 | 10671 |  							if ($disabled) { | 
                                                        
| 10672 | 10672 | $resultat .= ' disabled';  | 
                                                        
| 10673 | 10673 | }  | 
                                                        
@@ -10707,14 +10707,14 @@ discard block  | 
                                                    ||
| 10707 | 10707 | global $langs;  | 
                                                        
| 10708 | 10708 | |
| 10709 | 10709 |  		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with () | 
                                                        
| 10710 | -			$search_component_params_hidden = '(' . $search_component_params_hidden . ')'; | 
                                                        |
| 10710 | +			$search_component_params_hidden = '('.$search_component_params_hidden.')'; | 
                                                        |
| 10711 | 10711 | }  | 
                                                        
| 10712 | 10712 | |
| 10713 | 10713 | $ret = '';  | 
                                                        
| 10714 | 10714 | |
| 10715 | 10715 | $ret .= '<div class="divadvancedsearchfieldcomp inline-block">';  | 
                                                        
| 10716 | 10716 | $ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';  | 
                                                        
| 10717 | -		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10717 | +		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>'; | 
                                                        |
| 10718 | 10718 | $ret .= '</a>';  | 
                                                        
| 10719 | 10719 | |
| 10720 | 10720 | $ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';  | 
                                                        
@@ -10758,29 +10758,29 @@ discard block  | 
                                                    ||
| 10758 | 10758 | $ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';  | 
                                                        
| 10759 | 10759 | }  | 
                                                        
| 10760 | 10760 | $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%')) -->";  | 
                                                        
| 10761 | - $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';  | 
                                                        |
| 10761 | + $ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';  | 
                                                        |
| 10762 | 10762 | // $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";  | 
                                                        
| 10763 | 10763 | |
| 10764 | 10764 | // For compatibility with forms that show themself the search criteria in addition of this component, we output these fields  | 
                                                        
| 10765 | 10765 |  		foreach ($arrayofcriterias as $criteria) { | 
                                                        
| 10766 | 10766 |  			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) { | 
                                                        
| 10767 | -				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10767 | +				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) { | 
                                                        |
| 10768 | 10768 | continue;  | 
                                                        
| 10769 | 10769 | }  | 
                                                        
| 10770 | 10770 |  				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) { | 
                                                        
| 10771 | 10771 | continue;  | 
                                                        
| 10772 | 10772 | }  | 
                                                        
| 10773 | 10773 |  				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) { | 
                                                        
| 10774 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';  | 
                                                        |
| 10775 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';  | 
                                                        |
| 10776 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';  | 
                                                        |
| 10777 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';  | 
                                                        |
| 10778 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';  | 
                                                        |
| 10779 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';  | 
                                                        |
| 10780 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';  | 
                                                        |
| 10781 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';  | 
                                                        |
| 10774 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';  | 
                                                        |
| 10775 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';  | 
                                                        |
| 10776 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';  | 
                                                        |
| 10777 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';  | 
                                                        |
| 10778 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';  | 
                                                        |
| 10779 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';  | 
                                                        |
| 10780 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';  | 
                                                        |
| 10781 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';  | 
                                                        |
| 10782 | 10782 |  				} else { | 
                                                        
| 10783 | - $ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';  | 
                                                        |
| 10783 | + $ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';  | 
                                                        |
| 10784 | 10784 | }  | 
                                                        
| 10785 | 10785 | }  | 
                                                        
| 10786 | 10786 | }  | 
                                                        
@@ -10788,7 +10788,7 @@ discard block  | 
                                                    ||
| 10788 | 10788 | $ret .= '</div>';  | 
                                                        
| 10789 | 10789 | |
| 10790 | 10790 | $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";  | 
                                                        
| 10791 | -		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 10791 | +		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">'; | 
                                                        |
| 10792 | 10792 | |
| 10793 | 10793 | $ret .= '</div>';  | 
                                                        
| 10794 | 10794 | $ret .= '</div>';  | 
                                                        
@@ -10862,7 +10862,7 @@ discard block  | 
                                                    ||
| 10862 | 10862 | |
| 10863 | 10863 | $TModels = array();  | 
                                                        
| 10864 | 10864 | |
| 10865 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';  | 
                                                        |
| 10865 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';  | 
                                                        |
| 10866 | 10866 | $formmail = new FormMail($this->db);  | 
                                                        
| 10867 | 10867 | $result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);  | 
                                                        
| 10868 | 10868 | |
@@ -10875,17 +10875,17 @@ discard block  | 
                                                    ||
| 10875 | 10875 | }  | 
                                                        
| 10876 | 10876 | }  | 
                                                        
| 10877 | 10877 | |
| 10878 | - $retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';  | 
                                                        |
| 10878 | + $retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';  | 
                                                        |
| 10879 | 10879 | |
| 10880 | 10880 |  		foreach ($TModels as $id_model => $label_model) { | 
                                                        
| 10881 | - $retstring .= '<option value="' . $id_model . '"';  | 
                                                        |
| 10882 | - $retstring .= ">" . $label_model . "</option>";  | 
                                                        |
| 10881 | + $retstring .= '<option value="'.$id_model.'"';  | 
                                                        |
| 10882 | + $retstring .= ">".$label_model."</option>";  | 
                                                        |
| 10883 | 10883 | }  | 
                                                        
| 10884 | 10884 | |
| 10885 | 10885 | $retstring .= "</select>";  | 
                                                        
| 10886 | 10886 | |
| 10887 | 10887 |  		if ($addjscombo) { | 
                                                        
| 10888 | -			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail'); | 
                                                        |
| 10888 | +			$retstring .= ajax_combobox('select_'.$prefix.'model_mail'); | 
                                                        |
| 10889 | 10889 | }  | 
                                                        
| 10890 | 10890 | |
| 10891 | 10891 | return $retstring;  | 
                                                        
@@ -10936,16 +10936,16 @@ discard block  | 
                                                    ||
| 10936 | 10936 | |
| 10937 | 10937 |  		foreach ($buttons as $button) { | 
                                                        
| 10938 | 10938 | $addclass = empty($button['addclass']) ? '' : $button['addclass'];  | 
                                                        
| 10939 | - $retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';  | 
                                                        |
| 10939 | + $retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';  | 
                                                        |
| 10940 | 10940 | }  | 
                                                        
| 10941 | 10941 | $retstring .= $withoutdiv ? '' : '</div>';  | 
                                                        
| 10942 | 10942 | |
| 10943 | 10943 |  		if ($dol_openinpopup) { | 
                                                        
| 10944 | - $retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . $dol_openinpopup . ' context, so we enable the close of dialog on cancel -->' . "\n";  | 
                                                        |
| 10945 | - $retstring .= '<script nonce="' . getNonce() . '">';  | 
                                                        |
| 10944 | + $retstring .= '<!-- buttons are shown into a $dol_openinpopup='.$dol_openinpopup.' context, so we enable the close of dialog on cancel -->'."\n";  | 
                                                        |
| 10945 | + $retstring .= '<script nonce="'.getNonce().'">';  | 
                                                        |
| 10946 | 10946 |  			$retstring .= 'jQuery(".button-cancel").click(function(e) { | 
                                                        
| 10947 | - e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup . '\');  | 
                                                        |
| 10948 | - window.parent.jQuery(\'#idfordialog' . $dol_openinpopup . '\').dialog(\'close\');  | 
                                                        |
| 10947 | + e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . $dol_openinpopup.'\');  | 
                                                        |
| 10948 | + window.parent.jQuery(\'#idfordialog' . $dol_openinpopup.'\').dialog(\'close\');  | 
                                                        |
| 10949 | 10949 | });';  | 
                                                        
| 10950 | 10950 | $retstring .= '</script>';  | 
                                                        
| 10951 | 10951 | }  | 
                                                        
@@ -10974,7 +10974,7 @@ discard block  | 
                                                    ||
| 10974 | 10974 | dol_syslog(__METHOD__, LOG_DEBUG);  | 
                                                        
| 10975 | 10975 | |
| 10976 | 10976 | $sql = "SELECT rowid, code, label as label";  | 
                                                        
| 10977 | - $sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';  | 
                                                        |
| 10977 | + $sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';  | 
                                                        |
| 10978 | 10978 | $sql .= " WHERE active = 1";  | 
                                                        
| 10979 | 10979 | |
| 10980 | 10980 | $resql = $this->db->query($sql);  | 
                                                        
@@ -10985,7 +10985,7 @@ discard block  | 
                                                    ||
| 10985 | 10985 | $obj = $this->db->fetch_object($resql);  | 
                                                        
| 10986 | 10986 | |
| 10987 | 10987 | // If translation exists, we use it, otherwise we take the default wording  | 
                                                        
| 10988 | -				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 10988 | +				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : ''); | 
                                                        |
| 10989 | 10989 | $this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;  | 
                                                        
| 10990 | 10990 | $this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;  | 
                                                        
| 10991 | 10991 | $this->cache_invoice_subtype[$obj->rowid]['label'] = $label;  | 
                                                        
@@ -11017,18 +11017,18 @@ discard block  | 
                                                    ||
| 11017 | 11017 | global $langs, $user;  | 
                                                        
| 11018 | 11018 | |
| 11019 | 11019 | $out = '';  | 
                                                        
| 11020 | - dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);  | 
                                                        |
| 11020 | + dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);  | 
                                                        |
| 11021 | 11021 | |
| 11022 | 11022 | $this->load_cache_invoice_subtype();  | 
                                                        
| 11023 | 11023 | |
| 11024 | - $out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';  | 
                                                        |
| 11024 | + $out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';  | 
                                                        |
| 11025 | 11025 |  		if ($addempty) { | 
                                                        
| 11026 | 11026 | $out .= '<option value="0"> </option>';  | 
                                                        
| 11027 | 11027 | }  | 
                                                        
| 11028 | 11028 | |
| 11029 | 11029 |  		foreach ($this->cache_invoice_subtype as $rowid => $subtype) { | 
                                                        
| 11030 | 11030 | $label = $subtype['label'];  | 
                                                        
| 11031 | - $out .= '<option value="' . $subtype['rowid'] . '"';  | 
                                                        |
| 11031 | + $out .= '<option value="'.$subtype['rowid'].'"';  | 
                                                        |
| 11032 | 11032 |  			if ($selected == $subtype['rowid']) { | 
                                                        
| 11033 | 11033 | $out .= ' selected="selected"';  | 
                                                        
| 11034 | 11034 | }  | 
                                                        
@@ -581,7 +581,7 @@ discard block  | 
                                                    ||
| 581 | 581 |  		if ($mode != "_tmp") { | 
                                                        
| 582 | 582 | // Date document export  | 
                                                        
| 583 | 583 | print '<tr>';  | 
                                                        
| 584 | -			print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>'; | 
                                                        |
| 584 | +			print '<td class="titlefield">'.$langs->trans("DateExport").'</td>'; | 
                                                        |
| 585 | 585 | print '<td>';  | 
                                                        
| 586 | 586 | print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' ';  | 
                                                        
| 587 | 587 | print '</td>';  | 
                                                        
@@ -589,7 +589,7 @@ discard block  | 
                                                    ||
| 589 | 589 | |
| 590 | 590 | // Date document validation  | 
                                                        
| 591 | 591 | print '<tr>';  | 
                                                        
| 592 | -			print '<td class="titlefield">' . $langs->trans("DateValidation") . '</td>'; | 
                                                        |
| 592 | +			print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>'; | 
                                                        |
| 593 | 593 | print '<td>';  | 
                                                        
| 594 | 594 | print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' ';  | 
                                                        
| 595 | 595 | print '</td>';  | 
                                                        
@@ -598,7 +598,7 @@ discard block  | 
                                                    ||
| 598 | 598 | // Id_import  | 
                                                        
| 599 | 599 |  			if (!empty($object->import_key)) { | 
                                                        
| 600 | 600 | print '<tr>';  | 
                                                        
| 601 | -				print '<td class="titlefield">' . $langs->trans("ImportId") . '</td>'; | 
                                                        |
| 601 | +				print '<td class="titlefield">'.$langs->trans("ImportId").'</td>'; | 
                                                        |
| 602 | 602 | print '<td>';  | 
                                                        
| 603 | 603 | print $object->import_key;  | 
                                                        
| 604 | 604 | print '</td>';  | 
                                                        
@@ -656,7 +656,7 @@ discard block  | 
                                                    ||
| 656 | 656 | |
| 657 | 657 | print '<br>';  | 
                                                        
| 658 | 658 | |
| 659 | - $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt  | 
                                                        |
| 659 | + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt  | 
                                                        |
| 660 | 660 | |
| 661 | 661 |  		if ($result < 0) { | 
                                                        
| 662 | 662 | setEventMessages($object->error, $object->errors, 'errors');  | 
                                                        
@@ -754,14 +754,14 @@ discard block  | 
                                                    ||
| 754 | 754 |  							if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { | 
                                                        
| 755 | 755 |  								print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); | 
                                                        
| 756 | 756 |  							} else { | 
                                                        
| 757 | -								print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">'; | 
                                                        |
| 757 | +								print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; | 
                                                        |
| 758 | 758 | }  | 
                                                        
| 759 | -							print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">'; | 
                                                        |
| 759 | +							print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; | 
                                                        |
| 760 | 760 | print '</td>';  | 
                                                        
| 761 | - print '<td><input type="text" class="minwidth200" name="label_operation" value="' . dol_escape_htmltag($label_operation) . '"/></td>';  | 
                                                        |
| 761 | + print '<td><input type="text" class="minwidth200" name="label_operation" value="'.dol_escape_htmltag($label_operation).'"/></td>';  | 
                                                        |
| 762 | 762 | print '<td class="right"><input type="text" class="right width50" name="debit" value=""/></td>';  | 
                                                        
| 763 | 763 | print '<td class="right"><input type="text" class="right width50" name="credit" value=""/></td>';  | 
                                                        
| 764 | -							print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>'; | 
                                                        |
| 764 | +							print '<td class="center"><input type="submit" class="button small" name="save" value="'.$langs->trans("Add").'"></td>'; | 
                                                        |
| 765 | 765 | print "</tr>\n";  | 
                                                        
| 766 | 766 | }  | 
                                                        
| 767 | 767 |  					} else { | 
                                                        
@@ -787,7 +787,7 @@ discard block  | 
                                                    ||
| 787 | 787 | print '<td class="center nowraponall">';  | 
                                                        
| 788 | 788 |  						if ($permissiontoadd) { | 
                                                        
| 789 | 789 |  							if (empty($line->date_export) && empty($line->date_validation)) { | 
                                                        
| 790 | - print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode((string) $mode) . '&token=' . urlencode(newToken()) . '">';  | 
                                                        |
| 790 | + print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode((string) $mode).'&token='.urlencode(newToken()).'">';  | 
                                                        |
| 791 | 791 |  								print img_edit('', 0, 'class="marginrightonly"'); | 
                                                        
| 792 | 792 | print '</a>  ';  | 
                                                        
| 793 | 793 |  							} else { | 
                                                        
@@ -802,7 +802,7 @@ discard block  | 
                                                    ||
| 802 | 802 | $actiontodelete = 'confirm_delete';  | 
                                                        
| 803 | 803 | }  | 
                                                        
| 804 | 804 | |
| 805 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode((string) $mode) . '&token=' . urlencode(newToken()) . '">';  | 
                                                        |
| 805 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode((string) $mode).'&token='.urlencode(newToken()).'">';  | 
                                                        |
| 806 | 806 | print img_delete();  | 
                                                        
| 807 | 807 | print '</a>';  | 
                                                        
| 808 | 808 |  							} else { |