Completed
Branch develop (1619c1)
by
unknown
22:26
created
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 // Put here all includes required by your class file
27
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
28
-
29
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
31
-require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
32
-
33
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
34
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
35
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
36
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
37
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
38
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
39
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
40
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
41
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
42
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
43
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
44
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
45
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
27
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
28
+
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32
+
33
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
34
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
36
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
37
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
39
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
40
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
41
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
42
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
43
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
44
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
45
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
46 46
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
47 47
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
48 48
 
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
838 838
 			$flags .= '';
839 839
 		} else {
840
-			$flags .= '/' . $this->imap_encryption;
840
+			$flags .= '/'.$this->imap_encryption;
841 841
 		}
842 842
 
843 843
 		$flags .= '/novalidate-cert';
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 	{
868 868
 		if (function_exists('mb_convert_encoding')) {
869 869
 			// change spaces by entropy because mb_convert fail with spaces
870
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
871
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
870
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
871
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
872 872
 			// if mb_convert work
873 873
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
874 874
 				// change characters
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 				}
1486 1486
 				if ($fromdate > 0) {
1487 1487
 					// $search .= ($search ? ' ' : '').'SINCE '.date('j-M-Y', $fromdate - 1); // SENTSINCE not supported. Date must be X-Abc-9999 (X on 1 digit if < 10)
1488
-					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1)));	// -1 is to add a security to no forgot some email
1488
+					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1))); // -1 is to add a security to no forgot some email
1489 1489
 				}
1490 1490
 				//$search.=($search?' ':'').'SINCE 8-Apr-2022';
1491 1491
 			}
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 				}
1513 1513
 
1514 1514
 				if ($rule['type'] == 'from') {
1515
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1515
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1516 1516
 					if (count($tmprulevaluearray) >= 2) {
1517 1517
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1518 1518
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 					}
1523 1523
 				}
1524 1524
 				if ($rule['type'] == 'to') {
1525
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1525
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1526 1526
 					if (count($tmprulevaluearray) >= 2) {
1527 1527
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1528 1528
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 					$tmpsourcedir = $this->getEncodedUtf7($sourcedir);
1652 1652
 				}
1653 1653
 
1654
-				$f = $client->getFolders(false, $tmpsourcedir);	// Note the search of directory do a search on sourcedir*
1654
+				$f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir*
1655 1655
 				if ($f) {
1656 1656
 					$folder = $f[0];
1657 1657
 					if ($folder instanceof Webklex\PHPIMAP\Folder) {
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 					$Query->leaveUnread();
1690 1690
 				}
1691 1691
 				$arrayofemail = $Query->limit($this->maxemailpercollect)->setFetchOrder("asc")->get();
1692
-				dol_syslog("EmailCollector::doCollectOneCollector nb arrayofemail ".(is_array($arrayofemail) ? count($arrayofemail) : 'Not array'));	// @phpstan-ignore-line
1692
+				dol_syslog("EmailCollector::doCollectOneCollector nb arrayofemail ".(is_array($arrayofemail) ? count($arrayofemail) : 'Not array')); // @phpstan-ignore-line
1693 1693
 				//var_dump($arrayofemail);
1694 1694
 			} catch (Exception $e) {
1695 1695
 				$this->error = $e->getMessage();
@@ -1712,7 +1712,7 @@  discard block
 block discarded – undo
1712 1712
 			}
1713 1713
 		}
1714 1714
 
1715
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1715
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1716 1716
 
1717 1717
 		// Loop on each email found
1718 1718
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0 && $connection !== false) {
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 				// GET header and overview datas
1745 1745
 				if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
1746 1746
 					'@phan-var-force Webklex\PHPIMAP\Message $imapemail';
1747
-					$header = $imapemail->getHeader()->raw;  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1747
+					$header = $imapemail->getHeader()->raw; // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1748 1748
 					$overview = $imapemail->getAttributes();
1749 1749
 				} else {
1750 1750
 					$header = imap_fetchheader($connection, $imapemail, FT_UID);
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
 						$attachments = [];
1972 1972
 					}
1973 1973
 				} else {
1974
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1974
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1975 1975
 				}
1976 1976
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1977 1977
 
@@ -2068,10 +2068,10 @@  discard block
 block discarded – undo
2068 2068
 					$sendtocc = empty($overview['cc']) ? '' : $overview['cc'];
2069 2069
 					$sendtobcc = empty($overview['bcc']) ? '' : $overview['bcc'];
2070 2070
 
2071
-					$tmpdate = $overview['date']->toDate();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2072
-					$tmptimezone = $tmpdate->getTimezone()->getName();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2071
+					$tmpdate = $overview['date']->toDate(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2072
+					$tmptimezone = $tmpdate->getTimezone()->getName(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2073 2073
 
2074
-					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt');    // if $overview['timezone'] is "+00:00"
2074
+					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00"
2075 2075
 					if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) {
2076 2076
 						if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) {
2077 2077
 							$dateemail -= (3600 * (int) $reg[2]);
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
 					$subject = $overview['subject'];
2086 2086
 				} else {
2087 2087
 					$fromstring = $overview[0]->from;
2088
-					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ;
2088
+					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : ""));
2089 2089
 
2090 2090
 					$sender = !empty($overview[0]->sender) ? $overview[0]->sender : '';
2091 2091
 					$to = $overview[0]->to;
@@ -2156,17 +2156,17 @@  discard block
 block discarded – undo
2156 2156
 				foreach ($arrayofreferences as $reference) {
2157 2157
 					//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n";
2158 2158
 					if (!empty($trackidfoundintorecipienttype)) {
2159
-						$resultsearchtrackid = -1;		// trackid found
2159
+						$resultsearchtrackid = -1; // trackid found
2160 2160
 						$reg[1] = $trackidfoundintorecipienttype;
2161 2161
 						$reg[2] = $trackidfoundintorecipientid;
2162 2162
 					} elseif (!empty($trackidfoundintomsgidtype)) {
2163
-						$resultsearchtrackid = -1;		// trackid found
2163
+						$resultsearchtrackid = -1; // trackid found
2164 2164
 						$reg[1] = $trackidfoundintomsgidtype;
2165 2165
 						$reg[2] = $trackidfoundintomsgidid;
2166 2166
 					} else {
2167
-						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg);	// trackid found or not
2167
+						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not
2168 2168
 						if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) {
2169
-							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg);	// trackid found
2169
+							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found
2170 2170
 						}
2171 2171
 					}
2172 2172
 
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
 									}
2334 2334
 								}
2335 2335
 								if ($changeonticket_references) {
2336
-									$objectemail->update($user, 1);		// We complete the references field, that is a field for technical tracking purpose, not a user field, so no need to execute triggers
2336
+									$objectemail->update($user, 1); // We complete the references field, that is a field for technical tracking purpose, not a user field, so no need to execute triggers
2337 2337
 								}
2338 2338
 							}
2339 2339
 						}
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 
2463 2463
 						// Make Operation
2464 2464
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2465
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2465
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2466 2466
 
2467 2467
 						// Try to guess if this is an email in or out.
2468 2468
 						$actioncode = 'EMAIL_IN';
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 									$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid;
2518 2518
 									$ticketalreadyexists = 0;
2519 2519
 								} else {
2520
-									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid;	// We change the operation type to do
2520
+									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid; // We change the operation type to do
2521 2521
 									$ticketalreadyexists = 1;
2522 2522
 									$operation['type'] = 'recordevent';
2523 2523
 								}
@@ -2758,11 +2758,11 @@  discard block
 block discarded – undo
2758 2758
 									$result = $contactstatic->fetch(0, null, '', $from);
2759 2759
 									if ($result < 0) {
2760 2760
 										$errorforactions++;
2761
-										$this->error = 'Error when getting contact with email ' . $from;
2761
+										$this->error = 'Error when getting contact with email '.$from;
2762 2762
 										$this->errors[] = $this->error;
2763 2763
 										break;
2764 2764
 									} elseif ($result == 0) {
2765
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2765
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2766 2766
 										$contactstatic = new Contact($this->db);
2767 2767
 
2768 2768
 										// Create contact
@@ -2777,28 +2777,28 @@  discard block
 block discarded – undo
2777 2777
 										} else {
2778 2778
 											// Search country by name or code
2779 2779
 											if (!empty($contactstatic->country)) {
2780
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2780
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2781 2781
 												$result = getCountry('', '3', $this->db, null, 1, $contactstatic->country);
2782 2782
 												if ($result == 'NotDefined') {
2783 2783
 													$errorforactions++;
2784
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2784
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2785 2785
 												} elseif (!($result > 0)) {
2786 2786
 													$errorforactions++;
2787
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2787
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2788 2788
 													$this->errors[] = $this->db->lasterror();
2789 2789
 												} else {
2790 2790
 													$contactstatic->country_id = $result;
2791 2791
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2792 2792
 												}
2793 2793
 											} elseif (!empty($contactstatic->country_code)) {
2794
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2794
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2795 2795
 												$result = getCountry($contactstatic->country_code, '3', $this->db);
2796 2796
 												if ($result == 'NotDefined') {
2797 2797
 													$errorforactions++;
2798
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2798
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2799 2799
 												} elseif (!($result > 0)) {
2800 2800
 													$errorforactions++;
2801
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2801
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2802 2802
 													$this->errors[] = $this->db->lasterror();
2803 2803
 												} else {
2804 2804
 													$contactstatic->country_id = $result;
@@ -2809,28 +2809,28 @@  discard block
 block discarded – undo
2809 2809
 											if (!$errorforactions) {
2810 2810
 												// Search state by name or code (for country if defined)
2811 2811
 												if (!empty($contactstatic->state)) {
2812
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2812
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2813 2813
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2814 2814
 													if (empty($result)) {
2815 2815
 														$errorforactions++;
2816
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2816
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2817 2817
 													} elseif (!($result > 0)) {
2818 2818
 														$errorforactions++;
2819
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2819
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2820 2820
 														$this->errors[] = $this->db->lasterror();
2821 2821
 													} else {
2822 2822
 														$contactstatic->state_id = $result;
2823 2823
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2824 2824
 													}
2825 2825
 												} elseif (!empty($contactstatic->state_code)) {
2826
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2826
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2827 2827
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2828 2828
 													if (empty($result)) {
2829 2829
 														$errorforactions++;
2830
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2830
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2831 2831
 													} elseif (!($result > 0)) {
2832 2832
 														$errorforactions++;
2833
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2833
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2834 2834
 														$this->errors[] = $this->db->lasterror();
2835 2835
 													} else {
2836 2836
 														$contactstatic->state_id = $result;
@@ -2895,8 +2895,8 @@  discard block
 block discarded – undo
2895 2895
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2896 2896
 								$actioncomm->note_private = $descriptionfull;
2897 2897
 								$actioncomm->fk_project  = $projectstatic->id;
2898
-								$actioncomm->datep       = $dateemail;	// date of email
2899
-								$actioncomm->datef       = $dateemail;	// date of email
2898
+								$actioncomm->datep       = $dateemail; // date of email
2899
+								$actioncomm->datef       = $dateemail; // date of email
2900 2900
 								$actioncomm->percentage  = -1; // Not applicable
2901 2901
 								$actioncomm->socid       = $thirdpartystatic->id;
2902 2902
 								$actioncomm->contact_id = $contactstatic->id;
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
 								}
3096 3096
 								$hookmanager->initHooks(array('emailcolector'));
3097 3097
 								$parameters = array('arrayobject' => $arrayobject);
3098
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
3098
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
3099 3099
 								if ($reshook > 0) {
3100 3100
 									$arrayobject = $hookmanager->resArray;
3101 3101
 								}
@@ -3104,10 +3104,10 @@  discard block
 block discarded – undo
3104 3104
 
3105 3105
 								foreach ($arrayobject as $key => $objectdesc) {
3106 3106
 									$sql = 'SELECT DISTINCT t.rowid ';
3107
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
3107
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
3108 3108
 									$sql .= ' WHERE ';
3109 3109
 									foreach ($objectdesc['fields'] as $field) {
3110
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
3110
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
3111 3111
 									}
3112 3112
 									$sql = substr($sql, 0, -4);
3113 3113
 
@@ -3128,8 +3128,8 @@  discard block
 block discarded – undo
3128 3128
 									foreach ($ids as $val) {
3129 3129
 										$res = $objectmanaged->fetch($val);
3130 3130
 										if ($res) {
3131
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
3132
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
3131
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
3132
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
3133 3133
 										} else {
3134 3134
 											$this->errors[] = 'object not found';
3135 3135
 										}
@@ -3138,7 +3138,7 @@  discard block
 block discarded – undo
3138 3138
 								foreach ($dirs as $target) {
3139 3139
 									$prefix = $this->actions[$this->id]['actionparam'];
3140 3140
 									foreach ($data as $filename => $content) {
3141
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
3141
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
3142 3142
 										if ($resr == -1) {
3143 3143
 											$this->errors[] = 'Doc not saved';
3144 3144
 										}
@@ -3185,7 +3185,7 @@  discard block
 block discarded – undo
3185 3185
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
3186 3186
 
3187 3187
 								$projecttocreate->title = $subject;
3188
-								$projecttocreate->date_start = $dateemail;	// date of email
3188
+								$projecttocreate->date_start = $dateemail; // date of email
3189 3189
 								$projecttocreate->date_end = 0;
3190 3190
 								$projecttocreate->opp_status = $id_opp_status;
3191 3191
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3473,7 +3473,7 @@  discard block
 block discarded – undo
3473 3473
 								$candidaturetocreate->note_private = $descriptionfull;
3474 3474
 								$candidaturetocreate->entity = $conf->entity;
3475 3475
 								$candidaturetocreate->email_msgid = $msgid;
3476
-								$candidaturetocreate->email_date = $dateemail;		// date of email
3476
+								$candidaturetocreate->email_date = $dateemail; // date of email
3477 3477
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3478 3478
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3479 3479
 
@@ -3882,8 +3882,8 @@  discard block
 block discarded – undo
3882 3882
 				 * append increment number to the original filename
3883 3883
 				 */
3884 3884
 				while (file_exists($destdir.$file_name.".".$extension)) {
3885
-					$file_name = $file_name_original . ' (' . $num . ')';
3886
-					$file_name_complete = $file_name . "." . $extension;
3885
+					$file_name = $file_name_original.' ('.$num.')';
3886
+					$file_name_complete = $file_name.".".$extension;
3887 3887
 					$destination = $destdir.$file_name_complete;
3888 3888
 					$num++;
3889 3889
 				}
@@ -3997,7 +3997,7 @@  discard block
 block discarded – undo
3997 3997
 	 */
3998 3998
 	private function saveAttachment($destdir, $filename, $content)
3999 3999
 	{
4000
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
4000
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
4001 4001
 
4002 4002
 		$tmparraysize = getDefaultImageSizes();
4003 4003
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +453 added lines, -453 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
  * \brief      File of withdrawal receipts class
30 30
  */
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
34
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/salary.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/user/class/userbankaccount.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
34
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
43 43
 
44 44
 
45 45
 /**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 
150 150
 	const STATUS_DRAFT = 0;
151 151
 	const STATUS_TRANSFERED = 1;
152
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
153
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
152
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
153
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
154 154
 
155 155
 
156 156
 	/**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
 		if ($result == 0) {
341 341
 			if ($line_id > 0) {
342
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement (";
342
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
343 343
 				if ($type != 'bank-transfer') {
344 344
 					$sql .= "fk_facture";
345 345
 				} else {
@@ -352,24 +352,24 @@  discard block
 block discarded – undo
352 352
 				$sql .= ",fk_prelevement_lignes";
353 353
 				$sql .= ") VALUES (";
354 354
 				$sql .= ((int) $invoice_id);
355
-				$sql .= ", " . ((int) $line_id);
355
+				$sql .= ", ".((int) $line_id);
356 356
 				$sql .= ")";
357 357
 
358 358
 				if ($this->db->query($sql)) {
359 359
 					$result = 0;
360 360
 				} else {
361 361
 					$result = -1;
362
-					$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
363
-					dol_syslog(get_class($this) . "::AddFacture Error $result");
362
+					$this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror;
363
+					dol_syslog(get_class($this)."::AddFacture Error $result");
364 364
 				}
365 365
 			} else {
366 366
 				$result = -2;
367
-				$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
368
-				dol_syslog(get_class($this) . "::AddFacture Error $result");
367
+				$this->errors[] = get_class($this)."::AddFacture linedid Empty";
368
+				dol_syslog(get_class($this)."::AddFacture Error $result");
369 369
 			}
370 370
 		} else {
371 371
 			$result = -3;
372
-			dol_syslog(get_class($this) . "::AddFacture Error $result");
372
+			dol_syslog(get_class($this)."::AddFacture Error $result");
373 373
 		}
374 374
 
375 375
 		return $result;
@@ -392,23 +392,23 @@  discard block
 block discarded – undo
392 392
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
393 393
 	{
394 394
 		$result = -1;
395
-		$concat = 0;	// ??? what is this for. Seems not used.
395
+		$concat = 0; // ??? what is this for. Seems not used.
396 396
 
397 397
 		if ($concat == 1) {
398 398
 			/*
399 399
 			 * We aggregate the lines
400 400
 			 */
401 401
 			$sql = "SELECT rowid";
402
-			$sql .= " FROM  " . MAIN_DB_PREFIX . "prelevement_lignes";
403
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
402
+			$sql .= " FROM  ".MAIN_DB_PREFIX."prelevement_lignes";
403
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
404 404
 			if ($sourcetype == 'salary') {
405
-				$sql .= " AND fk_soc = " . ((int) $client_id);
405
+				$sql .= " AND fk_soc = ".((int) $client_id);
406 406
 			} else {
407
-				$sql .= " AND fk_user = " . ((int) $client_id);
407
+				$sql .= " AND fk_user = ".((int) $client_id);
408 408
 			}
409
-			$sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'";
410
-			$sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'";
411
-			$sql .= " AND number = '" . $this->db->escape($number) . "'";
409
+			$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
410
+			$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
411
+			$sql .= " AND number = '".$this->db->escape($number)."'";
412 412
 
413 413
 			$resql = $this->db->query($sql);
414 414
 			if ($resql) {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 			/*
421 421
 			 * No aggregate
422 422
 			 */
423
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
423
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
424 424
 			$sql .= "fk_prelevement_bons";
425 425
 			$sql .= ", fk_soc";
426 426
 			$sql .= ", client_nom";
@@ -432,21 +432,21 @@  discard block
 block discarded – undo
432 432
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
433 433
 			$sql .= ") VALUES (";
434 434
 			$sql .= $this->id;
435
-			$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
436
-			$sql .= ", '" . $this->db->escape($client_nom) . "'";
437
-			$sql .= ", " . ((float) price2num($amount));
438
-			$sql .= ", '" . $this->db->escape($code_banque) . "'";
439
-			$sql .= ", '" . $this->db->escape($code_guichet) . "'";
440
-			$sql .= ", '" . $this->db->escape($number) . "'";
441
-			$sql .= ", '" . $this->db->escape($number_key) . "'";
442
-			$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
435
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
436
+			$sql .= ", '".$this->db->escape($client_nom)."'";
437
+			$sql .= ", ".((float) price2num($amount));
438
+			$sql .= ", '".$this->db->escape($code_banque)."'";
439
+			$sql .= ", '".$this->db->escape($code_guichet)."'";
440
+			$sql .= ", '".$this->db->escape($number)."'";
441
+			$sql .= ", '".$this->db->escape($number_key)."'";
442
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
443 443
 			$sql .= ")";
444 444
 			if ($this->db->query($sql)) {
445
-				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes");
445
+				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
446 446
 				$result = 0;
447 447
 			} else {
448
-				$this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror;
449
-				dol_syslog(get_class($this) . "::addline Error -2");
448
+				$this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror;
449
+				dol_syslog(get_class($this)."::addline Error -2");
450 450
 				$result = -2;
451 451
 			}
452 452
 		}
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
 		$sql .= ", p.type";
490 490
 		$sql .= ", p.fk_bank_account";
491 491
 		$sql .= ", p.statut as status";
492
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
493
-		$sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")";
492
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
493
+		$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
494 494
 		if ($rowid > 0) {
495
-			$sql .= " AND p.rowid = " . ((int) $rowid);
495
+			$sql .= " AND p.rowid = ".((int) $rowid);
496 496
 		} else {
497
-			$sql .= " AND p.ref = '" . $this->db->escape($ref) . "'";
497
+			$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
498 498
 		}
499 499
 
500
-		dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
500
+		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
501 501
 		$result = $this->db->query($sql);
502 502
 		if ($result) {
503 503
 			if ($this->db->num_rows($result)) {
@@ -523,13 +523,13 @@  discard block
 block discarded – undo
523 523
 				if (empty($this->status)) {		// Value is sometimes null in database
524 524
 					$this->status = 0;
525 525
 				}
526
-				$this->statut         = $this->status; // For backward compatibility
526
+				$this->statut = $this->status; // For backward compatibility
527 527
 
528 528
 				$this->fetched = 1;
529 529
 
530 530
 				return 1;
531 531
 			} else {
532
-				dol_syslog(get_class($this) . "::Fetch no record found");
532
+				dol_syslog(get_class($this)."::Fetch no record found");
533 533
 				return 0;
534 534
 			}
535 535
 		} else {
@@ -570,19 +570,19 @@  discard block
 block discarded – undo
570 570
 			if ($date < $this->date_trans) {
571 571
 				$langs->load("errors");
572 572
 				$this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission');
573
-				dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error);
573
+				dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
574 574
 				return -1027;
575 575
 			}
576 576
 
577 577
 			$this->db->begin();
578 578
 
579
-			$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
580
-			$sql .= " SET fk_user_credit = " . ((int) $user->id);
581
-			$sql .= ", statut = " . self::STATUS_CREDITED;
582
-			$sql .= ", date_credit = '" . $this->db->idate($date) . "'";
583
-			$sql .= " WHERE rowid = " . ((int) $this->id);
584
-			$sql .= " AND entity = " . ((int) $conf->entity);
585
-			$sql .= " AND statut = " . self::STATUS_TRANSFERED;
579
+			$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
580
+			$sql .= " SET fk_user_credit = ".((int) $user->id);
581
+			$sql .= ", statut = ".self::STATUS_CREDITED;
582
+			$sql .= ", date_credit = '".$this->db->idate($date)."'";
583
+			$sql .= " WHERE rowid = ".((int) $this->id);
584
+			$sql .= " AND entity = ".((int) $conf->entity);
585
+			$sql .= " AND statut = ".self::STATUS_TRANSFERED;
586 586
 
587 587
 			$resql = $this->db->query($sql);
588 588
 			if ($resql) {
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 						$error++;
697 697
 						$this->error = $paiement->error;
698 698
 						$this->errors = $paiement->errors;
699
-						dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error);
699
+						dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
700 700
 					} else {
701 701
 						if ($this->type == 'bank-transfer') {
702 702
 							if ($type == 'salary') {
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 						} else {
712 712
 							$modeforaddpayment = 'payment';
713 713
 							$labelforaddpayment = '(CustomerInvoicePayment)';
714
-							$addbankurl = 'direct-debit';	// = 'directdebit'
714
+							$addbankurl = 'direct-debit'; // = 'directdebit'
715 715
 						}
716 716
 
717 717
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 							$error++;
727 727
 							$this->error = $paiement->error;
728 728
 							$this->errors = $paiement->errors;
729
-							dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error);
729
+							dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
730 730
 						}
731 731
 					}
732 732
 				}
@@ -734,24 +734,24 @@  discard block
 block discarded – undo
734 734
 				// Update withdrawal line
735 735
 				// TODO: Translate to ligneprelevement.class.php
736 736
 				if (!$error) {
737
-					$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes";
737
+					$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
738 738
 					$sql .= " SET statut = 2";
739
-					$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
739
+					$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
740 740
 
741 741
 					if (!$this->db->query($sql)) {
742
-						dol_syslog(get_class($this) . "::set_infocredit Update lines Error");
742
+						dol_syslog(get_class($this)."::set_infocredit Update lines Error");
743 743
 						$error++;
744 744
 					}
745 745
 				}
746 746
 			} else {
747 747
 				$this->error = $this->db->lasterror();
748
-				dol_syslog(get_class($this) . "::set_infocredit Update Bons Error");
748
+				dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
749 749
 				$error++;
750 750
 			}
751 751
 
752 752
 			// End of procedure
753 753
 			if ($error == 0) {
754
-				$this->date_credit = $date;		// date credit or debit
754
+				$this->date_credit = $date; // date credit or debit
755 755
 				$this->statut = self::STATUS_CREDITED;
756 756
 				$this->status = self::STATUS_CREDITED;
757 757
 
@@ -782,17 +782,17 @@  discard block
 block discarded – undo
782 782
 
783 783
 		$error = 0;
784 784
 
785
-		dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO);
785
+		dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
786 786
 
787 787
 		if ($this->db->begin()) {
788
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons ";
789
-			$sql .= " SET fk_user_trans = " . $user->id;
790
-			$sql .= " , date_trans = '" . $this->db->idate($date) . "'";
791
-			$sql .= " , method_trans = " . ((int) $method);
792
-			$sql .= " , statut = " . self::STATUS_TRANSFERED;
793
-			$sql .= " WHERE rowid = " . ((int) $this->id);
794
-			$sql .= " AND entity = " . ((int) $conf->entity);
795
-			$sql .= " AND statut = " . self::STATUS_DRAFT;
788
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
789
+			$sql .= " SET fk_user_trans = ".$user->id;
790
+			$sql .= " , date_trans = '".$this->db->idate($date)."'";
791
+			$sql .= " , method_trans = ".((int) $method);
792
+			$sql .= " , statut = ".self::STATUS_TRANSFERED;
793
+			$sql .= " WHERE rowid = ".((int) $this->id);
794
+			$sql .= " AND entity = ".((int) $conf->entity);
795
+			$sql .= " AND statut = ".self::STATUS_DRAFT;
796 796
 
797 797
 			if ($this->db->query($sql)) {
798 798
 				$this->method_trans = $method;
@@ -817,12 +817,12 @@  discard block
 block discarded – undo
817 817
 				return 0;
818 818
 			} else {
819 819
 				$this->db->rollback();
820
-				dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR);
820
+				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
821 821
 
822 822
 				return -1;
823 823
 			}
824 824
 		} else {
825
-			dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
825
+			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
826 826
 			return -2;
827 827
 		}
828 828
 	}
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 		$arr = array();
843 843
 
844
-		dol_syslog(get_class($this) . "::getListInvoices");
844
+		dol_syslog(get_class($this)."::getListInvoices");
845 845
 
846 846
 		// Returns all invoices presented within same order
847 847
 		$sql = "SELECT ";
@@ -857,13 +857,13 @@  discard block
 block discarded – undo
857 857
 		if ($amounts) {
858 858
 			$sql .= ", SUM(pl.amount)";
859 859
 		}
860
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,";
861
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
862
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
860
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
861
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
862
+		$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
863 863
 		$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
864 864
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
865
-		$sql .= " AND pb.rowid = " . ((int) $this->id);
866
-		$sql .= " AND pb.entity = " . ((int) $conf->entity);
865
+		$sql .= " AND pb.rowid = ".((int) $this->id);
866
+		$sql .= " AND pb.entity = ".((int) $conf->entity);
867 867
 		if ($amounts) {
868 868
 			if ($this->type == 'bank-transfer') {
869 869
 				if ($type == 'salary') {
@@ -917,17 +917,17 @@  discard block
 block discarded – undo
917 917
 		$sql = "SELECT sum(pd.amount) as nb";
918 918
 		if ($type !== 'salary') {
919 919
 			if ($mode != 'bank-transfer') {
920
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,";
920
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
921 921
 			} else {
922
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,";
922
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
923 923
 			}
924 924
 		} else {
925
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,";
925
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s,";
926 926
 		}
927
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd";
928
-		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")");
927
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd";
928
+		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")");
929 929
 		if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
930
-			$sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID);
930
+			$sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID);
931 931
 		}
932 932
 		if ($type !== 'salary') {
933 933
 			if ($mode != 'bank-transfer') {
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 			return $obj->nb;
953 953
 		} else {
954 954
 			$error = 1;
955
-			dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1");
955
+			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
956 956
 			dol_syslog($this->db->error());
957 957
 
958 958
 			return -1;
@@ -988,26 +988,26 @@  discard block
 block discarded – undo
988 988
 		// phpcs:enable
989 989
 		if ($forsalary == 1) {
990 990
 			$sql = "SELECT count(s.rowid) as nb";
991
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s";
991
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
992 992
 		} else {
993 993
 			$sql = "SELECT count(f.rowid) as nb";
994 994
 
995 995
 			if ($type == 'bank-transfer') {
996
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
996
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
997 997
 			} else {
998
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
998
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
999 999
 			}
1000 1000
 		}
1001
-		$sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd";
1001
+		$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd";
1002 1002
 		if ($forsalary == 1) {
1003
-			$sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")";
1003
+			$sql .= " WHERE s.entity IN (".getEntity('invoice').")";
1004 1004
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
1005 1005
 				$sql .= " AND s.paye = 0";
1006 1006
 			}
1007 1007
 		} else {
1008
-			$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
1008
+			$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
1009 1009
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
1010
-				$sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED;
1010
+				$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
1011 1011
 			}
1012 1012
 		}
1013 1013
 		if ($forsalary == 1) {
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
 			$sql .= " AND s.paye = 0";
1028 1028
 		}
1029 1029
 
1030
-		dol_syslog(get_class($this) . "::NbFactureAPrelever");
1030
+		dol_syslog(get_class($this)."::NbFactureAPrelever");
1031 1031
 		$resql = $this->db->query($sql);
1032 1032
 
1033 1033
 		if ($resql) {
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 			return $obj->nb;
1038 1038
 		} else {
1039
-			$this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error();
1039
+			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
1040 1040
 			return -1;
1041 1041
 		}
1042 1042
 	}
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 		// phpcs:enable
1069 1069
 		global $conf, $langs, $user;
1070 1070
 
1071
-		dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG);
1071
+		dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
1072 1072
 
1073
-		require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
1074
-		require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
1073
+		require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
1074
+		require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
1075 1075
 
1076 1076
 		// Check params
1077 1077
 		if ($type != 'bank-transfer') {
@@ -1103,15 +1103,15 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
 		// Check if there is an iban associated to bank transfer or if we take the default
1105 1105
 		$sql = "SELECT fk_societe_rib";
1106
-		$sql .= " FROM " . $this->db->prefix() . "prelevement_demande as pd";
1107
-		$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->escape($sqlTable) . " as f ON f.rowid = pd.fk_".$this->db->escape($sqlTable);
1108
-		$sql .= " WHERE f.entity IN (" . $this->db->escape($entity) . ')';
1106
+		$sql .= " FROM ".$this->db->prefix()."prelevement_demande as pd";
1107
+		$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->escape($sqlTable)." as f ON f.rowid = pd.fk_".$this->db->escape($sqlTable);
1108
+		$sql .= " WHERE f.entity IN (".$this->db->escape($entity).')';
1109 1109
 
1110 1110
 		$resql = $this->db->query($sql);
1111 1111
 
1112 1112
 		if (!$resql) {
1113 1113
 			$this->error = $this->db->lasterror();
1114
-			dol_syslog(__METHOD__ . " Read fk_societe_rib error " . $this->db->lasterror(), LOG_ERR);
1114
+			dol_syslog(__METHOD__." Read fk_societe_rib error ".$this->db->lasterror(), LOG_ERR);
1115 1115
 			return -1;
1116 1116
 		}
1117 1117
 		$societeRibID = 0;
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 		$factures_errors = array();
1142 1142
 
1143 1143
 		if (!$error) {
1144
-			dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG);
1144
+			dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG);
1145 1145
 
1146 1146
 			$sql = "SELECT f.rowid, pd.rowid as pfdrowid";
1147 1147
 			$sql .= ", f.".$this->db->escape($socOrUser);
@@ -1154,20 +1154,20 @@  discard block
 block discarded – undo
1154 1154
 				$sql .= ", CONCAT(s.firstname,' ',s.lastname) as name";
1155 1155
 				$sql .= ", f.ref, sr.bic, sr.iban_prefix, 'FRST' as frstrecur";
1156 1156
 			}
1157
-			$sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f";
1158
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->escape($sqlTable);
1159
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $societeOrUser." as s ON s.rowid = f.".$this->db->escape($socOrUser);
1160
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $societeOrUser."_rib as sr ON s.rowid = sr.".$this->db->escape($socOrUser);
1157
+			$sql .= " FROM ".$this->db->prefix().$sqlTable." as f";
1158
+			$sql .= " LEFT JOIN ".$this->db->prefix()."prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->escape($sqlTable);
1159
+			$sql .= " LEFT JOIN ".$this->db->prefix().$societeOrUser." as s ON s.rowid = f.".$this->db->escape($socOrUser);
1160
+			$sql .= " LEFT JOIN ".$this->db->prefix().$societeOrUser."_rib as sr ON s.rowid = sr.".$this->db->escape($socOrUser);
1161 1161
 			if ($sourcetype != 'salary') {
1162 1162
 				if (!empty($societeRibID)) {
1163
-					$sql .= " AND sr.rowid = " . intval($societeRibID);
1163
+					$sql .= " AND sr.rowid = ".intval($societeRibID);
1164 1164
 				} else {
1165 1165
 					$sql .= " AND sr.default_rib = 1";
1166 1166
 				}
1167 1167
 				// TODO Add 'AND sr.default_rib = 1' in sourcetype salary too Note: the column has been created in v21 in llx_user_rib and default to 0
1168 1168
 				// If we add a test on sr.default_rib = 1, we must also check we have a correct error management to stop if no default BAN is found.
1169 1169
 			}
1170
-			$sql .= " WHERE f.entity IN (" . $this->db->escape($entity) . ')';
1170
+			$sql .= " WHERE f.entity IN (".$this->db->escape($entity).')';
1171 1171
 			if ($sourcetype != 'salary') {
1172 1172
 				$sql .= " AND f.fk_statut = 1"; // Invoice validated
1173 1173
 				$sql .= " AND f.paye = 0";
@@ -1180,10 +1180,10 @@  discard block
 block discarded – undo
1180 1180
 			$sql .= " AND pd.traite = 0";
1181 1181
 			$sql .= " AND pd.ext_payment_id IS NULL";
1182 1182
 			if ($sourcetype != 'salary') {
1183
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1183
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1184 1184
 			}
1185 1185
 			if ($did > 0) {
1186
-				$sql .= " AND pd.rowid = " . ((int) $did);
1186
+				$sql .= " AND pd.rowid = ".((int) $did);
1187 1187
 			}
1188 1188
 
1189 1189
 			$resql = $this->db->query($sql);
@@ -1192,41 +1192,41 @@  discard block
 block discarded – undo
1192 1192
 				$i = 0;
1193 1193
 
1194 1194
 				while ($i < $num) {
1195
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1195
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1196 1196
 					'@phan-var-force array<int<0,12>,string> $row';
1197 1197
 					$factures[$i] = $row; // All fields
1198 1198
 
1199 1199
 					if ($row[7] == 0) {
1200 1200
 						$error++;
1201
-						dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR);
1202
-						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount";
1201
+						dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR);
1202
+						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount";
1203 1203
 						break;
1204 1204
 					}
1205 1205
 					$i++;
1206 1206
 				}
1207 1207
 
1208 1208
 				$this->db->free($resql);
1209
-				dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG);
1209
+				dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG);
1210 1210
 			} else {
1211 1211
 				$this->error = $this->db->lasterror();
1212
-				dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR);
1212
+				dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR);
1213 1213
 				return -1;
1214 1214
 			}
1215 1215
 		}
1216 1216
 
1217 1217
 		if (!$error) {
1218 1218
 			// Make some checks
1219
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1220
-			require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1221
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
1222
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
1219
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1220
+			require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1221
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1222
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
1223 1223
 
1224 1224
 			$tmpsoc = new Societe($this->db);
1225 1225
 			$tmpuser = new User($this->db);
1226 1226
 
1227 1227
 			// Check BAN
1228 1228
 			$i = 0;
1229
-			dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG);
1229
+			dol_syslog(__METHOD__." Check BAN", LOG_DEBUG);
1230 1230
 
1231 1231
 			if (count($factures) > 0) {
1232 1232
 				foreach ($factures as $key => $fac) {
@@ -1266,31 +1266,31 @@  discard block
 block discarded – undo
1266 1266
 							if ($type != 'bank-transfer') {
1267 1267
 								$tmpsoc->id = (int) $fac[2];
1268 1268
 								$tmpsoc->name = $fac[8];
1269
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1270
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1271
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1269
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1270
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1271
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1272 1272
 								$error++;
1273 1273
 							}
1274 1274
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1275 1275
 								$tmpsoc->id = (int) $fac[2];
1276 1276
 								$tmpsoc->name = $fac[8];
1277
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1278
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1279
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1277
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1278
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1279
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1280 1280
 								$error++;
1281 1281
 							}
1282 1282
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1283 1283
 								$tmpuser->id = (int) $fac[2];
1284 1284
 								$tmpuser->firstname = $fac[8];
1285
-								$salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>";
1286
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1287
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1285
+								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1286
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1287
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1288 1288
 								$error++;
1289 1289
 							}
1290
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING);
1290
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING);
1291 1291
 						}
1292 1292
 					} else {
1293
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1293
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1294 1294
 					}
1295 1295
 					/*
1296 1296
 					} else {
@@ -1299,14 +1299,14 @@  discard block
 block discarded – undo
1299 1299
 					*/
1300 1300
 				}
1301 1301
 			} else {
1302
-				dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING);
1302
+				dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING);
1303 1303
 			}
1304 1304
 		}
1305 1305
 
1306 1306
 		$ok = 0;
1307 1307
 
1308 1308
 		// Withdraw invoices in factures_prev array
1309
-		$out = count($factures_prev) . " invoices will be included.";
1309
+		$out = count($factures_prev)." invoices will be included.";
1310 1310
 		//print $out."\n";
1311 1311
 		dol_syslog($out);
1312 1312
 
@@ -1340,32 +1340,32 @@  discard block
 block discarded – undo
1340 1340
 			 * Process order generation
1341 1341
 			 */
1342 1342
 			if (!$error) {
1343
-				$ref = substr($year, -2) . $month;
1343
+				$ref = substr($year, -2).$month;
1344 1344
 
1345 1345
 				// Get next free number for the ref of bon prelevement
1346
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1347
-				$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
1348
-				$sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'";
1349
-				$sql .= " AND entity = " . ((int) $conf->entity);
1346
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1347
+				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1348
+				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1349
+				$sql .= " AND entity = ".((int) $conf->entity);
1350 1350
 				$sql .= " ORDER BY ref DESC LIMIT 1";
1351 1351
 
1352
-				dol_syslog(get_class($this) . " get next free number", LOG_DEBUG);
1352
+				dol_syslog(get_class($this)." get next free number", LOG_DEBUG);
1353 1353
 				$resql = $this->db->query($sql);
1354 1354
 
1355 1355
 				if ($resql) {
1356 1356
 					$row = $this->db->fetch_row($resql);
1357 1357
 
1358 1358
 					// Build the new ref
1359
-					$ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1));
1359
+					$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
1360 1360
 
1361 1361
 					// $conf->abc->dir_output may be:
1362 1362
 					// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
1363 1363
 					// or
1364 1364
 					// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
1365 1365
 					if ($type != 'bank-transfer') {
1366
-						$dir = $conf->prelevement->dir_output . '/receipts';
1366
+						$dir = $conf->prelevement->dir_output.'/receipts';
1367 1367
 					} else {
1368
-						$dir = $conf->paymentbybanktransfer->dir_output . '/receipts';
1368
+						$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
1369 1369
 					}
1370 1370
 					if (!is_dir($dir)) {
1371 1371
 						dol_mkdir($dir);
@@ -1373,41 +1373,41 @@  discard block
 block discarded – undo
1373 1373
 
1374 1374
 					if (isModEnabled('multicompany')) {
1375 1375
 						$labelentity = $conf->entity;
1376
-						$this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml';
1376
+						$this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml';
1377 1377
 					} else {
1378
-						$this->filename = $dir . '/' . $ref . '.xml';
1378
+						$this->filename = $dir.'/'.$ref.'.xml';
1379 1379
 					}
1380 1380
 
1381 1381
 					// Create withdraw order in database
1382
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
1382
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
1383 1383
 					$sql .= "ref, entity, datec, type, fk_bank_account";
1384 1384
 					$sql .= ") VALUES (";
1385
-					$sql .= "'" . $this->db->escape($ref) . "'";
1386
-					$sql .= ", " . ((int) $conf->entity);
1387
-					$sql .= ", '" . $this->db->idate($now) . "'";
1388
-					$sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'";
1389
-					$sql .= ", " . ((int) $fk_bank_account);
1385
+					$sql .= "'".$this->db->escape($ref)."'";
1386
+					$sql .= ", ".((int) $conf->entity);
1387
+					$sql .= ", '".$this->db->idate($now)."'";
1388
+					$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
1389
+					$sql .= ", ".((int) $fk_bank_account);
1390 1390
 					$sql .= ")";
1391 1391
 
1392 1392
 					$resql = $this->db->query($sql);
1393 1393
 
1394 1394
 
1395 1395
 					if ($resql) {
1396
-						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
1396
+						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
1397 1397
 						$this->id = $prev_id;
1398 1398
 						$this->ref = $ref;
1399 1399
 					} else {
1400 1400
 						$error++;
1401
-						dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1401
+						dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1402 1402
 					}
1403 1403
 				} else {
1404 1404
 					$error++;
1405
-					dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1405
+					dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1406 1406
 				}
1407 1407
 			}
1408 1408
 
1409 1409
 			if (!$error) {
1410
-				dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande");
1410
+				dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
1411 1411
 
1412 1412
 				// Add lines for the bon
1413 1413
 				if (count($factures_prev) > 0) {
@@ -1436,17 +1436,17 @@  discard block
 block discarded – undo
1436 1436
 						}
1437 1437
 
1438 1438
 						// Update invoice requests as done
1439
-						$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande";
1439
+						$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
1440 1440
 						$sql .= " SET traite = 1";
1441
-						$sql .= ", date_traite = '" . $this->db->idate($now) . "'";
1442
-						$sql .= ", fk_prelevement_bons = " . ((int) $this->id);
1443
-						$sql .= " WHERE rowid = " . ((int) $fac[1]);
1441
+						$sql .= ", date_traite = '".$this->db->idate($now)."'";
1442
+						$sql .= ", fk_prelevement_bons = ".((int) $this->id);
1443
+						$sql .= " WHERE rowid = ".((int) $fac[1]);
1444 1444
 
1445 1445
 						$resql = $this->db->query($sql);
1446 1446
 						if (!$resql) {
1447 1447
 							$error++;
1448 1448
 							$this->errors[] = $this->db->lasterror();
1449
-							dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR);
1449
+							dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR);
1450 1450
 						}
1451 1451
 					}
1452 1452
 				}
@@ -1457,7 +1457,7 @@  discard block
 block discarded – undo
1457 1457
 				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
1458 1458
 				 */
1459 1459
 
1460
-				dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG);
1460
+				dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
1461 1461
 
1462 1462
 				if (count($factures_prev) > 0) {
1463 1463
 					$this->date_echeance = $datetimeprev;
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 						$this->emetteur_iban               = $account->iban;
1474 1474
 						$this->emetteur_bic                = $account->bic;
1475 1475
 
1476
-						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);	// Example "FR78ZZZ123456"
1476
+						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456"
1477 1477
 
1478 1478
 						$this->raison_sociale = $account->owner_name;
1479 1479
 					}
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 						$error++;
1493 1493
 					}
1494 1494
 				}
1495
-				dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG);
1495
+				dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG);
1496 1496
 			}
1497 1497
 
1498 1498
 
@@ -1500,15 +1500,15 @@  discard block
 block discarded – undo
1500 1500
 			 * Update total defined after generation of file
1501 1501
 			 */
1502 1502
 			if (!$error) {
1503
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
1504
-				$sql .= " SET amount = " . price2num($this->total);
1505
-				$sql .= " WHERE rowid = " . ((int) $this->id);
1506
-				$sql .= " AND entity = " . ((int) $conf->entity);
1503
+				$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
1504
+				$sql .= " SET amount = ".price2num($this->total);
1505
+				$sql .= " WHERE rowid = ".((int) $this->id);
1506
+				$sql .= " AND entity = ".((int) $conf->entity);
1507 1507
 				$resql = $this->db->query($sql);
1508 1508
 
1509 1509
 				if (!$resql) {
1510 1510
 					$error++;
1511
-					dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR);
1511
+					dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR);
1512 1512
 				}
1513 1513
 			}
1514 1514
 
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 
1529 1529
 			if (!$error) {
1530 1530
 				$this->db->commit();
1531
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1531
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1532 1532
 			} else {
1533 1533
 				$this->db->rollback();
1534 1534
 				return -1;
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 		}
1568 1568
 
1569 1569
 		if (!$error) {
1570
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id) . ")";
1570
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
1571 1571
 			$resql1 = $this->db->query($sql);
1572 1572
 			if (!$resql1) {
1573 1573
 				dol_print_error($this->db);
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
 		}
1576 1576
 
1577 1577
 		if (!$error) {
1578
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id);
1578
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id);
1579 1579
 			$resql2 = $this->db->query($sql);
1580 1580
 			if (!$resql2) {
1581 1581
 				dol_print_error($this->db);
@@ -1583,7 +1583,7 @@  discard block
 block discarded – undo
1583 1583
 		}
1584 1584
 
1585 1585
 		if (!$error) {
1586
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id);
1586
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id);
1587 1587
 			$resql3 = $this->db->query($sql);
1588 1588
 			if (!$resql3) {
1589 1589
 				dol_print_error($this->db);
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 		}
1592 1592
 
1593 1593
 		if (!$error) {
1594
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id);
1594
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
1595 1595
 			$resql4 = $this->db->query($sql);
1596 1596
 			if (!$resql4) {
1597 1597
 				dol_print_error($this->db);
@@ -1633,22 +1633,22 @@  discard block
 block discarded – undo
1633 1633
 			$labeltoshow = 'PaymentByBankTransfer';
1634 1634
 		}
1635 1635
 
1636
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5);
1636
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5);
1637 1637
 		$label .= '<br>';
1638
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1638
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1639 1639
 		if (isset($this->amount)) {
1640
-			$label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount);
1640
+			$label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount);
1641 1641
 		}
1642 1642
 		if (isset($this->date_trans)) {
1643
-			$label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1643
+			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1644 1644
 		}
1645 1645
 		/*if (isset($this->date_credit)) {
1646 1646
 			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel');
1647 1647
 		}*/
1648 1648
 
1649
-		$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1649
+		$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1650 1650
 		if (!empty($this->type) && $this->type == 'bank-transfer') {
1651
-			$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1651
+			$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1652 1652
 		}
1653 1653
 
1654 1654
 		if ($option != 'nolink') {
@@ -1666,21 +1666,21 @@  discard block
 block discarded – undo
1666 1666
 		if (empty($notooltip)) {
1667 1667
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1668 1668
 				$label = $langs->trans("ShowMyObject");
1669
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1669
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1670 1670
 			}
1671
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1672
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1671
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1672
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1673 1673
 		} else {
1674
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1674
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1675 1675
 		}
1676 1676
 
1677
-		$linkstart = '<a href="' . $url . '"';
1678
-		$linkstart .= $linkclose . '>';
1677
+		$linkstart = '<a href="'.$url.'"';
1678
+		$linkstart .= $linkclose.'>';
1679 1679
 		$linkend = '</a>';
1680 1680
 
1681 1681
 		$result .= $linkstart;
1682 1682
 		if ($withpicto) {
1683
-			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1683
+			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1684 1684
 		}
1685 1685
 		if ($withpicto != 2) {
1686 1686
 			$result .= $this->ref;
@@ -1709,8 +1709,8 @@  discard block
 block discarded – undo
1709 1709
 	 */
1710 1710
 	public function deleteNotificationById($rowid)
1711 1711
 	{
1712
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1713
-		$sql .= " WHERE rowid = " . ((int) $rowid);
1712
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1713
+		$sql .= " WHERE rowid = ".((int) $rowid);
1714 1714
 
1715 1715
 		if ($this->db->query($sql)) {
1716 1716
 			return 0;
@@ -1734,8 +1734,8 @@  discard block
 block discarded – undo
1734 1734
 			$userid = $user;
1735 1735
 		}
1736 1736
 
1737
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1738
-		$sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'";
1737
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1738
+		$sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'";
1739 1739
 
1740 1740
 		if ($this->db->query($sql)) {
1741 1741
 			return 0;
@@ -1767,15 +1767,15 @@  discard block
 block discarded – undo
1767 1767
 		if ($this->deleteNotification($user, $action) == 0) {
1768 1768
 			$now = dol_now();
1769 1769
 
1770
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1771
-			$sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')";
1770
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1771
+			$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
1772 1772
 
1773
-			dol_syslog("adnotiff: " . $sql);
1773
+			dol_syslog("adnotiff: ".$sql);
1774 1774
 			if ($this->db->query($sql)) {
1775 1775
 				$result = 0;
1776 1776
 			} else {
1777 1777
 				$result = -1;
1778
-				dol_syslog(get_class($this) . "::addNotification Error $result");
1778
+				dol_syslog(get_class($this)."::addNotification Error $result");
1779 1779
 			}
1780 1780
 		}
1781 1781
 
@@ -1811,7 +1811,7 @@  discard block
 block discarded – undo
1811 1811
 
1812 1812
 		$result = 0;
1813 1813
 
1814
-		dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type);
1814
+		dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type);
1815 1815
 
1816 1816
 		$this->file = fopen($this->filename, "w");
1817 1817
 		if ($this->file == false) {
@@ -1857,20 +1857,20 @@  discard block
 block discarded – undo
1857 1857
 				$sql .= " f.ref as reffac, p.fk_facture as idfac,";
1858 1858
 				$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1859 1859
 				$sql .= " FROM";
1860
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1861
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1862
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1863
-				$sql .= " " . MAIN_DB_PREFIX . "societe as soc,";
1864
-				$sql .= " " . MAIN_DB_PREFIX . "c_country as c,";
1865
-				$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1866
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1860
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1861
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1862
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1863
+				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
1864
+				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
1865
+				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1866
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1867 1867
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1868 1868
 				$sql .= " AND p.fk_facture = f.rowid";
1869 1869
 				$sql .= " AND f.fk_soc = soc.rowid";
1870 1870
 				$sql .= " AND soc.fk_pays = c.rowid";
1871 1871
 				$sql .= " AND rib.fk_soc = f.fk_soc";
1872 1872
 				if (!empty($societeRibID)) {
1873
-					$sql .= " AND rib.rowid = " . intval($societeRibID);
1873
+					$sql .= " AND rib.rowid = ".intval($societeRibID);
1874 1874
 				} else {
1875 1875
 					$sql .= " AND rib.default_rib = 1";
1876 1876
 				}
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
 					$nbtotalDrctDbtTxInf = $i;
1905 1905
 				} else {
1906 1906
 					$this->error = $this->db->lasterror();
1907
-					fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers
1907
+					fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
1908 1908
 					$result = -2;
1909 1909
 				}
1910 1910
 
@@ -1921,26 +1921,26 @@  discard block
 block discarded – undo
1921 1921
 				 * SECTION CREATION SEPA FILE - ISO200022
1922 1922
 				 */
1923 1923
 				// SEPA File Header
1924
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1925
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
1926
-				fwrite($this->file, '	<CstmrDrctDbtInitn>' . $CrLf);
1924
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1925
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
1926
+				fwrite($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
1927 1927
 				// SEPA Group header
1928
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1929
-				fwrite($this->file, '			<MsgId>' . ('DD/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1930
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1931
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1932
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1933
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1934
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1935
-				fwrite($this->file, '				<Id>' . $CrLf);
1936
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1937
-				fwrite($this->file, '					<Othr>' . $CrLf);
1938
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1939
-				fwrite($this->file, '					</Othr>' . $CrLf);
1940
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1941
-				fwrite($this->file, '				</Id>' . $CrLf);
1942
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1943
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1928
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1929
+				fwrite($this->file, '			<MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1930
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1931
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1932
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1933
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1934
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1935
+				fwrite($this->file, '				<Id>'.$CrLf);
1936
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1937
+				fwrite($this->file, '					<Othr>'.$CrLf);
1938
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1939
+				fwrite($this->file, '					</Othr>'.$CrLf);
1940
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1941
+				fwrite($this->file, '				</Id>'.$CrLf);
1942
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1943
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1944 1944
 				// SEPA File Emetteur
1945 1945
 				if ($result != -2) {
1946 1946
 					fwrite($this->file, $fileEmetteurSection);
@@ -1950,9 +1950,9 @@  discard block
 block discarded – undo
1950 1950
 					fwrite($this->file, $fileDebiteurSection);
1951 1951
 				}
1952 1952
 				// SEPA FILE FOOTER
1953
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1954
-				fwrite($this->file, '	</CstmrDrctDbtInitn>' . $CrLf);
1955
-				fwrite($this->file, '</Document>' . $CrLf);
1953
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1954
+				fwrite($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
1955
+				fwrite($this->file, '</Document>'.$CrLf);
1956 1956
 			} else {
1957 1957
 				/**
1958 1958
 				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
@@ -1984,13 +1984,13 @@  discard block
 block discarded – undo
1984 1984
 					$sql .= " s.ref as reffac, p.fk_salary as idfac,";
1985 1985
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
1986 1986
 					$sql .= " FROM";
1987
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1988
-					$sql .= " " . MAIN_DB_PREFIX . "salary as s,";
1989
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1990
-					$sql .= " " . MAIN_DB_PREFIX . "user as u";
1991
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,";
1992
-					$sql .= " " . MAIN_DB_PREFIX . "user_rib as rib";
1993
-					$sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id);
1987
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1988
+					$sql .= " ".MAIN_DB_PREFIX."salary as s,";
1989
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1990
+					$sql .= " ".MAIN_DB_PREFIX."user as u";
1991
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
1992
+					$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
1993
+					$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
1994 1994
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1995 1995
 					$sql .= " AND p.fk_salary = s.rowid";
1996 1996
 					$sql .= " AND s.fk_user = u.rowid";
@@ -2001,19 +2001,19 @@  discard block
 block discarded – undo
2001 2001
 					$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
2002 2002
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
2003 2003
 					$sql .= " FROM";
2004
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2005
-					$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2006
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
2007
-					$sql .= " " . MAIN_DB_PREFIX . "societe as soc";
2008
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,";
2009
-					$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
2010
-					$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2004
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2005
+					$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2006
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
2007
+					$sql .= " ".MAIN_DB_PREFIX."societe as soc";
2008
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
2009
+					$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
2010
+					$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2011 2011
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2012 2012
 					$sql .= " AND p.fk_facture_fourn = f.rowid";
2013 2013
 					$sql .= " AND f.fk_soc = soc.rowid";
2014 2014
 					$sql .= " AND rib.fk_soc = f.fk_soc";
2015 2015
 					if (!empty($societeRibID)) {
2016
-						$sql .= " AND rib.rowid = " . intval($societeRibID);
2016
+						$sql .= " AND rib.rowid = ".intval($societeRibID);
2017 2017
 					} else {
2018 2018
 						$sql .= " AND rib.default_rib = 1";
2019 2019
 					}
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
 						$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
2041 2041
 						$refobj = $obj->reffac;
2042 2042
 						if (empty($refobj) && !empty($forsalary)) {	// If ref of salary not defined, we force a value
2043
-							$refobj = "SAL" . $obj->idfac;
2043
+							$refobj = "SAL".$obj->idfac;
2044 2044
 						}
2045 2045
 
2046 2046
 						$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 					$nbtotalDrctDbtTxInf = $i;
2052 2052
 				} else {
2053 2053
 					$this->error = $this->db->lasterror();
2054
-					fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers
2054
+					fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
2055 2055
 					$result = -2;
2056 2056
 				}
2057 2057
 				// Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf
@@ -2067,26 +2067,26 @@  discard block
 block discarded – undo
2067 2067
 				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
2068 2068
 				 */
2069 2069
 				// SEPA File Header
2070
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
2071
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
2072
-				fwrite($this->file, '	<CstmrCdtTrfInitn>' . $CrLf);
2070
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
2071
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
2072
+				fwrite($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
2073 2073
 				// SEPA Group header
2074
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
2075
-				fwrite($this->file, '			<MsgId>' . ('TRF/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
2076
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
2077
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
2078
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
2079
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
2080
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
2081
-				fwrite($this->file, '				<Id>' . $CrLf);
2082
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
2083
-				fwrite($this->file, '					<Othr>' . $CrLf);
2084
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
2085
-				fwrite($this->file, '					</Othr>' . $CrLf);
2086
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
2087
-				fwrite($this->file, '				</Id>' . $CrLf);
2088
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
2089
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
2074
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
2075
+				fwrite($this->file, '			<MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
2076
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
2077
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
2078
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
2079
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
2080
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
2081
+				fwrite($this->file, '				<Id>'.$CrLf);
2082
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
2083
+				fwrite($this->file, '					<Othr>'.$CrLf);
2084
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
2085
+				fwrite($this->file, '					</Othr>'.$CrLf);
2086
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
2087
+				fwrite($this->file, '				</Id>'.$CrLf);
2088
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
2089
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
2090 2090
 				// SEPA File Emetteur (mycompany)
2091 2091
 				if ($result != -2) {
2092 2092
 					fwrite($this->file, $fileEmetteurSection);
@@ -2096,9 +2096,9 @@  discard block
 block discarded – undo
2096 2096
 					fwrite($this->file, $fileCrediteurSection);
2097 2097
 				}
2098 2098
 				// SEPA FILE FOOTER
2099
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
2100
-				fwrite($this->file, '	</CstmrCdtTrfInitn>' . $CrLf);
2101
-				fwrite($this->file, '</Document>' . $CrLf);
2099
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
2100
+				fwrite($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
2101
+				fwrite($this->file, '</Document>'.$CrLf);
2102 2102
 			}
2103 2103
 		}
2104 2104
 
@@ -2107,10 +2107,10 @@  discard block
 block discarded – undo
2107 2107
 			if ($type != 'bank-transfer') {
2108 2108
 				$sql = "SELECT pl.amount";
2109 2109
 				$sql .= " FROM";
2110
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2111
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
2112
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2113
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2110
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2111
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
2112
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2113
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2114 2114
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2115 2115
 				$sql .= " AND p.fk_facture = f.rowid";
2116 2116
 
@@ -2133,10 +2133,10 @@  discard block
 block discarded – undo
2133 2133
 			} else {
2134 2134
 				$sql = "SELECT pl.amount";
2135 2135
 				$sql .= " FROM";
2136
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2137
-				$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2138
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2139
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2136
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2137
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2138
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2139
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2140 2140
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2141 2141
 				$sql .= " AND p.fk_facture_fourn = f.rowid";
2142 2142
 				// Lines
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
 		$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
2186 2186
 
2187 2187
 		// 3 char + '-' + 12 + '-' + id + '-' + code 		Must be lower than 32.
2188
-		return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1);
2188
+		return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1);
2189 2189
 	}
2190 2190
 
2191 2191
 
@@ -2224,11 +2224,11 @@  discard block
 block discarded – undo
2224 2224
 
2225 2225
 		// Raison Sociale Destinataire C2
2226 2226
 
2227
-		fwrite($this->file, substr(strtoupper($client_nom) . "                         ", 0, 24));
2227
+		fwrite($this->file, substr(strtoupper($client_nom)."                         ", 0, 24));
2228 2228
 
2229 2229
 		// Address optional D1
2230 2230
 		$address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => ""));
2231
-		fwrite($this->file, substr($address . "                         ", 0, 24));
2231
+		fwrite($this->file, substr($address."                         ", 0, 24));
2232 2232
 
2233 2233
 		// Zone Reservee D2
2234 2234
 
@@ -2240,17 +2240,17 @@  discard block
 block discarded – undo
2240 2240
 
2241 2241
 		// Numero de compte D4
2242 2242
 
2243
-		fwrite($this->file, substr("000000000000000" . $rib_number, -11));
2243
+		fwrite($this->file, substr("000000000000000".$rib_number, -11));
2244 2244
 
2245 2245
 		// Zone E Montant
2246 2246
 
2247 2247
 		$montant = (round($amount, 2) * 100);
2248 2248
 
2249
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2249
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2250 2250
 
2251 2251
 		// Label F
2252 2252
 
2253
-		fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . "                               ", 0, 31));
2253
+		fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid."                               ", 0, 31));
2254 2254
 
2255 2255
 		// Code etablissement G1
2256 2256
 
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 			$row_somme = round((float) $row_somme, 2);
2302 2302
 		}
2303 2303
 
2304
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2304
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2305 2305
 
2306 2306
 		$CrLf = "\n";
2307 2307
 		$Rowing = sprintf("%010d", $row_idfac);
@@ -2316,46 +2316,46 @@  discard block
 block discarded – undo
2316 2316
 		if ($type != 'bank-transfer') {
2317 2317
 			// SEPA Paiement Information of buyer for Direct Debit
2318 2318
 			$XML_DEBITOR = '';
2319
-			$XML_DEBITOR .= '			<DrctDbtTxInf>' . $CrLf;
2320
-			$XML_DEBITOR .= '				<PmtId>' . $CrLf;
2319
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
2320
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
2321 2321
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2322
-			$XML_DEBITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2323
-			$XML_DEBITOR .= '				</PmtId>' . $CrLf;
2324
-			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf;
2325
-			$XML_DEBITOR .= '				<DrctDbtTx>' . $CrLf;
2326
-			$XML_DEBITOR .= '					<MndtRltdInf>' . $CrLf;
2327
-			$XML_DEBITOR .= '						<MndtId>' . $Rum . '</MndtId>' . $CrLf;
2328
-			$XML_DEBITOR .= '						<DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf;
2329
-			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>' . $CrLf;
2330
-			$XML_DEBITOR .= '					</MndtRltdInf>' . $CrLf;
2331
-			$XML_DEBITOR .= '				</DrctDbtTx>' . $CrLf;
2332
-			$XML_DEBITOR .= '				<DbtrAgt>' . $CrLf;
2333
-			$XML_DEBITOR .= '					<FinInstnId>' . $CrLf;
2322
+			$XML_DEBITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2323
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
2324
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf;
2325
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
2326
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
2327
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
2328
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
2329
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
2330
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
2331
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
2332
+			$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
2333
+			$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
2334 2334
 			if (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) {
2335
-				$XML_DEBITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2335
+				$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2336 2336
 			}
2337
-			$XML_DEBITOR .= '					</FinInstnId>' . $CrLf;
2338
-			$XML_DEBITOR .= '				</DbtrAgt>' . $CrLf;
2339
-			$XML_DEBITOR .= '				<Dbtr>' . $CrLf;
2340
-			$XML_DEBITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2341
-			$XML_DEBITOR .= '					<PstlAdr>' . $CrLf;
2342
-			$XML_DEBITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2337
+			$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
2338
+			$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
2339
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
2340
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2341
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
2342
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2343 2343
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2344
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2344
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2345 2345
 			if (trim($addressline1)) {
2346
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2346
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2347 2347
 			}
2348 2348
 			if (trim($addressline2)) {
2349
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2349
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2350 2350
 			}
2351
-			$XML_DEBITOR .= '					</PstlAdr>' . $CrLf;
2352
-			$XML_DEBITOR .= '				</Dbtr>' . $CrLf;
2353
-			$XML_DEBITOR .= '				<DbtrAcct>' . $CrLf;
2354
-			$XML_DEBITOR .= '					<Id>' . $CrLf;
2355
-			$XML_DEBITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2356
-			$XML_DEBITOR .= '					</Id>' . $CrLf;
2357
-			$XML_DEBITOR .= '				</DbtrAcct>' . $CrLf;
2358
-			$XML_DEBITOR .= '				<RmtInf>' . $CrLf;
2351
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
2352
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
2353
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
2354
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
2355
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2356
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
2357
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
2358
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
2359 2359
 
2360 2360
 			// Structured data for Belgium
2361 2361
 			if (getDolGlobalString('INVOICE_PAYMENT_ENABLE_STRUCTURED_COMMUNICATION') && $mysoc->country_code == 'BE') {
@@ -2365,24 +2365,24 @@  discard block
 block discarded – undo
2365 2365
 				$invoicestatic->fetch($row_idfac);
2366 2366
 
2367 2367
 				$invoicePaymentKey = dolBECalculateStructuredCommunication($invoicestatic->ref, $invoicestatic->type);
2368
-				$XML_DEBITOR .= '					<strd>' . $invoicePaymentKey . '</strd>' . $CrLf;
2368
+				$XML_DEBITOR .= '					<strd>'.$invoicePaymentKey.'</strd>'.$CrLf;
2369 2369
 			} else {
2370 2370
 				// A string with some information on payment - 140 max
2371
-				$XML_DEBITOR .= '					<Ustrd>' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstuctured data - 140 max
2371
+				$XML_DEBITOR .= '					<Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max
2372 2372
 			}
2373
-			$XML_DEBITOR .= '				</RmtInf>' . $CrLf;
2374
-			$XML_DEBITOR .= '			</DrctDbtTxInf>' . $CrLf;
2373
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
2374
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
2375 2375
 			return $XML_DEBITOR;
2376 2376
 		} else {
2377 2377
 			// SEPA Payment Information of seller for Credit Transfer
2378 2378
 			$XML_CREDITOR = '';
2379
-			$XML_CREDITOR .= '			<CdtTrfTxInf>' . $CrLf;
2380
-			$XML_CREDITOR .= '				<PmtId>' . $CrLf;
2379
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
2380
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
2381 2381
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2382
-			$XML_CREDITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2383
-			$XML_CREDITOR .= '				</PmtId>' . $CrLf;
2382
+			$XML_CREDITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2383
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2384 2384
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2385
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2385
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2386 2386
 
2387 2387
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2388 2388
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2390,18 +2390,18 @@  discard block
 block discarded – undo
2390 2390
 				} else {
2391 2391
 					$instrprty = 'NORM';
2392 2392
 				}
2393
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2394
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2395
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2396
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2397
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2398
-				$XML_CREDITOR .= '						<Cd>CORE</Cd>' . $CrLf;
2399
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2400
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2393
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2394
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2395
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2396
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2397
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2398
+				$XML_CREDITOR .= '						<Cd>CORE</Cd>'.$CrLf;
2399
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2400
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2401 2401
 			}
2402
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2402
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2403 2403
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2404
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2404
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2405 2405
 			/*
2406 2406
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2407 2407
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2412,35 +2412,35 @@  discard block
 block discarded – undo
2412 2412
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2413 2413
 			 */
2414 2414
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2415
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2416
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2417
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2418
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2419
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2420
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2421
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2422
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2423
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2415
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2416
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2417
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2418
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2419
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2420
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2421
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2422
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2423
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2424 2424
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2425
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2425
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2426 2426
 			if (trim($addressline1)) {
2427
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2427
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2428 2428
 			}
2429 2429
 			if (trim($addressline2)) {
2430
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2430
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2431 2431
 			}
2432
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2433
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2434
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2435
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2436
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2437
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2438
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2439
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2432
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2433
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2434
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2435
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2436
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2437
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2438
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2439
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2440 2440
 			// A string with some information on payment - 140 max
2441
-			$XML_CREDITOR .= '					<Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max
2442
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2443
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2441
+			$XML_CREDITOR .= '					<Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max
2442
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2443
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2444 2444
 			return $XML_CREDITOR;
2445 2445
 		}
2446 2446
 	}
@@ -2472,11 +2472,11 @@  discard block
 block discarded – undo
2472 2472
 
2473 2473
 		// Raison Sociale C2
2474 2474
 
2475
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2475
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2476 2476
 
2477 2477
 		// Ref of thirdparty on 7 characters
2478 2478
 
2479
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2479
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2480 2480
 
2481 2481
 		// Zone Reservee D1-2
2482 2482
 
@@ -2494,7 +2494,7 @@  discard block
 block discarded – undo
2494 2494
 
2495 2495
 		// Numero de compte D4
2496 2496
 
2497
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2497
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2498 2498
 
2499 2499
 		// Zone Reservee E
2500 2500
 
@@ -2557,15 +2557,15 @@  discard block
 block discarded – undo
2557 2557
 			$this->emetteur_iban = $account->iban;
2558 2558
 			$this->emetteur_bic = $account->bic;
2559 2559
 
2560
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2560
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2561 2561
 
2562 2562
 			$this->raison_sociale = $account->owner_name;
2563 2563
 		}
2564 2564
 
2565 2565
 		// Get pending payments
2566 2566
 		$sql = "SELECT rowid, ref";
2567
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2568
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2567
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2568
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2569 2569
 
2570 2570
 		$resql = $this->db->query($sql);
2571 2571
 		if ($resql) {
@@ -2582,45 +2582,45 @@  discard block
 block discarded – undo
2582 2582
 			if ($type != 'bank-transfer') {
2583 2583
 				// SEPA Paiement Information of my company for Direct Debit
2584 2584
 				$XML_SEPA_INFO = '';
2585
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2586
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DD/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2587
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2588
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2589
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2590
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2591
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2592
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2593
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2594
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2595
-				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2596
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2597
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2598
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2599
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2600
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2601
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2602
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2603
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2585
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2586
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2587
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2588
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2589
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2590
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2591
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2592
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2593
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2594
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2595
+				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2596
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2597
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2598
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2599
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2600
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2601
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2602
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2603
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2604 2604
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2605
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2605
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2606 2606
 				if ($addressline1) {
2607
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2607
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2608 2608
 				}
2609 2609
 				if ($addressline2) {
2610
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2610
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2611 2611
 				}
2612
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2613
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2614
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2615
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2616
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2617
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2618
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2619
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2620
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2621
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2622
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2623
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2612
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2613
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2614
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2615
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2616
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2617
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2618
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2619
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2620
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2621
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2622
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2623
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2624 2624
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2625 2625
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2626 2626
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2629,64 +2629,64 @@  discard block
 block discarded – undo
2629 2629
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2630 2630
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2631 2631
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2632
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2633
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2634
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2635
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2636
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2637
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2638
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2639
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2640
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2641
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2642
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2643
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2644
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2632
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2633
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2634
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2635
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2636
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2637
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2638
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2639
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2640
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2641
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2642
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2643
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2644
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2645 2645
 			} else {
2646 2646
 				// SEPA Paiement Information of my company for Credit Transfer
2647 2647
 				$XML_SEPA_INFO = '';
2648
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2649
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('TRF/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2650
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2648
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2649
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2650
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2651 2651
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2652
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2653
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2652
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2653
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2654 2654
 				if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) {	// @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
2655
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2656
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2657
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2658
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2659
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2660
-					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2661
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2662
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2663
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2655
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2656
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2657
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2658
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2659
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2660
+					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2661
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2662
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2663
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2664 2664
 				}
2665
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2666
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2667
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2668
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2669
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2665
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2666
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2667
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2668
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2669
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2670 2670
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2671
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2671
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2672 2672
 				if ($addressline1) {
2673
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2673
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2674 2674
 				}
2675 2675
 				if ($addressline2) {
2676
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2676
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2677 2677
 				}
2678
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2679
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2680
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2681
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2682
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2683
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2684
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2685
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2686
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2687
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2688
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2689
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2678
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2679
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2680
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2681
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2682
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2683
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2684
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2685
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2686
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2687
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2688
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2689
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2690 2690
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2691 2691
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2692 2692
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2695,7 +2695,7 @@  discard block
 block discarded – undo
2695 2695
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2696 2696
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2697 2697
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2698
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2698
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2699 2699
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2700 2700
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2701 2701
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2711 2711
 			}
2712 2712
 		} else {
2713
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2713
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2714 2714
 			$XML_SEPA_INFO = '';
2715 2715
 		}
2716 2716
 		return $XML_SEPA_INFO;
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 
2763 2763
 		$montant = ($total * 100);
2764 2764
 
2765
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2765
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2766 2766
 
2767 2767
 		// Zone Reservee F
2768 2768
 
@@ -2919,18 +2919,18 @@  discard block
 block discarded – undo
2919 2919
 		$return .= img_picto('', $this->picto);
2920 2920
 		$return .= '</span>';
2921 2921
 		$return .= '<div class="info-box-content">';
2922
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2922
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2923 2923
 		if ($selected >= 0) {
2924
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2924
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2925 2925
 		}
2926 2926
 		if (property_exists($this, 'date_echeance')) {
2927
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Date") . '</span> : <span class="info-box-label">' . dol_print_date($this->db->jdate($this->date_echeance), 'day') . '</span>';
2927
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
2928 2928
 		}
2929 2929
 		if (property_exists($this, 'total')) {
2930
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2930
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2931 2931
 		}
2932 2932
 		if (method_exists($this, 'LibStatut')) {
2933
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2933
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2934 2934
 		}
2935 2935
 		$return .= '</div>';
2936 2936
 		$return .= '</div>';
@@ -2951,9 +2951,9 @@  discard block
 block discarded – undo
2951 2951
 			return 0;
2952 2952
 		}
2953 2953
 		if ($id) {
2954
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2955
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2956
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2954
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2955
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2956
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2957 2957
 			$sql .= " AND fk_user IS NOT NULL";
2958 2958
 
2959 2959
 			$num = 0;
Please login to merge, or discard this patch.
htdocs/core/class/html.form.class.php 1 patch
Spacing   +1245 added lines, -1245 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !preg_match('/^select;/', $typeofdata)) {
124 124
 			if (!empty($perm)) {
125 125
 				$tmp = explode(':', $typeofdata);
126
-				$ret .= '<div class="editkey_' . $tmp[0] . (!empty($tmp[1]) ? ' ' . $tmp[1] : '') . '" id="' . $htmlname . '">';
126
+				$ret .= '<div class="editkey_'.$tmp[0].(!empty($tmp[1]) ? ' '.$tmp[1] : '').'" id="'.$htmlname.'">';
127 127
 				if ($fieldrequired) {
128 128
 					$ret .= '<span class="fieldrequired">';
129 129
 				}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				if ($fieldrequired) {
136 136
 					$ret .= '</span>';
137 137
 				}
138
-				$ret .= '</div>' . "\n";
138
+				$ret .= '</div>'."\n";
139 139
 			} else {
140 140
 				if ($fieldrequired) {
141 141
 					$ret .= '<span class="fieldrequired">';
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 			if (empty($notabletag) && $perm) {
174 174
 				$ret .= '<td class="right">';
175 175
 			}
176
-			if ($htmlname && GETPOST('action', 'aZ09') != 'edit' . $htmlname && $perm) {
177
-				$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>';
176
+			if ($htmlname && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) {
177
+				$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>';
178 178
 			}
179 179
 			if (!empty($notabletag) && $notabletag == 1) {
180 180
 				if ($text) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			} elseif ($reg[1] == 'int') {
242 242
 				$typeofdata = 'numeric';
243 243
 			} else {
244
-				return 'ErrorBadParameter ' . $typeofdata;
244
+				return 'ErrorBadParameter '.$typeofdata;
245 245
 			}
246 246
 		}
247 247
 
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 			if ($editaction == '') {
253 253
 				$editaction = GETPOST('action', 'aZ09');
254 254
 			}
255
-			$editmode = ($editaction == 'edit' . $htmlname);
255
+			$editmode = ($editaction == 'edit'.$htmlname);
256 256
 			if ($editmode) {	// edit mode
257 257
 				$ret .= "<!-- formeditfieldval -->\n";
258
-				$ret .= '<form method="post" action="' . $_SERVER["PHP_SELF"] . ($moreparam ? '?' . $moreparam : '') . '">';
259
-				$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
260
-				$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
261
-				$ret .= '<input type="hidden" name="' . $paramid . '" value="' . $object->id . '">';
258
+				$ret .= '<form method="post" action="'.$_SERVER["PHP_SELF"].($moreparam ? '?'.$moreparam : '').'">';
259
+				$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
260
+				$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
261
+				$ret .= '<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
262 262
 				if (empty($notabletag)) {
263 263
 					$ret .= '<table class="nobordernopadding centpercent">';
264 264
 				}
@@ -267,28 +267,28 @@  discard block
 block discarded – undo
267 267
 				}
268 268
 				if (preg_match('/^(string|safehtmlstring|email|phone|url)/', $typeofdata)) {
269 269
 					$tmp = explode(':', $typeofdata);
270
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($editvalue ? $editvalue : $value) . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
270
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($editvalue ? $editvalue : $value).'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
271 271
 				} elseif (preg_match('/^(integer)/', $typeofdata)) {
272 272
 					$tmp = explode(':', $typeofdata);
273 273
 					$valuetoshow = price2num($editvalue ? $editvalue : $value, 0);
274
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $valuetoshow . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
274
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.$valuetoshow.'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
275 275
 				} elseif (preg_match('/^(numeric|amount)/', $typeofdata)) {
276 276
 					$tmp = explode(':', $typeofdata);
277 277
 					$valuetoshow = price2num($editvalue ? $editvalue : $value);
278
-					$ret .= '<input type="text" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($valuetoshow != '' ? price($valuetoshow) : '') . '"' . (empty($tmp[1]) ? '' : ' size="' . $tmp[1] . '"') . ' autofocus>';
278
+					$ret .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ? price($valuetoshow) : '').'"'.(empty($tmp[1]) ? '' : ' size="'.$tmp[1].'"').' autofocus>';
279 279
 				} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
280 280
 					$tmp = explode(':', $typeofdata);
281
-					$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . ($value ? $value : 'on') . '"' . ($value ? ' checked' : '') . (empty($tmp[1]) ? '' : $tmp[1]) . '/>';
281
+					$ret .= '<input type="checkbox" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($value ? $value : 'on').'"'.($value ? ' checked' : '').(empty($tmp[1]) ? '' : $tmp[1]).'/>';
282 282
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {    // if wysiwyg is enabled $typeofdata = 'ckeditor'
283 283
 					$tmp = explode(':', $typeofdata);
284 284
 					$cols = (empty($tmp[2]) ? '' : $tmp[2]);
285 285
 					$morealt = '';
286 286
 					if (preg_match('/%/', $cols)) {
287
-						$morealt = ' style="width: ' . $cols . '"';
287
+						$morealt = ' style="width: '.$cols.'"';
288 288
 						$cols = '';
289 289
 					}
290 290
 					$valuetoshow = ($editvalue ? $editvalue : $value);
291
-					$ret .= '<textarea id="' . $htmlname . '" name="' . $htmlname . '" wrap="soft" rows="' . (empty($tmp[1]) ? '20' : $tmp[1]) . '"' . ($cols ? ' cols="' . $cols . '"' : 'class="quatrevingtpercent"') . $morealt . '" autofocus>';
291
+					$ret .= '<textarea id="'.$htmlname.'" name="'.$htmlname.'" wrap="soft" rows="'.(empty($tmp[1]) ? '20' : $tmp[1]).'"'.($cols ? ' cols="'.$cols.'"' : 'class="quatrevingtpercent"').$morealt.'" autofocus>';
292 292
 					// textarea convert automatically entities chars into simple chars.
293 293
 					// So we convert & into &amp; so a string like 'a &lt; <b>b</b><br>é<br>&lt;script&gt;alert('X');&lt;script&gt;' stay a correct html and is not converted by textarea component when wysiwyg is off.
294 294
 					$valuetoshow = str_replace('&', '&amp;', $valuetoshow);
@@ -298,12 +298,12 @@  discard block
 block discarded – undo
298 298
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
299 299
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
300 300
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
301
-					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
301
+					$ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
302 302
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
303 303
 					$addnowlink = empty($moreoptions['addnowlink']) ? 0 : $moreoptions['addnowlink'];
304 304
 					$adddateof = empty($moreoptions['adddateof']) ? '' : $moreoptions['adddateof'];
305 305
 					$labeladddateof = empty($moreoptions['labeladddateof']) ? '' : $moreoptions['labeladddateof'];
306
-					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form' . $htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
306
+					$ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, $addnowlink, 0, '', '', $adddateof, '', 1, $labeladddateof, '', $gm);
307 307
 				} elseif (preg_match('/^select;/', $typeofdata)) {
308 308
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
309 309
 					$arraylist = array();
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 					// TODO Not yet implemented. See code for extrafields
318 318
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
319 319
 					$tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser
320
-					require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
320
+					require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
321 321
 					$doleditor = new DolEditor($htmlname, ($editvalue ? $editvalue : $value), (empty($tmp[2]) ? '' : $tmp[2]), (empty($tmp[3]) ? 100 : (int) $tmp[3]), (empty($tmp[1]) ? 'dolibarr_notes' : $tmp[1]), 'In', (empty($tmp[5]) ? false : (bool) $tmp[5]), (isset($tmp[8]) ? ($tmp[8] ? true : false) : true), true, (empty($tmp[6]) ? 20 : (int) $tmp[6]), (empty($tmp[7]) ? '100' : $tmp[7]));
322 322
 					$ret .= $doleditor->Create(1);
323 323
 				} elseif ($typeofdata == 'asis') {
@@ -332,19 +332,19 @@  discard block
 block discarded – undo
332 332
 					$ret .= '<td>';
333 333
 				}
334 334
 				//else $ret.='<div class="clearboth"></div>';
335
-				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button' . (empty($notabletag) ? '' : ' ') . '" name="modify" value="' . $langs->trans("Modify") . '">';
335
+				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
336 336
 				if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) {
337
-					$ret .= '<br>' . "\n";
337
+					$ret .= '<br>'."\n";
338 338
 				}
339
-				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel' . (empty($notabletag) ? '' : ' ') . '" name="cancel" value="' . $langs->trans("Cancel") . '">';
339
+				$ret .= '<input type="submit" class="smallpaddingimp nomargingtop nomarginbottom button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
340 340
 				if (empty($notabletag)) {
341 341
 					$ret .= '</td>';
342 342
 				}
343 343
 
344 344
 				if (empty($notabletag)) {
345
-					$ret .= '</tr></table>' . "\n";
345
+					$ret .= '</tr></table>'."\n";
346 346
 				}
347
-				$ret .= '</form>' . "\n";
347
+				$ret .= '</form>'."\n";
348 348
 			} else {		// view mode
349 349
 				if (preg_match('/^email/', $typeofdata)) {
350 350
 					$ret .= dol_print_email($value, 0, 0, 0, 0, 1);
@@ -356,15 +356,15 @@  discard block
 block discarded – undo
356 356
 					$ret .= ($value != '' ? price($value, 0, $langs, 0, -1, -1, $conf->currency) : '');
357 357
 				} elseif (preg_match('/^checkbox/', $typeofdata)) {
358 358
 					$tmp = explode(':', $typeofdata);
359
-					$ret .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($value ? ' checked' : '') . ($tmp[1] ? $tmp[1] : '') . '/>';
359
+					$ret .= '<input type="checkbox" disabled id="'.$htmlname.'" name="'.$htmlname.'" value="'.$value.'"'.($value ? ' checked' : '').($tmp[1] ? $tmp[1] : '').'/>';
360 360
 				} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
361 361
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags(dol_htmlentitiesbr($value), 1, 1, 1));
362 362
 				} elseif (preg_match('/^(safehtmlstring|restricthtml)/', $typeofdata)) {	// 'restricthtml' is not an allowed type for editfieldval. Value is 'safehtmlstring'
363 363
 					$ret .= dol_htmlwithnojs(dol_string_onlythesehtmltags($value));
364 364
 				} elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') {
365
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'day', $gm) . '</span>';
365
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'day', $gm).'</span>';
366 366
 				} elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') {
367
-					$ret .= '<span class="valuedate">' . dol_print_date($value, 'dayhour', $gm) . '</span>';
367
+					$ret .= '<span class="valuedate">'.dol_print_date($value, 'dayhour', $gm).'</span>';
368 368
 				} elseif (preg_match('/^select;/', $typeofdata)) {
369 369
 					$arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata));
370 370
 					$arraylist = array();
@@ -375,9 +375,9 @@  discard block
 block discarded – undo
375 375
 					$ret .= $arraylist[$value];
376 376
 					if ($htmlname == 'fk_product_type') {
377 377
 						if ($value == 0) {
378
-							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
378
+							$ret = img_picto($langs->trans("Product"), 'product', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
379 379
 						} else {
380
-							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"') . $ret;
380
+							$ret = img_picto($langs->trans("Service"), 'service', 'class="paddingleftonly paddingrightonly colorgrey"').$ret;
381 381
 						}
382 382
 					}
383 383
 				} elseif (preg_match('/^ckeditor/', $typeofdata)) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 					if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
386 386
 						$firstline = preg_replace('/<br>.*/', '', $tmpcontent);
387 387
 						$firstline = preg_replace('/[\n\r].*/', '', $firstline);
388
-						$tmpcontent = $firstline . ((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
388
+						$tmpcontent = $firstline.((strlen($firstline) != strlen($tmpcontent)) ? '...' : '');
389 389
 					}
390 390
 					// We don't use dol_escape_htmltag to get the html formatting active, but this need we must also
391 391
 					// clean data from some dangerous html
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					if (empty($moreoptions['valuealreadyhtmlescaped'])) {
395 395
 						$ret .= dol_escape_htmltag($value);
396 396
 					} else {
397
-						$ret .= $value;        // $value must be already html escaped.
397
+						$ret .= $value; // $value must be already html escaped.
398 398
 					}
399 399
 				}
400 400
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 		if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
434 434
 			if (!is_object($extralanguages)) {
435
-				include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
435
+				include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
436 436
 				$extralanguages = new ExtraLanguages($this->db);
437 437
 			}
438 438
 			$extralanguages->fetch_name_extralanguages('societe');
@@ -441,17 +441,17 @@  discard block
 block discarded – undo
441 441
 				return ''; // No extralang field to show
442 442
 			}
443 443
 
444
-			$result .= '<!-- Widget for translation -->' . "\n";
445
-			$result .= '<div class="inline-block paddingleft image-' . $object->element . '-' . $fieldname . '">';
444
+			$result .= '<!-- Widget for translation -->'."\n";
445
+			$result .= '<div class="inline-block paddingleft image-'.$object->element.'-'.$fieldname.'">';
446 446
 			$s = img_picto($langs->trans("ShowOtherLanguages"), 'language', '', 0, 0, 0, '', 'fa-15 editfieldlang');
447 447
 			$result .= $s;
448 448
 			$result .= '</div>';
449 449
 
450
-			$result .= '<div class="inline-block hidden field-' . $object->element . '-' . $fieldname . '">';
450
+			$result .= '<div class="inline-block hidden field-'.$object->element.'-'.$fieldname.'">';
451 451
 
452 452
 			$resultforextrlang = '';
453 453
 			foreach ($arrayoflangcode as $langcode) {
454
-				$valuetoshow = GETPOSTISSET('field-' . $object->element . "-" . $fieldname . "-" . $langcode) ? GETPOST('field-' . $object->element . '-' . $fieldname . "-" . $langcode, $check) : '';
454
+				$valuetoshow = GETPOSTISSET('field-'.$object->element."-".$fieldname."-".$langcode) ? GETPOST('field-'.$object->element.'-'.$fieldname."-".$langcode, $check) : '';
455 455
 				if (empty($valuetoshow)) {
456 456
 					$object->fetchValuesForExtraLanguages();
457 457
 					//var_dump($object->array_languages);
@@ -463,17 +463,17 @@  discard block
 block discarded – undo
463 463
 
464 464
 				// TODO Use the showInputField() method of ExtraLanguages object
465 465
 				if ($typeofdata == 'textarea') {
466
-					$resultforextrlang .= '<textarea name="field-' . $object->element . "-" . $fieldname . "-" . $langcode . '" id="' . $fieldname . "-" . $langcode . '" class="' . $morecss . '" rows="' . ROWS_2 . '" wrap="soft">';
466
+					$resultforextrlang .= '<textarea name="field-'.$object->element."-".$fieldname."-".$langcode.'" id="'.$fieldname."-".$langcode.'" class="'.$morecss.'" rows="'.ROWS_2.'" wrap="soft">';
467 467
 					$resultforextrlang .= $valuetoshow;
468 468
 					$resultforextrlang .= '</textarea>';
469 469
 				} else {
470
-					$resultforextrlang .= '<input type="text" class="inputfieldforlang ' . ($morecss ? ' ' . $morecss : '') . '" name="field-' . $object->element . '-' . $fieldname . '-' . $langcode . '" value="' . $valuetoshow . '">';
470
+					$resultforextrlang .= '<input type="text" class="inputfieldforlang '.($morecss ? ' '.$morecss : '').'" name="field-'.$object->element.'-'.$fieldname.'-'.$langcode.'" value="'.$valuetoshow.'">';
471 471
 				}
472 472
 			}
473 473
 			$result .= $resultforextrlang;
474 474
 
475 475
 			$result .= '</div>';
476
-			$result .= '<script nonce="' . getNonce() . '">$(".image-' . $object->element . '-' . $fieldname . '").click(function() { console.log("Toggle lang widget"); jQuery(".field-' . $object->element . '-' . $fieldname . '").toggle(); });</script>';
476
+			$result .= '<script nonce="'.getNonce().'">$(".image-'.$object->element.'-'.$fieldname.'").click(function() { console.log("Toggle lang widget"); jQuery(".field-'.$object->element.'-'.$fieldname.'").toggle(); });</script>';
477 477
 		}
478 478
 
479 479
 		return $result;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 				if (!empty($tmp[2])) {
537 537
 					$savemethod = $tmp[2];
538 538
 				}
539
-				$out .= '<input id="width_' . $htmlname . '" value="' . $inputOption . '" type="hidden"/>' . "\n";
539
+				$out .= '<input id="width_'.$htmlname.'" value="'.$inputOption.'" type="hidden"/>'."\n";
540 540
 			} elseif ((preg_match('/^day$/', $inputType)) || (preg_match('/^datepicker/', $inputType)) || (preg_match('/^datehourpicker/', $inputType))) {
541 541
 				$tmp = explode(':', $inputType);
542 542
 				$inputType = $tmp[0];
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 					$savemethod = $tmp[2];
548 548
 				}
549 549
 
550
-				$out .= '<input id="timestamp" type="hidden"/>' . "\n"; // Use for timestamp format
550
+				$out .= '<input id="timestamp" type="hidden"/>'."\n"; // Use for timestamp format
551 551
 			} elseif (preg_match('/^(select|autocomplete)/', $inputType)) {
552 552
 				$tmp = explode(':', $inputType);
553 553
 				$inputType = $tmp[0];
@@ -578,40 +578,40 @@  discard block
 block discarded – undo
578 578
 				}
579 579
 
580 580
 				if (isModEnabled('fckeditor')) {
581
-					$out .= '<input id="ckeditor_toolbar" value="' . $toolbar . '" type="hidden"/>' . "\n";
581
+					$out .= '<input id="ckeditor_toolbar" value="'.$toolbar.'" type="hidden"/>'."\n";
582 582
 				} else {
583 583
 					$inputType = 'textarea';
584 584
 				}
585 585
 			}
586 586
 
587
-			$out .= '<input id="element_' . $htmlname . '" value="' . $element . '" type="hidden"/>' . "\n";
588
-			$out .= '<input id="table_element_' . $htmlname . '" value="' . $table_element . '" type="hidden"/>' . "\n";
589
-			$out .= '<input id="fk_element_' . $htmlname . '" value="' . $fk_element . '" type="hidden"/>' . "\n";
590
-			$out .= '<input id="loadmethod_' . $htmlname . '" value="' . $loadmethod . '" type="hidden"/>' . "\n";
587
+			$out .= '<input id="element_'.$htmlname.'" value="'.$element.'" type="hidden"/>'."\n";
588
+			$out .= '<input id="table_element_'.$htmlname.'" value="'.$table_element.'" type="hidden"/>'."\n";
589
+			$out .= '<input id="fk_element_'.$htmlname.'" value="'.$fk_element.'" type="hidden"/>'."\n";
590
+			$out .= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
591 591
 			if (!empty($savemethod)) {
592
-				$out .= '<input id="savemethod_' . $htmlname . '" value="' . $savemethod . '" type="hidden"/>' . "\n";
592
+				$out .= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
593 593
 			}
594 594
 			if (!empty($ext_element)) {
595
-				$out .= '<input id="ext_element_' . $htmlname . '" value="' . $ext_element . '" type="hidden"/>' . "\n";
595
+				$out .= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
596 596
 			}
597 597
 			if (!empty($custommsg)) {
598 598
 				if (is_array($custommsg)) {
599 599
 					if (!empty($custommsg['success'])) {
600
-						$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg['success'] . '" type="hidden"/>' . "\n";
600
+						$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg['success'].'" type="hidden"/>'."\n";
601 601
 					}
602 602
 					if (!empty($custommsg['error'])) {
603
-						$out .= '<input id="errormsg_' . $htmlname . '" value="' . $custommsg['error'] . '" type="hidden"/>' . "\n";
603
+						$out .= '<input id="errormsg_'.$htmlname.'" value="'.$custommsg['error'].'" type="hidden"/>'."\n";
604 604
 					}
605 605
 				} else {
606
-					$out .= '<input id="successmsg_' . $htmlname . '" value="' . $custommsg . '" type="hidden"/>' . "\n";
606
+					$out .= '<input id="successmsg_'.$htmlname.'" value="'.$custommsg.'" type="hidden"/>'."\n";
607 607
 				}
608 608
 			}
609 609
 			if ($inputType == 'textarea') {
610
-				$out .= '<input id="textarea_' . $htmlname . '_rows" value="' . $rows . '" type="hidden"/>' . "\n";
611
-				$out .= '<input id="textarea_' . $htmlname . '_cols" value="' . $cols . '" type="hidden"/>' . "\n";
610
+				$out .= '<input id="textarea_'.$htmlname.'_rows" value="'.$rows.'" type="hidden"/>'."\n";
611
+				$out .= '<input id="textarea_'.$htmlname.'_cols" value="'.$cols.'" type="hidden"/>'."\n";
612 612
 			}
613
-			$out .= '<span id="viewval_' . $htmlname . '" class="viewval_' . $inputType . ($button_only ? ' inactive' : ' active') . '">' . $value . '</span>' . "\n";
614
-			$out .= '<span id="editval_' . $htmlname . '" class="editval_' . $inputType . ($button_only ? ' inactive' : ' active') . ' hideobject">' . (!empty($editvalue) ? $editvalue : $value) . '</span>' . "\n";
613
+			$out .= '<span id="viewval_'.$htmlname.'" class="viewval_'.$inputType.($button_only ? ' inactive' : ' active').'">'.$value.'</span>'."\n";
614
+			$out .= '<span id="editval_'.$htmlname.'" class="editval_'.$inputType.($button_only ? ' inactive' : ' active').' hideobject">'.(!empty($editvalue) ? $editvalue : $value).'</span>'."\n";
615 615
 		} else {
616 616
 			$out = $value;
617 617
 		}
@@ -640,12 +640,12 @@  discard block
 block discarded – undo
640 640
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
641 641
 	{
642 642
 		if ($incbefore) {
643
-			$text = $incbefore . $text;
643
+			$text = $incbefore.$text;
644 644
 		}
645 645
 		if (!$htmltext) {
646 646
 			return $text;
647 647
 		}
648
-		$direction = (int) $direction;    // For backward compatibility when $direction was set to '' instead of 0
648
+		$direction = (int) $direction; // For backward compatibility when $direction was set to '' instead of 0
649 649
 
650 650
 		$tag = 'td';
651 651
 		if ($notabs == 2) {
@@ -659,11 +659,11 @@  discard block
 block discarded – undo
659 659
 
660 660
 		$extrastyle = '';
661 661
 		if ($direction < 0) {
662
-			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : '');
662
+			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : '');
663 663
 			$extrastyle = 'padding: 0px; padding-left: 2px;';
664 664
 		}
665 665
 		if ($direction > 0) {
666
-			$extracss = ($extracss ? $extracss : '') . ($notabs != 3 ? ' inline-block' : '');
666
+			$extracss = ($extracss ? $extracss : '').($notabs != 3 ? ' inline-block' : '');
667 667
 			$extrastyle = 'padding: 0px; padding-right: 2px;';
668 668
 		}
669 669
 
@@ -676,53 +676,53 @@  discard block
 block discarded – undo
676 676
 			$htmltext = str_replace('"', '&quot;', $htmltext);
677 677
 		} else {
678 678
 			$classfortooltip = 'classfortooltiponclick';
679
-			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_' . $tooltiptrigger . '" class="classfortooltiponclicktext">' . $htmltext . '</div>';
679
+			$textfordialog .= '<div style="display: none;" id="idfortooltiponclick_'.$tooltiptrigger.'" class="classfortooltiponclicktext">'.$htmltext.'</div>';
680 680
 		}
681 681
 		if ($tooltipon == 2 || $tooltipon == 3) {
682
-			$paramfortooltipimg = ' class="' . $classfortooltip . ($notabs != 3 ? ' inline-block' : '') . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '"';
682
+			$paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"';
683 683
 			if ($tooltiptrigger == '') {
684
-				$paramfortooltipimg .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on img tag to store tooltip
684
+				$paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on img tag to store tooltip
685 685
 			} else {
686
-				$paramfortooltipimg .= ' dolid="' . $tooltiptrigger . '"';
686
+				$paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"';
687 687
 			}
688 688
 		} else {
689
-			$paramfortooltipimg = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
689
+			$paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
690 690
 		}
691 691
 		if ($tooltipon == 1 || $tooltipon == 3) {
692
-			$paramfortooltiptd = ' class="' . ($tooltipon == 3 ? 'cursorpointer ' : '') . $classfortooltip . ' inline-block' . ($extracss ? ' ' . $extracss : '') . '" style="padding: 0px;' . ($extrastyle ? ' ' . $extrastyle : '') . '" ';
692
+			$paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" ';
693 693
 			if ($tooltiptrigger == '') {
694
-				$paramfortooltiptd .= ' title="' . ($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)) . '"'; // Attribute to put on td tag to store tooltip
694
+				$paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribute to put on td tag to store tooltip
695 695
 			} else {
696
-				$paramfortooltiptd .= ' dolid="' . $tooltiptrigger . '"';
696
+				$paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"';
697 697
 			}
698 698
 		} else {
699
-			$paramfortooltiptd = ($extracss ? ' class="' . $extracss . '"' : '') . ($extrastyle ? ' style="' . $extrastyle . '"' : ''); // Attribute to put on td text tag
699
+			$paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribute to put on td text tag
700 700
 		}
701 701
 		if (empty($notabs)) {
702 702
 			$s .= '<table class="nobordernopadding"><tr style="height: auto;">';
703 703
 		} elseif ($notabs == 2) {
704
-			$s .= '<div class="inline-block' . ($forcenowrap ? ' nowrap' : '') . '">';
704
+			$s .= '<div class="inline-block'.($forcenowrap ? ' nowrap' : '').'">';
705 705
 		}
706 706
 		// Define value if value is before
707 707
 		if ($direction < 0) {
708
-			$s .= '<' . $tag . $paramfortooltipimg;
708
+			$s .= '<'.$tag.$paramfortooltipimg;
709 709
 			if ($tag == 'td') {
710 710
 				$s .= ' class="valigntop" width="14"';
711 711
 			}
712
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
712
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
713 713
 		}
714 714
 		// Use another method to help avoid having a space in value in order to use this value with jquery
715 715
 		// Define label
716 716
 		if ((string) $text != '') {
717
-			$s .= '<' . $tag . $paramfortooltiptd . '>' . $text . '</' . $tag . '>';
717
+			$s .= '<'.$tag.$paramfortooltiptd.'>'.$text.'</'.$tag.'>';
718 718
 		}
719 719
 		// Define value if value is after
720 720
 		if ($direction > 0) {
721
-			$s .= '<' . $tag . $paramfortooltipimg;
721
+			$s .= '<'.$tag.$paramfortooltipimg;
722 722
 			if ($tag == 'td') {
723 723
 				$s .= ' class="valignmiddle" width="14"';
724 724
 			}
725
-			$s .= '>' . $textfordialog . $img . '</' . $tag . '>';
725
+			$s .= '>'.$textfordialog.$img.'</'.$tag.'>';
726 726
 		}
727 727
 		if (empty($notabs)) {
728 728
 			$s .= '</tr></table>';
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 
830 830
 		$disabled = 0;
831 831
 		$ret = '<div class="centpercent center">';
832
-		$ret .= '<select class="flat' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'select valignmiddle alignstart" id="' . $name . '" name="' . $name . '"' . ($disabled ? ' disabled="disabled"' : '') . '>';
832
+		$ret .= '<select class="flat'.(empty($conf->use_javascript_ajax) ? '' : ' hideobject').' '.$name.' '.$name.'select valignmiddle alignstart" id="'.$name.'" name="'.$name.'"'.($disabled ? ' disabled="disabled"' : '').'>';
833 833
 
834 834
 		// 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.
835 835
 		$parameters = array();
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
 			return;
841 841
 		}
842 842
 		if (empty($reshook)) {
843
-			$ret .= '<option value="0"' . ($disabled ? ' disabled="disabled"' : '') . '>-- ' . $langs->trans("SelectAction") . ' --</option>';
843
+			$ret .= '<option value="0"'.($disabled ? ' disabled="disabled"' : '').'>-- '.$langs->trans("SelectAction").' --</option>';
844 844
 			if (is_array($arrayofaction)) {
845 845
 				foreach ($arrayofaction as $code => $label) {
846
-					$ret .= '<option value="' . $code . '"' . ($disabled ? ' disabled="disabled"' : '') . ' data-html="' . dol_escape_htmltag($label) . '">' . $label . '</option>';
846
+					$ret .= '<option value="'.$code.'"'.($disabled ? ' disabled="disabled"' : '').' data-html="'.dol_escape_htmltag($label).'">'.$label.'</option>';
847 847
 				}
848 848
 			}
849 849
 		}
@@ -852,17 +852,17 @@  discard block
 block discarded – undo
852 852
 		$ret .= '</select>';
853 853
 
854 854
 		if (empty($conf->dol_optimize_smallscreen)) {
855
-			$ret .= ajax_combobox('.' . $name . 'select');
855
+			$ret .= ajax_combobox('.'.$name.'select');
856 856
 		}
857 857
 
858 858
 		// 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
859 859
 		$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.
860
-		$ret .= '<input type="submit" disabled name="confirmmassaction"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display: none"') . ' class="reposition button smallpaddingimp' . (empty($conf->use_javascript_ajax) ? '' : ' hideobject') . ' ' . $name . ' ' . $name . 'confirmed" value="' . dol_escape_htmltag($langs->trans("Confirm")) . '">';
860
+		$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")).'">';
861 861
 		$ret .= '</div>';
862 862
 
863 863
 		if (!empty($conf->use_javascript_ajax)) {
864 864
 			$ret .= '<!-- JS CODE TO ENABLE mass action select -->
865
-    		<script nonce="' . getNonce() . '">
865
+    		<script nonce="' . getNonce().'">
866 866
                         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 */
867 867
         		{
868 868
         			atleastoneselected=0;
@@ -873,11 +873,11 @@  discard block
 block discarded – undo
873 873
 
874 874
 					console.log("initCheckForSelect mode="+mode+" name="+name+" cssclass="+cssclass+" atleastoneselected="+atleastoneselected);
875 875
 
876
-    	  			if (atleastoneselected || ' . $alwaysvisible . ')
876
+    	  			if (atleastoneselected || ' . $alwaysvisible.')
877 877
     	  			{
878 878
                                     jQuery("."+name).show();
879
-        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("' . $selected . '").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '') . '
880
-        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '') . '
879
+        			    ' . ($selected ? 'if (atleastoneselected) { jQuery("."+name+"select").val("'.$selected.'").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', false); }' : '').'
880
+        			    ' . ($selected ? 'if (! atleastoneselected) { jQuery("."+name+"select").val("0").trigger(\'change\'); jQuery("."+name+"confirmed").prop(\'disabled\', true); } ' : '').'
881 881
     	  			}
882 882
     	  			else
883 883
     	  			{
@@ -887,26 +887,26 @@  discard block
 block discarded – undo
887 887
         		}
888 888
 
889 889
         	jQuery(document).ready(function () {
890
-                    initCheckForSelect(0, "' . $name . '", "' . $cssclass . '");
891
-                    jQuery(".' . $cssclass . '").click(function() {
892
-                        initCheckForSelect(1, "' . $name . '", "' . $cssclass . '");
890
+                    initCheckForSelect(0, "' . $name.'", "'.$cssclass.'");
891
+                    jQuery(".' . $cssclass.'").click(function() {
892
+                        initCheckForSelect(1, "' . $name.'", "'.$cssclass.'");
893 893
                     });
894
-                    jQuery(".' . $name . 'select").change(function() {
894
+                    jQuery(".' . $name.'select").change(function() {
895 895
         				var massaction = $( this ).val();
896 896
         				var urlform = $( this ).closest("form").attr("action").replace("#show_files","");
897 897
         				if (massaction == "builddoc") {
898 898
                         	urlform = urlform + "#show_files";
899 899
     	            	}
900 900
         				$( this ).closest("form").attr("action", urlform);
901
-                    	console.log("we select a mass action name=' . $name . ' massaction="+massaction+" - "+urlform);
901
+                    	console.log("we select a mass action name=' . $name.' massaction="+massaction+" - "+urlform);
902 902
         	        	/* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */
903 903
         				if ($(this).val() != \'0\') {
904
-                                        jQuery(".' . $name . 'confirmed").prop(\'disabled\', false);
905
-										jQuery(".' . $name . 'other").hide();	/* To disable if another div was open */
906
-                                        jQuery(".' . $name . '"+massaction).show();
904
+                                        jQuery(".' . $name.'confirmed").prop(\'disabled\', false);
905
+										jQuery(".' . $name.'other").hide();	/* To disable if another div was open */
906
+                                        jQuery(".' . $name.'"+massaction).show();
907 907
     	  				} else {
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
984 984
 
985 985
 				if ($showempty) {
986 986
 					if (is_numeric($showempty)) {
987
-						$out .= '<option value="">&nbsp;</option>' . "\n";
987
+						$out .= '<option value="">&nbsp;</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
 block discarded – undo
1025 1025
 						$labeltoshow .= '&nbsp;';
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
 block discarded – undo
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
 block discarded – undo
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">&nbsp;</option>';
1103 1103
 			$num = $this->db->num_rows($resql);
1104 1104
 			$i = 0;
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
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']) {
@@ -1128,13 +1128,13 @@  discard block
 block discarded – undo
1128 1128
 			$out .= ajax_combobox($htmlname);
1129 1129
 
1130 1130
 			if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
1131
-				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT . '/core/ajax/locationincoterms.php') . "\n";
1131
+				$out .= ajax_multiautocompleter('location_incoterms', array(), DOL_URL_ROOT.'/core/ajax/locationincoterms.php')."\n";
1132 1132
 				$moreattrib .= ' autocomplete="off"';
1133 1133
 			}
1134
-			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="' . $location_incoterms . '">' . "\n";
1134
+			$out .= '<input id="location_incoterms" class="maxwidthonsmartphone type="text" name="location_incoterms" value="'.$location_incoterms.'">'."\n";
1135 1135
 
1136 1136
 			if (!empty($page)) {
1137
-				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="' . $langs->trans("Modify") . '"></form>';
1137
+				$out .= '<input type="submit" class="button valignmiddle smallpaddingimp nomargintop nomarginbottom" value="'.$langs->trans("Modify").'"></form>';
1138 1138
 			}
1139 1139
 		} else {
1140 1140
 			dol_print_error($this->db);
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
 		if ($forceall == 1 || (empty($forceall) && isModEnabled("product") && isModEnabled("service"))
1167 1167
 			|| (empty($forceall) && !isModEnabled('product') && !isModEnabled('service'))) {
1168 1168
 			if (empty($hidetext)) {
1169
-				print $langs->trans("Type") . ': ';
1169
+				print $langs->trans("Type").': ';
1170 1170
 			}
1171
-			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_' . $htmlname . '" name="' . $htmlname . '">';
1171
+			print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
1172 1172
 			if ($showempty) {
1173 1173
 				print '<option value="-1"';
1174 1174
 				if ($selected == -1) {
@@ -1187,28 +1187,28 @@  discard block
 block discarded – undo
1187 1187
 			if (0 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'product')) {
1188 1188
 				print ' selected';
1189 1189
 			}
1190
-			print '>' . $langs->trans("Product");
1190
+			print '>'.$langs->trans("Product");
1191 1191
 
1192 1192
 			print '<option value="1"';
1193 1193
 			if (1 == $selected || ($selected == -1 && getDolGlobalString('MAIN_FREE_PRODUCT_CHECKED_BY_DEFAULT') == 'service')) {
1194 1194
 				print ' selected';
1195 1195
 			}
1196
-			print '>' . $langs->trans("Service");
1196
+			print '>'.$langs->trans("Service");
1197 1197
 
1198 1198
 			print '</select>';
1199
-			print ajax_combobox('select_' . $htmlname);
1199
+			print ajax_combobox('select_'.$htmlname);
1200 1200
 			//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
1201 1201
 		}
1202 1202
 		if ((empty($forceall) && !isModEnabled('product') && isModEnabled("service")) || $forceall == 3) {
1203 1203
 			print $langs->trans("Service");
1204
-			print '<input type="hidden" name="' . $htmlname . '" value="1">';
1204
+			print '<input type="hidden" name="'.$htmlname.'" value="1">';
1205 1205
 		}
1206 1206
 		if ((empty($forceall) && isModEnabled("product") && !isModEnabled('service')) || $forceall == 2) {
1207 1207
 			print $langs->trans("Product");
1208
-			print '<input type="hidden" name="' . $htmlname . '" value="0">';
1208
+			print '<input type="hidden" name="'.$htmlname.'" value="0">';
1209 1209
 		}
1210 1210
 		if ($forceall < 0) {    // This should happened only for contracts when both predefined product and service are disabled.
1211
-			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
1211
+			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
1212 1212
 		}
1213 1213
 	}
1214 1214
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
 		$langs->load("trips");
1235 1235
 
1236 1236
 		$sql = "SELECT c.code, c.label";
1237
-		$sql .= " FROM " . $this->db->prefix() . "c_type_fees as c";
1237
+		$sql .= " FROM ".$this->db->prefix()."c_type_fees as c";
1238 1238
 		$sql .= " WHERE active > 0";
1239 1239
 
1240 1240
 		$resql = $this->db->query($sql);
@@ -1275,11 +1275,11 @@  discard block
 block discarded – undo
1275 1275
 		// phpcs:enable
1276 1276
 		global $user, $langs;
1277 1277
 
1278
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
1278
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
1279 1279
 
1280 1280
 		$this->load_cache_types_fees();
1281 1281
 
1282
-		print '<select id="select_' . $htmlname . '" class="flat" name="' . $htmlname . '">';
1282
+		print '<select id="select_'.$htmlname.'" class="flat" name="'.$htmlname.'">';
1283 1283
 		if ($showempty) {
1284 1284
 			print '<option value="-1"';
1285 1285
 			if ($selected == -1) {
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 		}
1290 1290
 
1291 1291
 		foreach ($this->cache_types_fees as $key => $value) {
1292
-			print '<option value="' . $key . '"';
1292
+			print '<option value="'.$key.'"';
1293 1293
 			if ($key == $selected) {
1294 1294
 				print ' selected';
1295 1295
 			}
@@ -1341,12 +1341,12 @@  discard block
 block discarded – undo
1341 1341
 				$ajaxoptions = array();
1342 1342
 			}
1343 1343
 
1344
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1344
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1345 1345
 
1346 1346
 			// No immediate load of all database
1347 1347
 			$placeholder = '';
1348 1348
 			if ($selected && empty($selected_input_value)) {
1349
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1349
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1350 1350
 				$societetmp = new Societe($this->db);
1351 1351
 				$societetmp->fetch($selected);
1352 1352
 				$selected_input_value = $societetmp->name;
@@ -1354,11 +1354,11 @@  discard block
 block discarded – undo
1354 1354
 			}
1355 1355
 
1356 1356
 			// mode 1
1357
-			$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)) : '');
1357
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($excludeids) ? '' : '&excludeids='.implode(',', $excludeids)).($showtype ? '&showtype='.urlencode((string) ($showtype)) : '').($showcode ? '&showcode='.urlencode((string) ($showcode)) : '');
1358 1358
 
1359 1359
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1360 1360
 			if (empty($hidelabel)) {
1361
-				$out .= $langs->trans("RefOrLabel") . ' : ';
1361
+				$out .= $langs->trans("RefOrLabel").' : ';
1362 1362
 			} elseif ($hidelabel == 1 && !is_numeric($showempty)) {
1363 1363
 				$placeholder = $langs->trans($showempty);
1364 1364
 			} elseif ($hidelabel > 1) {
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 					$out .= img_picto($langs->trans("Search"), 'search');
1368 1368
 				}
1369 1369
 			}
1370
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1370
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('THIRDPARTY_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1371 1371
 			if ($hidelabel == 3) {
1372 1372
 				$out .= img_picto($langs->trans("Search"), 'search');
1373 1373
 			}
@@ -1429,12 +1429,12 @@  discard block
 block discarded – undo
1429 1429
 				$events = array();
1430 1430
 			}
1431 1431
 
1432
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1432
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1433 1433
 
1434 1434
 			// No immediate load of all database
1435 1435
 			$placeholder = '';
1436 1436
 			if ($selected && empty($selected_input_value)) {
1437
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1437
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1438 1438
 				$contacttmp = new Contact($this->db);
1439 1439
 				$contacttmp->fetch($selected);
1440 1440
 				$selected_input_value = $contacttmp->getFullName($langs);
@@ -1445,11 +1445,11 @@  discard block
 block discarded – undo
1445 1445
 			}
1446 1446
 
1447 1447
 			// mode 1
1448
-			$urloption = 'htmlname=' . urlencode((string) (str_replace('.', '_', $htmlname))) . '&outjson=1&filter=' . urlencode((string) ($filter)) . (empty($exclude) ? '' : '&exclude=' . urlencode($exclude)) . ($showsoc ? '&showsoc=' . urlencode((string) ($showsoc)) : '');
1448
+			$urloption = 'htmlname='.urlencode((string) (str_replace('.', '_', $htmlname))).'&outjson=1&filter='.urlencode((string) ($filter)).(empty($exclude) ? '' : '&exclude='.urlencode($exclude)).($showsoc ? '&showsoc='.urlencode((string) ($showsoc)) : '');
1449 1449
 
1450 1450
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
1451 1451
 
1452
-			$out .= '<input type="text" class="' . $morecss . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' ' . (getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
1452
+			$out .= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '').' '.(getDolGlobalString('CONTACT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
1453 1453
 
1454 1454
 			$out .= ajax_event($htmlname, $events);
1455 1455
 
@@ -1546,30 +1546,30 @@  discard block
 block discarded – undo
1546 1546
 			$sql .= ", s.address, s.zip, s.town";
1547 1547
 			$sql .= ", dictp.code as country_code";
1548 1548
 		}
1549
-		$sql .= " FROM " . $this->db->prefix() . "societe as s";
1549
+		$sql .= " FROM ".$this->db->prefix()."societe as s";
1550 1550
 		if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1551
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
1551
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
1552 1552
 		}
1553 1553
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1554
-			$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
1554
+			$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
1555 1555
 		}
1556
-		$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
1556
+		$sql .= " WHERE s.entity IN (".getEntity('societe').")";
1557 1557
 		if (!empty($user->socid)) {
1558
-			$sql .= " AND s.rowid = " . ((int) $user->socid);
1558
+			$sql .= " AND s.rowid = ".((int) $user->socid);
1559 1559
 		}
1560 1560
 		if ($filter) {
1561 1561
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1562 1562
 			// if not, by testSqlAndScriptInject() only.
1563
-			$sql .= " AND (" . $filter . ")";
1563
+			$sql .= " AND (".$filter.")";
1564 1564
 		}
1565 1565
 		if (!$user->hasRight('societe', 'client', 'voir')) {
1566
-			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
1566
+			$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
1567 1567
 		}
1568 1568
 		if (getDolGlobalString('COMPANY_HIDE_INACTIVE_IN_COMBOBOX')) {
1569 1569
 			$sql .= " AND s.status <> 0";
1570 1570
 		}
1571 1571
 		if (!empty($excludeids)) {
1572
-			$sql .= " AND s.rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeids)) . ")";
1572
+			$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(implode(',', $excludeids)).")";
1573 1573
 		}
1574 1574
 		// Add where from hooks
1575 1575
 		$parameters = array();
@@ -1589,17 +1589,17 @@  discard block
 block discarded – undo
1589 1589
 				if ($i > 0) {
1590 1590
 					$sql .= " AND ";
1591 1591
 				}
1592
-				$sql .= "(s.nom LIKE '" . $this->db->escape($prefix . $crit) . "%')";
1592
+				$sql .= "(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')";
1593 1593
 				$i++;
1594 1594
 			}
1595 1595
 			if (count($search_crit) > 1) {
1596 1596
 				$sql .= ")";
1597 1597
 			}
1598 1598
 			if (isModEnabled('barcode')) {
1599
-				$sql .= " OR s.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1599
+				$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1600 1600
 			}
1601
-			$sql .= " OR s.code_client LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.code_fournisseur LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1602
-			$sql .= " OR s.name_alias LIKE '" . $this->db->escape($prefix . $filterkey) . "%' OR s.tva_intra LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
1601
+			$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1602
+			$sql .= " OR s.name_alias LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.tva_intra LIKE '".$this->db->escape($prefix.$filterkey)."%'";
1603 1603
 			$sql .= ")";
1604 1604
 		}
1605 1605
 		$sql .= $this->db->order("nom", "ASC");
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 		$resql = $this->db->query($sql);
1611 1611
 		if ($resql) {
1612 1612
 			// Construct $out and $outarray
1613
-			$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
1613
+			$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
1614 1614
 
1615 1615
 			$textifempty = (($showempty && !is_numeric($showempty)) ? $langs->trans($showempty) : '');
1616 1616
 			if (getDolGlobalString('COMPANY_USE_SEARCH_TO_SELECT')) {
@@ -1623,7 +1623,7 @@  discard block
 block discarded – undo
1623 1623
 				}
1624 1624
 			}
1625 1625
 			if ($showempty) {
1626
-				$out .= '<option value="-1" data-html="' . dol_escape_htmltag('<span class="opacitymedium">' . ($textifempty ? $textifempty : '&nbsp;') . '</span>') . '">' . $textifempty . '</option>' . "\n";
1626
+				$out .= '<option value="-1" data-html="'.dol_escape_htmltag('<span class="opacitymedium">'.($textifempty ? $textifempty : '&nbsp;').'</span>').'">'.$textifempty.'</option>'."\n";
1627 1627
 			}
1628 1628
 
1629 1629
 			$companytemp = new Societe($this->db);
@@ -1636,18 +1636,18 @@  discard block
 block discarded – undo
1636 1636
 					$label = '';
1637 1637
 					if ($showcode || getDolGlobalString('SOCIETE_ADD_REF_IN_LIST')) {
1638 1638
 						if (($obj->client) && (!empty($obj->code_client))) {
1639
-							$label = $obj->code_client . ' - ';
1639
+							$label = $obj->code_client.' - ';
1640 1640
 						}
1641 1641
 						if (($obj->fournisseur) && (!empty($obj->code_fournisseur))) {
1642
-							$label .= $obj->code_fournisseur . ' - ';
1642
+							$label .= $obj->code_fournisseur.' - ';
1643 1643
 						}
1644
-						$label .= ' ' . $obj->name;
1644
+						$label .= ' '.$obj->name;
1645 1645
 					} else {
1646 1646
 						$label = $obj->name;
1647 1647
 					}
1648 1648
 
1649 1649
 					if (!empty($obj->name_alias)) {
1650
-						$label .= ' (' . $obj->name_alias . ')';
1650
+						$label .= ' ('.$obj->name_alias.')';
1651 1651
 					}
1652 1652
 
1653 1653
 					if (getDolGlobalString('SOCIETE_SHOW_VAT_IN_LIST') && !empty($obj->tva_intra)) {
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 						$companytemp->fournisseur = $obj->fournisseur;
1663 1663
 						$tmptype = $companytemp->getTypeUrl(1, '', 0, 'span');
1664 1664
 						if ($tmptype) {
1665
-							$labelhtml .= ' ' . $tmptype;
1665
+							$labelhtml .= ' '.$tmptype;
1666 1666
 						}
1667 1667
 
1668 1668
 						if ($obj->client || $obj->fournisseur) {
@@ -1672,10 +1672,10 @@  discard block
 block discarded – undo
1672 1672
 							$label .= $langs->trans("Customer");
1673 1673
 						}
1674 1674
 						if ($obj->client == 2 || $obj->client == 3) {
1675
-							$label .= ($obj->client == 3 ? ', ' : '') . $langs->trans("Prospect");
1675
+							$label .= ($obj->client == 3 ? ', ' : '').$langs->trans("Prospect");
1676 1676
 						}
1677 1677
 						if ($obj->fournisseur) {
1678
-							$label .= ($obj->client ? ', ' : '') . $langs->trans("Supplier");
1678
+							$label .= ($obj->client ? ', ' : '').$langs->trans("Supplier");
1679 1679
 						}
1680 1680
 						if ($obj->client || $obj->fournisseur) {
1681 1681
 							$label .= ')';
@@ -1683,9 +1683,9 @@  discard block
 block discarded – undo
1683 1683
 					}
1684 1684
 
1685 1685
 					if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
1686
-						$s = ($obj->address ? ' - ' . $obj->address : '') . ($obj->zip ? ' - ' . $obj->zip : '') . ($obj->town ? ' ' . $obj->town : '');
1686
+						$s = ($obj->address ? ' - '.$obj->address : '').($obj->zip ? ' - '.$obj->zip : '').($obj->town ? ' '.$obj->town : '');
1687 1687
 						if (!empty($obj->country_code)) {
1688
-							$s .= ', ' . $langs->trans('Country' . $obj->country_code);
1688
+							$s .= ', '.$langs->trans('Country'.$obj->country_code);
1689 1689
 						}
1690 1690
 						$label .= $s;
1691 1691
 						$labelhtml .= $s;
@@ -1693,9 +1693,9 @@  discard block
 block discarded – undo
1693 1693
 
1694 1694
 					if (empty($outputmode)) {
1695 1695
 						if (in_array($obj->rowid, $selected)) {
1696
-							$out .= '<option value="' . $obj->rowid . '" selected data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1696
+							$out .= '<option value="'.$obj->rowid.'" selected data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1697 1697
 						} else {
1698
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
1698
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
1699 1699
 						}
1700 1700
 					} else {
1701 1701
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label, 'labelhtml' => $labelhtml));
@@ -1707,9 +1707,9 @@  discard block
 block discarded – undo
1707 1707
 					}
1708 1708
 				}
1709 1709
 			}
1710
-			$out .= '</select>' . "\n";
1710
+			$out .= '</select>'."\n";
1711 1711
 			if (!$forcecombo) {
1712
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1712
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1713 1713
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("COMPANY_USE_SEARCH_TO_SELECT"));
1714 1714
 			}
1715 1715
 		} else {
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		}
1799 1799
 
1800 1800
 		if (!is_object($hookmanager)) {
1801
-			include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
1801
+			include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
1802 1802
 			$hookmanager = new HookManager($this->db);
1803 1803
 		}
1804 1804
 
@@ -1807,14 +1807,14 @@  discard block
 block discarded – undo
1807 1807
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1808 1808
 			$sql .= ", s.nom as company, s.town AS company_town";
1809 1809
 		}
1810
-		$sql .= " FROM " . $this->db->prefix() . "socpeople as sp";
1810
+		$sql .= " FROM ".$this->db->prefix()."socpeople as sp";
1811 1811
 		if ($showsoc > 0 || getDolGlobalString('CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST')) {
1812
-			$sql .= " LEFT OUTER JOIN  " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc";
1812
+			$sql .= " LEFT OUTER JOIN  ".$this->db->prefix()."societe as s ON s.rowid=sp.fk_soc";
1813 1813
 		}
1814
-		$sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")";
1814
+		$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
1815 1815
 		$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact
1816 1816
 		if ($socid > 0 || $socid == -1) {
1817
-			$sql .= " AND sp.fk_soc = " . ((int) $socid);
1817
+			$sql .= " AND sp.fk_soc = ".((int) $socid);
1818 1818
 		}
1819 1819
 		if (getDolGlobalString('CONTACT_HIDE_INACTIVE_IN_COMBOBOX')) {
1820 1820
 			$sql .= " AND sp.statut <> 0";
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 		if ($filter) {
1823 1823
 			// $filter is safe because, if it contains '(' or ')', it has been sanitized by testSqlAndScriptInject() and forgeSQLFromUniversalSearchCriteria()
1824 1824
 			// if not, by testSqlAndScriptInject() only.
1825
-			$sql .= " AND (" . $filter . ")";
1825
+			$sql .= " AND (".$filter.")";
1826 1826
 		}
1827 1827
 		// Add where from hooks
1828 1828
 		$parameters = array();
@@ -1830,30 +1830,30 @@  discard block
 block discarded – undo
1830 1830
 		$sql .= $hookmanager->resPrint;
1831 1831
 		$sql .= " ORDER BY sp.lastname ASC";
1832 1832
 
1833
-		dol_syslog(get_class($this) . "::selectcontacts", LOG_DEBUG);
1833
+		dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
1834 1834
 		$resql = $this->db->query($sql);
1835 1835
 		if ($resql) {
1836 1836
 			$num = $this->db->num_rows($resql);
1837 1837
 
1838 1838
 			if ($htmlname != 'none' && !$options_only) {
1839
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlid . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . (($num || empty($disableifempty)) ? '' : ' disabled') . ($multiple ? 'multiple' : '') . ' ' . (!empty($moreparam) ? $moreparam : '') . '>';
1839
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
1840 1840
 			}
1841 1841
 
1842 1842
 			if ($showempty && !is_numeric($showempty)) {
1843 1843
 				$textforempty = $showempty;
1844
-				$out .= '<option class="optiongrey" value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>' . $textforempty . '</option>';
1844
+				$out .= '<option class="optiongrey" value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>'.$textforempty.'</option>';
1845 1845
 			} else {
1846 1846
 				if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) {
1847
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>&nbsp;</option>';
1847
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
1848 1848
 				}
1849 1849
 				if ($showempty == 2) {
1850
-					$out .= '<option value="0"' . (in_array(0, $selected) ? ' selected' : '') . '>-- ' . $langs->trans("Internal") . ' --</option>';
1850
+					$out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
1851 1851
 				}
1852 1852
 			}
1853 1853
 
1854 1854
 			$i = 0;
1855 1855
 			if ($num) {
1856
-				include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
1856
+				include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
1857 1857
 				$contactstatic = new Contact($this->db);
1858 1858
 
1859 1859
 				while ($i < $num) {
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 						}
1890 1890
 						$extendedInfos = implode(' - ', $extendedInfos);
1891 1891
 						if (!empty($extendedInfos)) {
1892
-							$extendedInfos = ' - ' . $extendedInfos;
1892
+							$extendedInfos = ' - '.$extendedInfos;
1893 1893
 						}
1894 1894
 					}
1895 1895
 
@@ -1907,35 +1907,35 @@  discard block
 block discarded – undo
1907 1907
 								$disabled = 1;
1908 1908
 							}
1909 1909
 							if (!empty($selected) && in_array($obj->rowid, $selected)) {
1910
-								$out .= '<option value="' . $obj->rowid . '"';
1910
+								$out .= '<option value="'.$obj->rowid.'"';
1911 1911
 								if ($disabled) {
1912 1912
 									$out .= ' disabled';
1913 1913
 								}
1914 1914
 								$out .= ' selected>';
1915 1915
 
1916
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1916
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1917 1917
 								if ($showfunction && $obj->poste) {
1918
-									$tmplabel .= ' (' . $obj->poste . ')';
1918
+									$tmplabel .= ' ('.$obj->poste.')';
1919 1919
 								}
1920 1920
 								if (($showsoc > 0) && $obj->company) {
1921
-									$tmplabel .= ' - (' . $obj->company . ')';
1921
+									$tmplabel .= ' - ('.$obj->company.')';
1922 1922
 								}
1923 1923
 
1924 1924
 								$out .= $tmplabel;
1925 1925
 								$out .= '</option>';
1926 1926
 							} else {
1927
-								$out .= '<option value="' . $obj->rowid . '"';
1927
+								$out .= '<option value="'.$obj->rowid.'"';
1928 1928
 								if ($disabled) {
1929 1929
 									$out .= ' disabled';
1930 1930
 								}
1931 1931
 								$out .= '>';
1932 1932
 
1933
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1933
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1934 1934
 								if ($showfunction && $obj->poste) {
1935
-									$tmplabel .= ' (' . $obj->poste . ')';
1935
+									$tmplabel .= ' ('.$obj->poste.')';
1936 1936
 								}
1937 1937
 								if (($showsoc > 0) && $obj->company) {
1938
-									$tmplabel .= ' - (' . $obj->company . ')';
1938
+									$tmplabel .= ' - ('.$obj->company.')';
1939 1939
 								}
1940 1940
 
1941 1941
 								$out .= $tmplabel;
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
 							}
1944 1944
 						} else {
1945 1945
 							if (in_array($obj->rowid, $selected)) {
1946
-								$tmplabel = $contactstatic->getFullName($langs) . $extendedInfos;
1946
+								$tmplabel = $contactstatic->getFullName($langs).$extendedInfos;
1947 1947
 								if ($showfunction && $obj->poste) {
1948
-									$tmplabel .= ' (' . $obj->poste . ')';
1948
+									$tmplabel .= ' ('.$obj->poste.')';
1949 1949
 								}
1950 1950
 								if (($showsoc > 0) && $obj->company) {
1951
-									$tmplabel .= ' - (' . $obj->company . ')';
1951
+									$tmplabel .= ' - ('.$obj->company.')';
1952 1952
 								}
1953 1953
 
1954 1954
 								$out .= $tmplabel;
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 				}
1964 1964
 			} else {
1965 1965
 				$labeltoshow = ($socid != -1) ? ($langs->trans($socid ? "NoContactDefinedForThirdParty" : "NoContactDefined")) : $langs->trans('SelectAThirdPartyFirst');
1966
-				$out .= '<option class="disabled" value="-1"' . (($showempty == 2 || $multiple) ? '' : ' selected') . ' disabled="disabled">';
1966
+				$out .= '<option class="disabled" value="-1"'.(($showempty == 2 || $multiple) ? '' : ' selected').' disabled="disabled">';
1967 1967
 				$out .= $labeltoshow;
1968 1968
 				$out .= '</option>';
1969 1969
 			}
@@ -1984,7 +1984,7 @@  discard block
 block discarded – undo
1984 1984
 			}
1985 1985
 
1986 1986
 			if ($conf->use_javascript_ajax && !$forcecombo && !$options_only) {
1987
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
1987
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
1988 1988
 				$out .= ajax_combobox($htmlid, $events, getDolGlobalInt("CONTACT_USE_SEARCH_TO_SELECT"));
1989 1989
 			}
1990 1990
 
@@ -2023,18 +2023,18 @@  discard block
 block discarded – undo
2023 2023
 		// On recherche les remises
2024 2024
 		$sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
2025 2025
 		$sql .= " re.description, re.fk_facture_source";
2026
-		$sql .= " FROM " . $this->db->prefix() . "societe_remise_except as re";
2027
-		$sql .= " WHERE re.fk_soc = " . (int) $socid;
2028
-		$sql .= " AND re.entity = " . $conf->entity;
2026
+		$sql .= " FROM ".$this->db->prefix()."societe_remise_except as re";
2027
+		$sql .= " WHERE re.fk_soc = ".(int) $socid;
2028
+		$sql .= " AND re.entity = ".$conf->entity;
2029 2029
 		if ($filter) {
2030
-			$sql .= " AND " . $filter;
2030
+			$sql .= " AND ".$filter;
2031 2031
 		}
2032 2032
 		$sql .= " ORDER BY re.description ASC";
2033 2033
 
2034
-		dol_syslog(get_class($this) . "::select_remises", LOG_DEBUG);
2034
+		dol_syslog(get_class($this)."::select_remises", LOG_DEBUG);
2035 2035
 		$resql = $this->db->query($sql);
2036 2036
 		if ($resql) {
2037
-			print '<select id="select_' . $htmlname . '" class="flat maxwidthonsmartphone" name="' . $htmlname . '">';
2037
+			print '<select id="select_'.$htmlname.'" class="flat maxwidthonsmartphone" name="'.$htmlname.'">';
2038 2038
 			$num = $this->db->num_rows($resql);
2039 2039
 
2040 2040
 			$qualifiedlines = $num;
@@ -2072,16 +2072,16 @@  discard block
 block discarded – undo
2072 2072
 					if (getDolGlobalString('MAIN_SHOW_FACNUMBER_IN_DISCOUNT_LIST') && !empty($obj->fk_facture_source)) {
2073 2073
 						$tmpfac = new Facture($this->db);
2074 2074
 						if ($tmpfac->fetch($obj->fk_facture_source) > 0) {
2075
-							$desc = $desc . ' - ' . $tmpfac->ref;
2075
+							$desc = $desc.' - '.$tmpfac->ref;
2076 2076
 						}
2077 2077
 					}
2078 2078
 
2079
-					print '<option value="' . $obj->rowid . '"' . $selectstring . $disabled . '>' . $desc . ' (' . price($obj->amount_ht) . ' ' . $langs->trans("HT") . ' - ' . price($obj->amount_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
2079
+					print '<option value="'.$obj->rowid.'"'.$selectstring.$disabled.'>'.$desc.' ('.price($obj->amount_ht).' '.$langs->trans("HT").' - '.price($obj->amount_ttc).' '.$langs->trans("TTC").')</option>';
2080 2080
 					$i++;
2081 2081
 				}
2082 2082
 			}
2083 2083
 			print '</select>';
2084
-			print ajax_combobox('select_' . $htmlname);
2084
+			print ajax_combobox('select_'.$htmlname);
2085 2085
 
2086 2086
 			return $qualifiedlines;
2087 2087
 		} else {
@@ -2190,14 +2190,14 @@  discard block
 block discarded – undo
2190 2190
 		if ($showlabelofentity) {
2191 2191
 			$sql .= ", e.label";
2192 2192
 		}
2193
-		$sql .= " FROM " . $this->db->prefix() . "user as u";
2193
+		$sql .= " FROM ".$this->db->prefix()."user as u";
2194 2194
 		if ($showlabelofentity) {
2195
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
2195
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid = u.entity";
2196 2196
 		}
2197 2197
 		// Condition here should be the same than into societe->getSalesRepresentatives().
2198 2198
 		if ($userissuperadminentityone && $force_entity != 'default') {
2199 2199
 			if (!empty($force_entity)) {
2200
-				$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
2200
+				$sql .= " WHERE u.entity IN (0, ".$this->db->sanitize($force_entity).")";
2201 2201
 			} else {
2202 2202
 				$sql .= " WHERE u.entity IS NOT NULL";
2203 2203
 			}
@@ -2205,18 +2205,18 @@  discard block
 block discarded – undo
2205 2205
 			if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
2206 2206
 				$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
2207 2207
 			} else {
2208
-				$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
2208
+				$sql .= " WHERE u.entity IN (".getEntity('user').")";
2209 2209
 			}
2210 2210
 		}
2211 2211
 
2212 2212
 		if (!empty($user->socid)) {
2213
-			$sql .= " AND u.fk_soc = " . ((int) $user->socid);
2213
+			$sql .= " AND u.fk_soc = ".((int) $user->socid);
2214 2214
 		}
2215 2215
 		if (is_array($exclude) && $excludeUsers) {
2216
-			$sql .= " AND u.rowid NOT IN (" . $this->db->sanitize($excludeUsers) . ")";
2216
+			$sql .= " AND u.rowid NOT IN (".$this->db->sanitize($excludeUsers).")";
2217 2217
 		}
2218 2218
 		if ($includeUsers) {
2219
-			$sql .= " AND u.rowid IN (" . $this->db->sanitize($includeUsers) . ")";
2219
+			$sql .= " AND u.rowid IN (".$this->db->sanitize($includeUsers).")";
2220 2220
 		}
2221 2221
 		if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
2222 2222
 			$sql .= " AND u.statut <> 0";
@@ -2228,7 +2228,7 @@  discard block
 block discarded – undo
2228 2228
 			$sql .= " AND u.fk_soc IS NULL";
2229 2229
 		}
2230 2230
 		if (!empty($morefilter)) {
2231
-			$sql .= " " . $morefilter;
2231
+			$sql .= " ".$morefilter;
2232 2232
 		}
2233 2233
 
2234 2234
 		//Add hook to filter on user (for example on usergroup define in custom modules)
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 			$sql .= " ORDER BY u.statut DESC, u.lastname ASC, u.firstname ASC";
2244 2244
 		}
2245 2245
 
2246
-		dol_syslog(get_class($this) . "::select_dolusers", LOG_DEBUG);
2246
+		dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG);
2247 2247
 
2248 2248
 		$resql = $this->db->query($sql);
2249 2249
 		if ($resql) {
@@ -2251,7 +2251,7 @@  discard block
 block discarded – undo
2251 2251
 			$i = 0;
2252 2252
 			if ($num) {
2253 2253
 				// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
2254
-				$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : ' minwidth200') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
2254
+				$out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
2255 2255
 				if ($show_empty && !$multiple) {
2256 2256
 					$textforempty = ' ';
2257 2257
 					if (!empty($conf->use_javascript_ajax)) {
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 					if (!is_numeric($show_empty)) {
2261 2261
 						$textforempty = $show_empty;
2262 2262
 					}
2263
-					$out .= '<option class="optiongrey" value="' . ($show_empty < 0 ? $show_empty : -1) . '"' . ((empty($selected) || in_array(-1, $selected)) ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
2263
+					$out .= '<option class="optiongrey" value="'.($show_empty < 0 ? $show_empty : -1).'"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
2264 2264
 
2265 2265
 					$outarray[($show_empty < 0 ? $show_empty : -1)] = $textforempty;
2266 2266
 					$outarray2[($show_empty < 0 ? $show_empty : -1)] = array(
@@ -2272,13 +2272,13 @@  discard block
 block discarded – undo
2272 2272
 					);
2273 2273
 				}
2274 2274
 				if ($show_every) {
2275
-					$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
2275
+					$out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
2276 2276
 
2277
-					$outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --';
2277
+					$outarray[-2] = '-- '.$langs->trans("Everybody").' --';
2278 2278
 					$outarray2[-2] = array(
2279 2279
 						'id' => -2,
2280
-						'label' => '-- ' . $langs->trans("Everybody") . ' --',
2281
-						'labelhtml' => '-- ' . $langs->trans("Everybody") . ' --',
2280
+						'label' => '-- '.$langs->trans("Everybody").' --',
2281
+						'labelhtml' => '-- '.$langs->trans("Everybody").' --',
2282 2282
 						'color' => '',
2283 2283
 						'picto' => ''
2284 2284
 					);
@@ -2329,21 +2329,21 @@  discard block
 block discarded – undo
2329 2329
 					}
2330 2330
 					if ($showstatus >= 0) {
2331 2331
 						if ($obj->status == 1 && $showstatus == 1) {
2332
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Enabled');
2333
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Enabled');
2332
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Enabled');
2333
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Enabled');
2334 2334
 						}
2335 2335
 						if ($obj->status == 0 && $showstatus == 1) {
2336
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans('Disabled');
2337
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans('Disabled');
2336
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans('Disabled');
2337
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans('Disabled');
2338 2338
 						}
2339 2339
 					}
2340 2340
 					if ($showlabelofentity) {
2341 2341
 						if (empty($obj->entity)) {
2342
-							$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
2343
-							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
2342
+							$moreinfo .= ($moreinfo ? ' - ' : ' (').$langs->trans("AllEntities");
2343
+							$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').$langs->trans("AllEntities");
2344 2344
 						} else {
2345 2345
 							if ($obj->entity != $conf->entity) {
2346
-								$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2346
+								$moreinfo .= ($moreinfo ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2347 2347
 								$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
2348 2348
 							}
2349 2349
 						}
@@ -2352,13 +2352,13 @@  discard block
 block discarded – undo
2352 2352
 					$moreinfohtml .= (!empty($moreinfohtml) ? ')</span>' : '');
2353 2353
 					if (!empty($disableline) && $disableline != '1') {
2354 2354
 						// Add text from $enableonlytext parameter
2355
-						$moreinfo .= ' - ' . $disableline;
2356
-						$moreinfohtml .= ' - ' . $disableline;
2355
+						$moreinfo .= ' - '.$disableline;
2356
+						$moreinfohtml .= ' - '.$disableline;
2357 2357
 					}
2358 2358
 					$labeltoshow .= $moreinfo;
2359 2359
 					$labeltoshowhtml .= $moreinfohtml;
2360 2360
 
2361
-					$out .= '<option value="' . $obj->rowid . '"';
2361
+					$out .= '<option value="'.$obj->rowid.'"';
2362 2362
 					if (!empty($disableline)) {
2363 2363
 						$out .= ' disabled';
2364 2364
 					}
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 					}
2368 2368
 					$out .= ' data-html="';
2369 2369
 
2370
-					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1) . ' ';
2370
+					$outhtml = $userstatic->getNomUrl(-3, '', 0, 1, 24, 1, 'login', '', 1).' ';
2371 2371
 					if ($showstatus >= 0 && $obj->status == 0) {
2372 2372
 						$outhtml .= '<strike class="opacitymediumxxx">';
2373 2373
 					}
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
 					$out .= $labeltoshow;
2383 2383
 					$out .= '</option>';
2384 2384
 
2385
-					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
2385
+					$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength).$moreinfo;
2386 2386
 					$outarray2[$userstatic->id] = array(
2387 2387
 						'id' => $userstatic->id,
2388 2388
 						'label' => $labeltoshow,
@@ -2394,14 +2394,14 @@  discard block
 block discarded – undo
2394 2394
 					$i++;
2395 2395
 				}
2396 2396
 			} else {
2397
-				$out .= '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '" disabled>';
2398
-				$out .= '<option value="">' . $langs->trans("None") . '</option>';
2397
+				$out .= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" disabled>';
2398
+				$out .= '<option value="">'.$langs->trans("None").'</option>';
2399 2399
 			}
2400 2400
 			$out .= '</select>';
2401 2401
 
2402 2402
 			if ($num && !$forcecombo) {
2403 2403
 				// Enhance with select2
2404
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2404
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2405 2405
 				$out .= ajax_combobox($htmlname);
2406 2406
 			}
2407 2407
 		} else {
@@ -2477,16 +2477,16 @@  discard block
 block discarded – undo
2477 2477
 			$out .= $userstatic->getNomUrl(-1);
2478 2478
 			if ($i == 0) {
2479 2479
 				$ownerid = $value['id'];
2480
-				$out .= ' (' . $langs->trans("Owner") . ')';
2480
+				$out .= ' ('.$langs->trans("Owner").')';
2481 2481
 			}
2482 2482
 			if ($nbassignetouser > 1 && $action != 'view') {
2483
-				$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 . '">';
2483
+				$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.'">';
2484 2484
 			}
2485 2485
 			// Show my availability
2486 2486
 			if ($showproperties) {
2487 2487
 				if ($ownerid == $value['id'] && is_array($listofuserid) && count($listofuserid) && in_array($ownerid, array_keys($listofuserid))) {
2488 2488
 					$out .= '<div class="myavailability inline-block">';
2489
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<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>';
2489
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<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>';
2490 2490
 					$out .= '</div>';
2491 2491
 				}
2492 2492
 			}
@@ -2503,15 +2503,15 @@  discard block
 block discarded – undo
2503 2503
 		// Method with no ajax
2504 2504
 		if ($action != 'view') {
2505 2505
 			$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
2506
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2506
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2507 2507
 			$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
2508 2508
 			$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
2509
-			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#' . $action . 'assignedtouser").attr("disabled", false); }';
2510
-			$out .= ' else { jQuery("#' . $action . 'assignedtouser").attr("disabled", true); }';
2509
+			$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';
2510
+			$out .= ' else { jQuery("#'.$action.'assignedtouser").attr("disabled", true); }';
2511 2511
 			$out .= '});';
2512 2512
 			$out .= '})</script>';
2513 2513
 			$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2514
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtouser" name="' . $action . 'assignedtouser" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2514
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtouser" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2515 2515
 			$out .= '<br>';
2516 2516
 		}
2517 2517
 
@@ -2570,13 +2570,13 @@  discard block
 block discarded – undo
2570 2570
 			$resourcestatic->fetch($value['id']);
2571 2571
 			$out .= $resourcestatic->getNomUrl(-1);
2572 2572
 			if ($nbassignetoresource >= 1 && $action != 'view') {
2573
-				$out .= ' <input type="image" style="border: 0px;" src="' . img_picto($langs->trans("Remove"), 'delete', '', 0, 1) . '" value="' . $resourcestatic->id . '" class="removedassignedresource reposition" id="removedassignedresource_' . $resourcestatic->id . '" name="removedassignedresource_' . $resourcestatic->id . '">';
2573
+				$out .= ' <input type="image" style="border: 0px;" src="'.img_picto($langs->trans("Remove"), 'delete', '', 0, 1).'" value="'.$resourcestatic->id.'" class="removedassignedresource reposition" id="removedassignedresource_'.$resourcestatic->id.'" name="removedassignedresource_'.$resourcestatic->id.'">';
2574 2574
 			}
2575 2575
 			// Show my availability
2576 2576
 			if ($showproperties) {
2577 2577
 				if (is_array($listofresourceid) && count($listofresourceid)) {
2578 2578
 					$out .= '<div class="myavailability inline-block">';
2579
-					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<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>';
2579
+					$out .= '<span class="hideonsmartphone">&nbsp;-&nbsp;<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>';
2580 2580
 					$out .= '</div>';
2581 2581
 				}
2582 2582
 			}
@@ -2593,11 +2593,11 @@  discard block
 block discarded – undo
2593 2593
 		// Method with no ajax
2594 2594
 		if ($action != 'view') {
2595 2595
 			$out .= '<input type="hidden" class="removedassignedresourcehidden" name="removedassignedresource" value="">';
2596
-			$out .= '<script nonce="' . getNonce() . '" type="text/javascript">jQuery(document).ready(function () {';
2596
+			$out .= '<script nonce="'.getNonce().'" type="text/javascript">jQuery(document).ready(function () {';
2597 2597
 			$out .= 'jQuery(".removedassignedresource").click(function() { jQuery(".removedassignedresourcehidden").val(jQuery(this).val()); });';
2598 2598
 			$out .= 'jQuery(".assignedtoresource").change(function() { console.log(jQuery(".assignedtoresource option:selected").val());';
2599
-			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#' . $action . 'assignedtoresource").attr("disabled", false); }';
2600
-			$out .= ' else { jQuery("#' . $action . 'assignedtoresource").attr("disabled", true); }';
2599
+			$out .= ' if (jQuery(".assignedtoresource option:selected").val() > 0) { jQuery("#'.$action.'assignedtoresource").attr("disabled", false); }';
2600
+			$out .= ' else { jQuery("#'.$action.'assignedtoresource").attr("disabled", true); }';
2601 2601
 			$out .= '});';
2602 2602
 			$out .= '})</script>';
2603 2603
 
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
 			$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
2606 2606
 			$out .= $formresources->select_resource_list(0, $htmlname, [], 1, 1, 0, $events, array(), 2, 0);
2607 2607
 			//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
2608
-			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
2608
+			$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="'.$action.'assignedtoresource" name="'.$action.'assignedtoresource" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
2609 2609
 			$out .= '<br>';
2610 2610
 		}
2611 2611
 
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 			$placeholder = '';
2670 2670
 
2671 2671
 			if ($selected && empty($selected_input_value)) {
2672
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2672
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2673 2673
 				$producttmpselect = new Product($this->db);
2674 2674
 				$producttmpselect->fetch($selected);
2675 2675
 				$selected_input_value = $producttmpselect->ref;
@@ -2684,20 +2684,20 @@  discard block
 block discarded – undo
2684 2684
 				}
2685 2685
 			}
2686 2686
 			// mode=1 means customers products
2687
-			$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;
2687
+			$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;
2688 2688
 			if ((int) $warehouseId > 0) {
2689
-				$urloption .= '&warehouseid=' . (int) $warehouseId;
2689
+				$urloption .= '&warehouseid='.(int) $warehouseId;
2690 2690
 			}
2691
-			$out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions);
2691
+			$out .= ajax_autocompleter((string) $selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), getDolGlobalInt('PRODUCT_SEARCH_AUTO_SELECT_IF_ONLY_ONE', 1), $ajaxoptions);
2692 2692
 
2693 2693
 			if (isModEnabled('variants') && is_array($selected_combinations)) {
2694 2694
 				// Code to automatically insert with javascript the select of attributes under the select of product
2695 2695
 				// when a parent of variant has been selected.
2696 2696
 				$out .= '
2697 2697
 				<!-- script to auto show attributes select tags if a variant was selected -->
2698
-				<script nonce="' . getNonce() . '">
2698
+				<script nonce="' . getNonce().'">
2699 2699
 					// auto show attributes fields
2700
-					selected = ' . json_encode($selected_combinations) . ';
2700
+					selected = ' . json_encode($selected_combinations).';
2701 2701
 					combvalues = {};
2702 2702
 
2703 2703
 					jQuery(document).ready(function () {
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 							}
2709 2709
 						});
2710 2710
 
2711
-						jQuery("input#' . $htmlname . '").change(function () {
2711
+						jQuery("input#' . $htmlname.'").change(function () {
2712 2712
 
2713 2713
 							if (!jQuery(this).val()) {
2714 2714
 								jQuery(\'div#attributes_box\').empty();
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
 
2718 2718
 							console.log("A change has started. We get variants fields to inject html select");
2719 2719
 
2720
-							jQuery.getJSON("' . DOL_URL_ROOT . '/variants/ajax/getCombinations.php", {
2720
+							jQuery.getJSON("' . DOL_URL_ROOT.'/variants/ajax/getCombinations.php", {
2721 2721
 								id: jQuery(this).val()
2722 2722
 							}, function (data) {
2723 2723
 								jQuery(\'div#attributes_box\').empty();
@@ -2760,21 +2760,21 @@  discard block
 block discarded – undo
2760 2760
 							})
2761 2761
 						});
2762 2762
 
2763
-						' . ($selected ? 'jQuery("input#' . $htmlname . '").change();' : '') . '
2763
+						' . ($selected ? 'jQuery("input#'.$htmlname.'").change();' : '').'
2764 2764
 					});
2765 2765
 				</script>
2766 2766
                 ';
2767 2767
 			}
2768 2768
 
2769 2769
 			if (empty($hidelabel)) {
2770
-				$out .= $langs->trans("RefOrLabel") . ' : ';
2770
+				$out .= $langs->trans("RefOrLabel").' : ';
2771 2771
 			} elseif ($hidelabel > 1) {
2772
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
2772
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
2773 2773
 				if ($hidelabel == 2) {
2774 2774
 					$out .= img_picto($langs->trans("Search"), 'search');
2775 2775
 				}
2776 2776
 			}
2777
-			$out .= '<input type="text" class="minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
2777
+			$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
2778 2778
 			if ($hidelabel == 3) {
2779 2779
 				$out .= img_picto($langs->trans("Search"), 'search');
2780 2780
 			}
@@ -2811,33 +2811,33 @@  discard block
 block discarded – undo
2811 2811
 		// phpcs:enable
2812 2812
 		global $db;
2813 2813
 
2814
-		require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
2814
+		require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
2815 2815
 
2816 2816
 		$error = 0;
2817 2817
 		$out = '';
2818 2818
 
2819 2819
 		if (!$forcecombo) {
2820
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
2820
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
2821 2821
 			$events = array();
2822 2822
 			$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
2823 2823
 		}
2824 2824
 
2825
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
2825
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
2826 2826
 
2827 2827
 		$sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
2828
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'bom_bom as b';
2829
-		$sql .= ' WHERE b.entity IN (' . getEntity('bom') . ')';
2828
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
2829
+		$sql .= ' WHERE b.entity IN ('.getEntity('bom').')';
2830 2830
 		if (!empty($status)) {
2831
-			$sql .= ' AND status = ' . (int) $status;
2831
+			$sql .= ' AND status = '.(int) $status;
2832 2832
 		}
2833 2833
 		if (!empty($type)) {
2834
-			$sql .= ' AND bomtype = ' . (int) $type;
2834
+			$sql .= ' AND bomtype = '.(int) $type;
2835 2835
 		}
2836 2836
 		if (!empty($TProducts)) {
2837
-			$sql .= ' AND fk_product IN (' . $this->db->sanitize(implode(',', $TProducts)) . ')';
2837
+			$sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
2838 2838
 		}
2839 2839
 		if (!empty($limit)) {
2840
-			$sql .= ' LIMIT ' . (int) $limit;
2840
+			$sql .= ' LIMIT '.(int) $limit;
2841 2841
 		}
2842 2842
 		$resql = $db->query($sql);
2843 2843
 		if ($resql) {
@@ -2851,11 +2851,11 @@  discard block
 block discarded – undo
2851 2851
 			while ($obj = $db->fetch_object($resql)) {
2852 2852
 				$product = new Product($db);
2853 2853
 				$res = $product->fetch($obj->fk_product);
2854
-				$out .= '<option value="' . $obj->rowid . '"';
2854
+				$out .= '<option value="'.$obj->rowid.'"';
2855 2855
 				if ($obj->rowid == $selected) {
2856 2856
 					$out .= 'selected';
2857 2857
 				}
2858
-				$out .= '>' . $obj->ref . ' - ' . $product->label . ' - ' . $obj->label . '</option>';
2858
+				$out .= '>'.$obj->ref.' - '.$product->label.' - '.$obj->label.'</option>';
2859 2859
 			}
2860 2860
 		} else {
2861 2861
 			$error++;
@@ -2913,7 +2913,7 @@  discard block
 block discarded – undo
2913 2913
 
2914 2914
 		$warehouseStatusArray = array();
2915 2915
 		if (!empty($warehouseStatus)) {
2916
-			require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
2916
+			require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
2917 2917
 			if (preg_match('/warehouseclosed/', $warehouseStatus)) {
2918 2918
 				$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
2919 2919
 			}
@@ -2927,9 +2927,9 @@  discard block
 block discarded – undo
2927 2927
 
2928 2928
 		$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";
2929 2929
 		if (count($warehouseStatusArray)) {
2930
-			$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
2930
+			$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
2931 2931
 		} else {
2932
-			$selectFieldsGrouped = ", " . $this->db->ifsql("p.stock IS NULL", 0, "p.stock") . " AS stock";
2932
+			$selectFieldsGrouped = ", ".$this->db->ifsql("p.stock IS NULL", 0, "p.stock")." AS stock";
2933 2933
 		}
2934 2934
 
2935 2935
 		$sql = "SELECT ";
@@ -2945,9 +2945,9 @@  discard block
 block discarded – undo
2945 2945
 
2946 2946
 		if (getDolGlobalString('PRODUCT_SORT_BY_CATEGORY')) {
2947 2947
 			//Product category
2948
-			$sql .= ", (SELECT " . $this->db->prefix() . "categorie_product.fk_categorie
2949
-						FROM " . $this->db->prefix() . "categorie_product
2950
-						WHERE " . $this->db->prefix() . "categorie_product.fk_product=p.rowid
2948
+			$sql .= ", (SELECT ".$this->db->prefix()."categorie_product.fk_categorie
2949
+						FROM " . $this->db->prefix()."categorie_product
2950
+						WHERE " . $this->db->prefix()."categorie_product.fk_product=p.rowid
2951 2951
 						LIMIT 1
2952 2952
 				) AS categorie_product_id ";
2953 2953
 		}
@@ -2973,15 +2973,15 @@  discard block
 block discarded – undo
2973 2973
 		}
2974 2974
 		// Price by quantity
2975 2975
 		if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2976
-			$sql .= ", (SELECT pp.rowid FROM " . $this->db->prefix() . "product_price as pp WHERE pp.fk_product = p.rowid";
2976
+			$sql .= ", (SELECT pp.rowid FROM ".$this->db->prefix()."product_price as pp WHERE pp.fk_product = p.rowid";
2977 2977
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2978
-				$sql .= " AND price_level = " . ((int) $price_level);
2978
+				$sql .= " AND price_level = ".((int) $price_level);
2979 2979
 			}
2980 2980
 			$sql .= " ORDER BY date_price";
2981 2981
 			$sql .= " DESC LIMIT 1) as price_rowid";
2982
-			$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
2982
+			$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
2983 2983
 			if ($price_level >= 1 && getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) {
2984
-				$sql .= " AND price_level = " . ((int) $price_level);
2984
+				$sql .= " AND price_level = ".((int) $price_level);
2985 2985
 			}
2986 2986
 			$sql .= " ORDER BY date_price";
2987 2987
 			$sql .= " DESC LIMIT 1) as price_by_qty";
@@ -2991,7 +2991,7 @@  discard block
 block discarded – undo
2991 2991
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2992 2992
 
2993 2993
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_FORCE_INDEX')) {
2994
-			$sql .= " USE INDEX (" . $this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')) . ")";
2994
+			$sql .= " USE INDEX (".$this->db->sanitize(getDolGlobalString('MAIN_PRODUCT_FORCE_INDEX')).")";
2995 2995
 		}
2996 2996
 
2997 2997
 		// Add from (left join) from hooks
@@ -3000,53 +3000,53 @@  discard block
 block discarded – undo
3000 3000
 		$sql .= $hookmanager->resPrint;
3001 3001
 
3002 3002
 		if (count($warehouseStatusArray)) {
3003
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as ps on ps.fk_product = p.rowid";
3004
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (" . getEntity('stock') . ")";
3005
-			$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.
3003
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.fk_product = p.rowid";
3004
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")";
3005
+			$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.
3006 3006
 		}
3007 3007
 
3008 3008
 		// include search in supplier ref
3009 3009
 		if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3010
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3010
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
3011 3011
 		}
3012 3012
 
3013 3013
 		//Price by customer
3014 3014
 		if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3015
-			$sql .= " LEFT JOIN  " . $this->db->prefix() . "product_customer_price as pcp ON pcp.fk_soc=" . ((int) $socid) . " AND pcp.fk_product=p.rowid";
3015
+			$sql .= " LEFT JOIN  ".$this->db->prefix()."product_customer_price as pcp ON pcp.fk_soc=".((int) $socid)." AND pcp.fk_product=p.rowid";
3016 3016
 		}
3017 3017
 		// Units
3018 3018
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3019
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3019
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3020 3020
 		}
3021 3021
 		// Multilang : we add translation
3022 3022
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
3023
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_lang as pl ON pl.fk_product = p.rowid ";
3023
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_lang as pl ON pl.fk_product = p.rowid ";
3024 3024
 			if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') && !empty($socid)) {
3025
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
3025
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
3026 3026
 				$soc = new Societe($this->db);
3027 3027
 				$result = $soc->fetch($socid);
3028 3028
 				if ($result > 0 && !empty($soc->default_lang)) {
3029
-					$sql .= " AND pl.lang = '" . $this->db->escape($soc->default_lang) . "'";
3029
+					$sql .= " AND pl.lang = '".$this->db->escape($soc->default_lang)."'";
3030 3030
 				} else {
3031
-					$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3031
+					$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3032 3032
 				}
3033 3033
 			} else {
3034
-				$sql .= " AND pl.lang = '" . $this->db->escape($langs->getDefaultLang()) . "'";
3034
+				$sql .= " AND pl.lang = '".$this->db->escape($langs->getDefaultLang())."'";
3035 3035
 			}
3036 3036
 		}
3037 3037
 
3038 3038
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3039
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3039
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
3040 3040
 		}
3041 3041
 
3042
-		$sql .= ' WHERE p.entity IN (' . getEntity('product') . ')';
3042
+		$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
3043 3043
 
3044 3044
 		if (getDolGlobalString('PRODUIT_ATTRIBUTES_HIDECHILD')) {
3045 3045
 			$sql .= " AND pac.rowid IS NULL";
3046 3046
 		}
3047 3047
 
3048 3048
 		if ($finished == 0) {
3049
-			$sql .= " AND p.finished = " . ((int) $finished);
3049
+			$sql .= " AND p.finished = ".((int) $finished);
3050 3050
 		} elseif ($finished == 1) {
3051 3051
 			$sql .= " AND p.finished = ".((int) $finished);
3052 3052
 		}
@@ -3054,11 +3054,11 @@  discard block
 block discarded – undo
3054 3054
 			$sql .= " AND p.tosell = ".((int) $status);
3055 3055
 		}
3056 3056
 		if ($status_purchase >= 0) {
3057
-			$sql .= " AND p.tobuy = " . ((int) $status_purchase);
3057
+			$sql .= " AND p.tobuy = ".((int) $status_purchase);
3058 3058
 		}
3059 3059
 		// Filter by product type
3060 3060
 		if (strval($filtertype) != '') {
3061
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3061
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3062 3062
 		} elseif (!isModEnabled('product')) { // when product module is disabled, show services only
3063 3063
 			$sql .= " AND p.fk_product_type = 1";
3064 3064
 		} elseif (!isModEnabled('service')) { // when service module is disabled, show products only
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
 		}
3067 3067
 
3068 3068
 		if ((int) $warehouseId > 0) {
3069
-			$sql .= " AND EXISTS (SELECT psw.fk_product FROM " . $this->db->prefix() . "product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";
3069
+			$sql .= " AND EXISTS (SELECT psw.fk_product FROM ".$this->db->prefix()."product_stock as psw WHERE psw.reel>0 AND psw.fk_entrepot=".(int) $warehouseId." AND psw.fk_product = p.rowid)";
3070 3070
 		}
3071 3071
 
3072 3072
 		// Add where from hooks
@@ -3087,21 +3087,21 @@  discard block
 block discarded – undo
3087 3087
 				if ($i > 0) {
3088 3088
 					$sql .= " AND ";
3089 3089
 				}
3090
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3090
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3091 3091
 				if (getDolGlobalInt('MAIN_MULTILANGS')) {
3092
-					$sql .= " OR pl.label LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3092
+					$sql .= " OR pl.label LIKE '".$this->db->escape($prefix.$crit)."%'";
3093 3093
 				}
3094 3094
 				if ((getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($socid)) {
3095
-					$sql .= " OR pcp.ref_customer LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3095
+					$sql .= " OR pcp.ref_customer LIKE '".$this->db->escape($prefix.$crit)."%'";
3096 3096
 				}
3097 3097
 				if (getDolGlobalString('PRODUCT_AJAX_SEARCH_ON_DESCRIPTION')) {
3098
-					$sql .= " OR p.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3098
+					$sql .= " OR p.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3099 3099
 					if (getDolGlobalInt('MAIN_MULTILANGS')) {
3100
-						$sql .= " OR pl.description LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3100
+						$sql .= " OR pl.description LIKE '".$this->db->escape($prefix.$crit)."%'";
3101 3101
 					}
3102 3102
 				}
3103 3103
 				if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
3104
-					$sql .= " OR pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3104
+					$sql .= " OR pfp.ref_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3105 3105
 				}
3106 3106
 				$sql .= ")";
3107 3107
 				$i++;
@@ -3110,12 +3110,12 @@  discard block
 block discarded – undo
3110 3110
 				$sql .= ")";
3111 3111
 			}
3112 3112
 			if (isModEnabled('barcode')) {
3113
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3113
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3114 3114
 			}
3115 3115
 			$sql .= ')';
3116 3116
 		}
3117 3117
 		if (count($warehouseStatusArray)) {
3118
-			$sql .= " GROUP BY " . $selectFields;
3118
+			$sql .= " GROUP BY ".$selectFields;
3119 3119
 		}
3120 3120
 
3121 3121
 		//Sort by category
@@ -3130,23 +3130,23 @@  discard block
 block discarded – undo
3130 3130
 		$sql .= $this->db->plimit($limit, 0);
3131 3131
 
3132 3132
 		// Build output string
3133
-		dol_syslog(get_class($this) . "::select_produits_list search products", LOG_DEBUG);
3133
+		dol_syslog(get_class($this)."::select_produits_list search products", LOG_DEBUG);
3134 3134
 		$result = $this->db->query($sql);
3135 3135
 		if ($result) {
3136
-			require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3137
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3138
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3136
+			require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3137
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3138
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3139 3139
 
3140 3140
 			$num = $this->db->num_rows($result);
3141 3141
 
3142 3142
 			$events = array();
3143 3143
 
3144 3144
 			if (!$forcecombo) {
3145
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
3145
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
3146 3146
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
3147 3147
 			}
3148 3148
 
3149
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
3149
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
3150 3150
 
3151 3151
 			$textifempty = '';
3152 3152
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
 				}
3164 3164
 			}
3165 3165
 			if ($showempty) {
3166
-				$out .= '<option value="-1" selected>' . ($textifempty ? $textifempty : '&nbsp;') . '</option>';
3166
+				$out .= '<option value="-1" selected>'.($textifempty ? $textifempty : '&nbsp;').'</option>';
3167 3167
 			}
3168 3168
 
3169 3169
 			$i = 0;
@@ -3174,11 +3174,11 @@  discard block
 block discarded – undo
3174 3174
 
3175 3175
 				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
3176 3176
 					$sql = "SELECT rowid, quantity, price, unitprice, remise_percent, remise, price_base_type";
3177
-					$sql .= " FROM " . $this->db->prefix() . "product_price_by_qty";
3178
-					$sql .= " WHERE fk_product_price = " . ((int) $objp->price_rowid);
3177
+					$sql .= " FROM ".$this->db->prefix()."product_price_by_qty";
3178
+					$sql .= " WHERE fk_product_price = ".((int) $objp->price_rowid);
3179 3179
 					$sql .= " ORDER BY quantity ASC";
3180 3180
 
3181
-					dol_syslog(get_class($this) . "::select_produits_list search prices by qty", LOG_DEBUG);
3181
+					dol_syslog(get_class($this)."::select_produits_list search prices by qty", LOG_DEBUG);
3182 3182
 					$result2 = $this->db->query($sql);
3183 3183
 					if ($result2) {
3184 3184
 						$nb_prices = $this->db->num_rows($result2);
@@ -3216,7 +3216,7 @@  discard block
 block discarded – undo
3216 3216
 						$price_product = new Product($this->db);
3217 3217
 						$price_product->fetch($objp->rowid, '', '', 1);
3218 3218
 
3219
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3219
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3220 3220
 						$priceparser = new PriceParser($this->db);
3221 3221
 						$price_result = $priceparser->parseProduct($price_product);
3222 3222
 						if ($price_result >= 0) {
@@ -3302,7 +3302,7 @@  discard block
 block discarded – undo
3302 3302
 			$label = $objp->label_translated;
3303 3303
 		}
3304 3304
 		if (!empty($filterkey) && $filterkey != '') {
3305
-			$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3305
+			$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3306 3306
 		}
3307 3307
 
3308 3308
 		$outkey = $objp->rowid;
@@ -3323,32 +3323,32 @@  discard block
 block discarded – undo
3323 3323
 		$outdurationunit = $outtype == Product::TYPE_SERVICE ? substr($objp->duration, -1) : '';
3324 3324
 
3325 3325
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3326
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
3326
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
3327 3327
 		}
3328 3328
 
3329 3329
 		// Units
3330 3330
 		$outvalUnits = '';
3331 3331
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3332 3332
 			if (!empty($objp->unit_short)) {
3333
-				$outvalUnits .= ' - ' . $objp->unit_short;
3333
+				$outvalUnits .= ' - '.$objp->unit_short;
3334 3334
 			}
3335 3335
 		}
3336 3336
 		if (getDolGlobalString('PRODUCT_SHOW_DIMENSIONS_IN_COMBO')) {
3337 3337
 			if (!empty($objp->weight) && $objp->weight_units !== null) {
3338 3338
 				$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3339
-				$outvalUnits .= ' - ' . $unitToShow;
3339
+				$outvalUnits .= ' - '.$unitToShow;
3340 3340
 			}
3341 3341
 			if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3342
-				$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3343
-				$outvalUnits .= ' - ' . $unitToShow;
3342
+				$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3343
+				$outvalUnits .= ' - '.$unitToShow;
3344 3344
 			}
3345 3345
 			if (!empty($objp->surface) && $objp->surface_units !== null) {
3346 3346
 				$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3347
-				$outvalUnits .= ' - ' . $unitToShow;
3347
+				$outvalUnits .= ' - '.$unitToShow;
3348 3348
 			}
3349 3349
 			if (!empty($objp->volume) && $objp->volume_units !== null) {
3350 3350
 				$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3351
-				$outvalUnits .= ' - ' . $unitToShow;
3351
+				$outvalUnits .= ' - '.$unitToShow;
3352 3352
 			}
3353 3353
 		}
3354 3354
 		if ($outdurationvalue && $outdurationunit) {
@@ -3360,7 +3360,7 @@  discard block
 block discarded – undo
3360 3360
 				'y' => $langs->trans('Year')
3361 3361
 			);
3362 3362
 			if (isset($da[$outdurationunit])) {
3363
-				$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3363
+				$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3364 3364
 			}
3365 3365
 		}
3366 3366
 
@@ -3380,31 +3380,31 @@  discard block
 block discarded – undo
3380 3380
 		$labeltoshow = '';
3381 3381
 		$labeltoshow .= $objp->ref;
3382 3382
 		if (!empty($objp->custref)) {
3383
-			$labeltoshow .= ' (' . $objp->custref . ')';
3383
+			$labeltoshow .= ' ('.$objp->custref.')';
3384 3384
 		}
3385 3385
 		if ($outbarcode) {
3386
-			$labeltoshow .= ' (' . $outbarcode . ')';
3386
+			$labeltoshow .= ' ('.$outbarcode.')';
3387 3387
 		}
3388
-		$labeltoshow .= ' - ' . dol_trunc($label, $maxlengtharticle);
3388
+		$labeltoshow .= ' - '.dol_trunc($label, $maxlengtharticle);
3389 3389
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3390
-			$labeltoshow .= ' (' . getCountry($outorigin, '1') . ')';
3390
+			$labeltoshow .= ' ('.getCountry($outorigin, '1').')';
3391 3391
 		}
3392 3392
 
3393 3393
 		// Set $labltoshowhtml
3394 3394
 		$labeltoshowhtml = '';
3395 3395
 		$labeltoshowhtml .= $objp->ref;
3396 3396
 		if (!empty($objp->custref)) {
3397
-			$labeltoshowhtml .= ' (' . $objp->custref . ')';
3397
+			$labeltoshowhtml .= ' ('.$objp->custref.')';
3398 3398
 		}
3399 3399
 		if (!empty($filterkey) && $filterkey != '') {
3400
-			$labeltoshowhtml = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3400
+			$labeltoshowhtml = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $labeltoshowhtml, 1);
3401 3401
 		}
3402 3402
 		if ($outbarcode) {
3403
-			$labeltoshowhtml .= ' (' . $outbarcode . ')';
3403
+			$labeltoshowhtml .= ' ('.$outbarcode.')';
3404 3404
 		}
3405
-		$labeltoshowhtml .= ' - ' . dol_trunc($label, $maxlengtharticle);
3405
+		$labeltoshowhtml .= ' - '.dol_trunc($label, $maxlengtharticle);
3406 3406
 		if ($outorigin && getDolGlobalString('PRODUCT_SHOW_ORIGIN_IN_COMBO')) {
3407
-			$labeltoshowhtml .= ' (' . getCountry($outorigin, '1') . ')';
3407
+			$labeltoshowhtml .= ' ('.getCountry($outorigin, '1').')';
3408 3408
 		}
3409 3409
 
3410 3410
 		// Stock
@@ -3412,14 +3412,14 @@  discard block
 block discarded – undo
3412 3412
 		$labeltoshowhtmlstock = '';
3413 3413
 		if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3414 3414
 			if ($user->hasRight('stock', 'lire')) {
3415
-				$labeltoshowstock .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3415
+				$labeltoshowstock .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3416 3416
 
3417 3417
 				if ($objp->stock > 0) {
3418 3418
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_ok">';
3419 3419
 				} elseif ($objp->stock <= 0) {
3420 3420
 					$labeltoshowhtmlstock .= ' - <span class="product_line_stock_too_low">';
3421 3421
 				}
3422
-				$labeltoshowhtmlstock .= $langs->transnoentities("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3422
+				$labeltoshowhtmlstock .= $langs->transnoentities("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3423 3423
 				$labeltoshowhtmlstock .= '</span>';
3424 3424
 
3425 3425
 				if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
@@ -3430,9 +3430,9 @@  discard block
 block discarded – undo
3430 3430
 					$tmpproduct->load_virtual_stock();
3431 3431
 					$virtualstock = $tmpproduct->stock_theorique;
3432 3432
 
3433
-					$labeltoshowstock .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
3433
+					$labeltoshowstock .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
3434 3434
 
3435
-					$labeltoshowhtmlstock .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
3435
+					$labeltoshowhtmlstock .= ' - '.$langs->transnoentities("VirtualStock").':';
3436 3436
 					if ($virtualstock > 0) {
3437 3437
 						$labeltoshowhtmlstock .= '<span class="product_line_stock_ok">';
3438 3438
 					} elseif ($virtualstock <= 0) {
@@ -3453,35 +3453,35 @@  discard block
 block discarded – undo
3453 3453
 		// If we need a particular price level (from 1 to n)
3454 3454
 		if (empty($hidepriceinlabel) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES'))) {
3455 3455
 			$sql = "SELECT price, price_ttc, price_base_type, tva_tx, default_vat_code";
3456
-			$sql .= " FROM " . $this->db->prefix() . "product_price";
3457
-			$sql .= " WHERE fk_product = " . ((int) $objp->rowid);
3458
-			$sql .= " AND entity IN (" . getEntity('productprice') . ")";
3459
-			$sql .= " AND price_level = " . ((int) $price_level);
3456
+			$sql .= " FROM ".$this->db->prefix()."product_price";
3457
+			$sql .= " WHERE fk_product = ".((int) $objp->rowid);
3458
+			$sql .= " AND entity IN (".getEntity('productprice').")";
3459
+			$sql .= " AND price_level = ".((int) $price_level);
3460 3460
 			$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
3461 3461
 			$sql .= " LIMIT 1";
3462 3462
 
3463
-			dol_syslog(get_class($this) . '::constructProductListOption search price for product ' . $objp->rowid . ' AND level ' . $price_level, LOG_DEBUG);
3463
+			dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
3464 3464
 			$result2 = $this->db->query($sql);
3465 3465
 			if ($result2) {
3466 3466
 				$objp2 = $this->db->fetch_object($result2);
3467 3467
 				if ($objp2) {
3468 3468
 					$found = 1;
3469 3469
 					if ($objp2->price_base_type == 'HT') {
3470
-						$labeltoshowprice .= ' - ' . price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3471
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3470
+						$labeltoshowprice .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3471
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3472 3472
 					} else {
3473
-						$labeltoshowprice .= ' - ' . price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3474
-						$labeltoshowhtmlprice .= ' - ' . price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3473
+						$labeltoshowprice .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3474
+						$labeltoshowhtmlprice .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3475 3475
 					}
3476 3476
 					$outprice_ht = price($objp2->price);
3477 3477
 					$outprice_ttc = price($objp2->price_ttc);
3478 3478
 					$outpricebasetype = $objp2->price_base_type;
3479 3479
 					if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) {  // using this option is a bug. kept for backward compatibility
3480
-						$outtva_tx = $objp2->tva_tx;                        // We use the vat rate on line of multiprice
3481
-						$outdefault_vat_code = $objp2->default_vat_code;    // We use the vat code on line of multiprice
3480
+						$outtva_tx = $objp2->tva_tx; // We use the vat rate on line of multiprice
3481
+						$outdefault_vat_code = $objp2->default_vat_code; // We use the vat code on line of multiprice
3482 3482
 					} else {
3483
-						$outtva_tx = $objp->tva_tx;                            // We use the vat rate of product, not the one on line of multiprice
3484
-						$outdefault_vat_code = $objp->default_vat_code;        // We use the vat code or product, not the one on line of multiprice
3483
+						$outtva_tx = $objp->tva_tx; // We use the vat rate of product, not the one on line of multiprice
3484
+						$outdefault_vat_code = $objp->default_vat_code; // We use the vat code or product, not the one on line of multiprice
3485 3485
 					}
3486 3486
 				}
3487 3487
 			} else {
@@ -3495,13 +3495,13 @@  discard block
 block discarded – undo
3495 3495
 			$outqty = $objp->quantity;
3496 3496
 			$outdiscount = $objp->remise_percent;
3497 3497
 			if ($objp->quantity == 1) {
3498
-				$labeltoshowprice .= ' - ' . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/";
3499
-				$labeltoshowhtmlprice .= ' - ' . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/";
3498
+				$labeltoshowprice .= ' - '.price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/";
3499
+				$labeltoshowhtmlprice .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/";
3500 3500
 				$labeltoshowprice .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3501 3501
 				$labeltoshowhtmlprice .= $langs->transnoentities("Unit");
3502 3502
 			} else {
3503
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3504
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3503
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3504
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3505 3505
 				$labeltoshowprice .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3506 3506
 				$labeltoshowhtmlprice .= $langs->transnoentities("Units");
3507 3507
 			}
@@ -3509,16 +3509,16 @@  discard block
 block discarded – undo
3509 3509
 			$outprice_ht = price($objp->unitprice);
3510 3510
 			$outprice_ttc = price($objp->unitprice * (1 + ($objp->tva_tx / 100)));
3511 3511
 			$outpricebasetype = $objp->price_base_type;
3512
-			$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
3513
-			$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
3512
+			$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
3513
+			$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
3514 3514
 		}
3515 3515
 		if (empty($hidepriceinlabel) && !empty($objp->quantity) && $objp->quantity >= 1) {
3516
-			$labeltoshowprice .= " (" . price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->trans("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3517
-			$labeltoshowhtmlprice .= " (" . price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency) . "/" . $langs->transnoentities("Unit") . ")"; // Do not use strtolower because it breaks utf8 encoding
3516
+			$labeltoshowprice .= " (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3517
+			$labeltoshowhtmlprice .= " (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding
3518 3518
 		}
3519 3519
 		if (empty($hidepriceinlabel) && !empty($objp->remise_percent) && $objp->remise_percent >= 1) {
3520
-			$labeltoshowprice .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3521
-			$labeltoshowhtmlprice .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3520
+			$labeltoshowprice .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3521
+			$labeltoshowhtmlprice .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3522 3522
 		}
3523 3523
 
3524 3524
 		// Price by customer
@@ -3527,11 +3527,11 @@  discard block
 block discarded – undo
3527 3527
 				$found = 1;
3528 3528
 
3529 3529
 				if ($objp->custprice_base_type == 'HT') {
3530
-					$labeltoshowprice .= ' - ' . price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3531
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3530
+					$labeltoshowprice .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3531
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3532 3532
 				} else {
3533
-					$labeltoshowprice .= ' - ' . price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3534
-					$labeltoshowhtmlprice .= ' - ' . price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3533
+					$labeltoshowprice .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3534
+					$labeltoshowhtmlprice .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3535 3535
 				}
3536 3536
 
3537 3537
 				$outprice_ht = price($objp->custprice);
@@ -3545,11 +3545,11 @@  discard block
 block discarded – undo
3545 3545
 		// If level no defined or multiprice not found, we used the default price
3546 3546
 		if (empty($hidepriceinlabel) && !$found) {
3547 3547
 			if ($objp->price_base_type == 'HT') {
3548
-				$labeltoshowprice .= ' - ' . price($objp->price, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("HT");
3549
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("HT");
3548
+				$labeltoshowprice .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT");
3549
+				$labeltoshowhtmlprice .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT");
3550 3550
 			} else {
3551
-				$labeltoshowprice .= ' - ' . price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->trans("TTC");
3552
-				$labeltoshowhtmlprice .= ' - ' . price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency) . ' ' . $langs->transnoentities("TTC");
3551
+				$labeltoshowprice .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC");
3552
+				$labeltoshowhtmlprice .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC");
3553 3553
 			}
3554 3554
 			$outprice_ht = price($objp->price);
3555 3555
 			$outprice_ttc = price($objp->price_ttc);
@@ -3559,14 +3559,14 @@  discard block
 block discarded – undo
3559 3559
 		}
3560 3560
 
3561 3561
 		// Build options
3562
-		$opt = '<option value="' . $objp->rowid . '"';
3562
+		$opt = '<option value="'.$objp->rowid.'"';
3563 3563
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
3564 3564
 		if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) {
3565
-			$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 . '"';
3565
+			$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.'"';
3566 3566
 		}
3567 3567
 		if (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
3568
-			$opt .= ' data-labeltrans="' . $outlabel_translated . '"';
3569
-			$opt .= ' data-desctrans="' . dol_escape_htmltag($outdesc_translated) . '"';
3568
+			$opt .= ' data-labeltrans="'.$outlabel_translated.'"';
3569
+			$opt .= ' data-desctrans="'.dol_escape_htmltag($outdesc_translated).'"';
3570 3570
 		}
3571 3571
 
3572 3572
 		if ($stocktag == 1) {
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
 		$selected_input_value = '';
3662 3662
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) {
3663 3663
 			if ($selected > 0) {
3664
-				require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
3664
+				require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
3665 3665
 				$producttmpselect = new Product($this->db);
3666 3666
 				$producttmpselect->fetch($selected);
3667 3667
 				$selected_input_value = $producttmpselect->ref;
@@ -3669,10 +3669,10 @@  discard block
 block discarded – undo
3669 3669
 			}
3670 3670
 
3671 3671
 			// mode=2 means suppliers products
3672
-			$urloption = ($socid > 0 ? 'socid=' . $socid . '&' : '') . 'htmlname=' . $htmlname . '&outjson=1&price_level=' . $price_level . '&type=' . $filtertype . '&mode=2&status=' . $status . '&finished=' . $finished . '&alsoproductwithnosupplierprice=' . $alsoproductwithnosupplierprice;
3673
-			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3672
+			$urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice;
3673
+			print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, getDolGlobalInt('PRODUIT_USE_SEARCH_TO_SELECT'), 0, $ajaxoptions);
3674 3674
 
3675
-			print($hidelabel ? '' : $langs->trans("RefOrLabel") . ' : ') . '<input type="text" class="'.$morecss.'" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . $placeholder . '"' : '') . '>';
3675
+			print($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').'<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.($placeholder ? ' placeholder="'.$placeholder.'"' : '').'>';
3676 3676
 		} else {
3677 3677
 			print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', $status, 0, 0, $alsoproductwithnosupplierprice, $morecss, 0, $placeholder);
3678 3678
 		}
@@ -3730,25 +3730,25 @@  discard block
 block discarded – undo
3730 3730
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3731 3731
 			$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";
3732 3732
 		}
3733
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
3734
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (" . getEntity('product') . ") )";
3733
+		$sql .= " FROM ".$this->db->prefix()."product as p";
3734
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON ( p.rowid = pfp.fk_product AND pfp.entity IN (".getEntity('product').") )";
3735 3735
 		if ($socid > 0) {
3736
-			$sql .= " AND pfp.fk_soc = " . ((int) $socid);
3736
+			$sql .= " AND pfp.fk_soc = ".((int) $socid);
3737 3737
 		}
3738
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
3738
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
3739 3739
 		// Units
3740 3740
 		if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3741
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "c_units u ON u.rowid = p.fk_unit";
3741
+			$sql .= " LEFT JOIN ".$this->db->prefix()."c_units u ON u.rowid = p.fk_unit";
3742 3742
 		}
3743
-		$sql .= " WHERE p.entity IN (" . getEntity('product') . ")";
3743
+		$sql .= " WHERE p.entity IN (".getEntity('product').")";
3744 3744
 		if ($statut != -1) {
3745
-			$sql .= " AND p.tobuy = " . ((int) $statut);
3745
+			$sql .= " AND p.tobuy = ".((int) $statut);
3746 3746
 		}
3747 3747
 		if (strval($filtertype) != '') {
3748
-			$sql .= " AND p.fk_product_type = " . ((int) $filtertype);
3748
+			$sql .= " AND p.fk_product_type = ".((int) $filtertype);
3749 3749
 		}
3750 3750
 		if (!empty($filtre)) {
3751
-			$sql .= " " . $filtre;
3751
+			$sql .= " ".$filtre;
3752 3752
 		}
3753 3753
 		// Add where from hooks
3754 3754
 		$parameters = array();
@@ -3768,9 +3768,9 @@  discard block
 block discarded – undo
3768 3768
 				if ($i > 0) {
3769 3769
 					$sql .= " AND ";
3770 3770
 				}
3771
-				$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) . "%'";
3771
+				$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)."%'";
3772 3772
 				if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) {
3773
-					$sql .= " OR pfp.desc_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
3773
+					$sql .= " OR pfp.desc_fourn LIKE '".$this->db->escape($prefix.$crit)."%'";
3774 3774
 				}
3775 3775
 				$sql .= ")";
3776 3776
 				$i++;
@@ -3779,8 +3779,8 @@  discard block
 block discarded – undo
3779 3779
 				$sql .= ")";
3780 3780
 			}
3781 3781
 			if (isModEnabled('barcode')) {
3782
-				$sql .= " OR p.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3783
-				$sql .= " OR pfp.barcode LIKE '" . $this->db->escape($prefix . $filterkey) . "%'";
3782
+				$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3783
+				$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
3784 3784
 			}
3785 3785
 			$sql .= ')';
3786 3786
 		}
@@ -3789,20 +3789,20 @@  discard block
 block discarded – undo
3789 3789
 
3790 3790
 		// Build output string
3791 3791
 
3792
-		dol_syslog(get_class($this) . "::select_produits_fournisseurs_list", LOG_DEBUG);
3792
+		dol_syslog(get_class($this)."::select_produits_fournisseurs_list", LOG_DEBUG);
3793 3793
 		$result = $this->db->query($sql);
3794 3794
 		if ($result) {
3795
-			require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3796
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php';
3795
+			require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3796
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
3797 3797
 
3798 3798
 			$num = $this->db->num_rows($result);
3799 3799
 
3800 3800
 			//$out.='<select class="flat" id="select'.$htmlname.'" name="'.$htmlname.'">';	// remove select to have id same with combo and ajax
3801
-			$out .= '<select class="flat ' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '">';
3801
+			$out .= '<select class="flat '.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'">';
3802 3802
 			if (!$selected) {
3803
-				$out .= '<option value="-1" selected>' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3803
+				$out .= '<option value="-1" selected>'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3804 3804
 			} else {
3805
-				$out .= '<option value="-1">' . ($placeholder ? $placeholder : '&nbsp;') . '</option>';
3805
+				$out .= '<option value="-1">'.($placeholder ? $placeholder : '&nbsp;').'</option>';
3806 3806
 			}
3807 3807
 
3808 3808
 			$i = 0;
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
 
3818 3818
 				$outkey = $objp->idprodfournprice; // id in table of price
3819 3819
 				if (!$outkey && $alsoproductwithnosupplierprice) {
3820
-					$outkey = 'idprod_' . $objp->rowid; // id of product
3820
+					$outkey = 'idprod_'.$objp->rowid; // id of product
3821 3821
 				}
3822 3822
 
3823 3823
 				$outref = $objp->ref;
@@ -3832,23 +3832,23 @@  discard block
 block discarded – undo
3832 3832
 				$outvalUnits = '';
3833 3833
 				if (getDolGlobalInt('PRODUCT_USE_UNITS')) {
3834 3834
 					if (!empty($objp->unit_short)) {
3835
-						$outvalUnits .= ' - ' . $objp->unit_short;
3835
+						$outvalUnits .= ' - '.$objp->unit_short;
3836 3836
 					}
3837 3837
 					if (!empty($objp->weight) && $objp->weight_units !== null) {
3838 3838
 						$unitToShow = showDimensionInBestUnit($objp->weight, $objp->weight_units, 'weight', $langs);
3839
-						$outvalUnits .= ' - ' . $unitToShow;
3839
+						$outvalUnits .= ' - '.$unitToShow;
3840 3840
 					}
3841 3841
 					if ((!empty($objp->length) || !empty($objp->width) || !empty($objp->height)) && $objp->length_units !== null) {
3842
-						$unitToShow = $objp->length . ' x ' . $objp->width . ' x ' . $objp->height . ' ' . measuringUnitString(0, 'size', $objp->length_units);
3843
-						$outvalUnits .= ' - ' . $unitToShow;
3842
+						$unitToShow = $objp->length.' x '.$objp->width.' x '.$objp->height.' '.measuringUnitString(0, 'size', $objp->length_units);
3843
+						$outvalUnits .= ' - '.$unitToShow;
3844 3844
 					}
3845 3845
 					if (!empty($objp->surface) && $objp->surface_units !== null) {
3846 3846
 						$unitToShow = showDimensionInBestUnit($objp->surface, $objp->surface_units, 'surface', $langs);
3847
-						$outvalUnits .= ' - ' . $unitToShow;
3847
+						$outvalUnits .= ' - '.$unitToShow;
3848 3848
 					}
3849 3849
 					if (!empty($objp->volume) && $objp->volume_units !== null) {
3850 3850
 						$unitToShow = showDimensionInBestUnit($objp->volume, $objp->volume_units, 'volume', $langs);
3851
-						$outvalUnits .= ' - ' . $unitToShow;
3851
+						$outvalUnits .= ' - '.$unitToShow;
3852 3852
 					}
3853 3853
 					if ($outdurationvalue && $outdurationunit) {
3854 3854
 						$da = array(
@@ -3859,22 +3859,22 @@  discard block
 block discarded – undo
3859 3859
 							'y' => $langs->trans('Year')
3860 3860
 						);
3861 3861
 						if (isset($da[$outdurationunit])) {
3862
-							$outvalUnits .= ' - ' . $outdurationvalue . ' ' . $langs->transnoentities($da[$outdurationunit] . ($outdurationvalue > 1 ? 's' : ''));
3862
+							$outvalUnits .= ' - '.$outdurationvalue.' '.$langs->transnoentities($da[$outdurationunit].($outdurationvalue > 1 ? 's' : ''));
3863 3863
 						}
3864 3864
 					}
3865 3865
 				}
3866 3866
 
3867 3867
 				$objRef = $objp->ref;
3868 3868
 				if ($filterkey && $filterkey != '') {
3869
-					$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
3869
+					$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
3870 3870
 				}
3871 3871
 				$objRefFourn = $objp->ref_fourn;
3872 3872
 				if ($filterkey && $filterkey != '') {
3873
-					$objRefFourn = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRefFourn, 1);
3873
+					$objRefFourn = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRefFourn, 1);
3874 3874
 				}
3875 3875
 				$label = $objp->label;
3876 3876
 				if ($filterkey && $filterkey != '') {
3877
-					$label = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $label, 1);
3877
+					$label = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $label, 1);
3878 3878
 				}
3879 3879
 
3880 3880
 				switch ($objp->fk_product_type) {
@@ -3897,21 +3897,21 @@  discard block
 block discarded – undo
3897 3897
 
3898 3898
 				$optlabel .= $objp->ref;
3899 3899
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3900
-					$optlabel .= ' <span class="opacitymedium">(' . $objp->ref_fourn . ')</span>';
3900
+					$optlabel .= ' <span class="opacitymedium">('.$objp->ref_fourn.')</span>';
3901 3901
 				}
3902 3902
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3903
-					$optlabel .= ' (' . $outbarcode . ')';
3903
+					$optlabel .= ' ('.$outbarcode.')';
3904 3904
 				}
3905
-				$optlabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3905
+				$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3906 3906
 
3907 3907
 				$outvallabel = $objRef;
3908 3908
 				if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
3909
-					$outvallabel .= ' (' . $objRefFourn . ')';
3909
+					$outvallabel .= ' ('.$objRefFourn.')';
3910 3910
 				}
3911 3911
 				if (isModEnabled('barcode') && !empty($objp->barcode)) {
3912
-					$outvallabel .= ' (' . $outbarcode . ')';
3912
+					$outvallabel .= ' ('.$outbarcode.')';
3913 3913
 				}
3914
-				$outvallabel .= ' - ' . dol_trunc($label, $maxlengtharticle);
3914
+				$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
3915 3915
 
3916 3916
 				// Units
3917 3917
 				$optlabel .= $outvalUnits;
@@ -3928,7 +3928,7 @@  discard block
 block discarded – undo
3928 3928
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
3929 3929
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
3930 3930
 
3931
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
3931
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
3932 3932
 						$priceparser = new PriceParser($this->db);
3933 3933
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
3934 3934
 						if ($price_result >= 0) {
@@ -3939,57 +3939,57 @@  discard block
 block discarded – undo
3939 3939
 						}
3940 3940
 					}
3941 3941
 					if ($objp->quantity == 1) {
3942
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
3943
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/";
3942
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
3943
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/";
3944 3944
 						$optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding
3945 3945
 						$outvallabel .= $langs->transnoentities("Unit");
3946 3946
 					} else {
3947
-						$optlabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3948
-						$outvallabel .= ' - ' . price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency) . "/" . $objp->quantity;
3949
-						$optlabel .= ' ' . $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3950
-						$outvallabel .= ' ' . $langs->transnoentities("Units");
3947
+						$optlabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3948
+						$outvallabel .= ' - '.price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity;
3949
+						$optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
3950
+						$outvallabel .= ' '.$langs->transnoentities("Units");
3951 3951
 					}
3952 3952
 
3953 3953
 					if ($objp->quantity > 1) {
3954
-						$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
3955
-						$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
3954
+						$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
3955
+						$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
3956 3956
 					}
3957 3957
 					if ($objp->remise_percent >= 1) {
3958
-						$optlabel .= " - " . $langs->trans("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3959
-						$outvallabel .= " - " . $langs->transnoentities("Discount") . " : " . vatrate($objp->remise_percent) . ' %';
3958
+						$optlabel .= " - ".$langs->trans("Discount")." : ".vatrate($objp->remise_percent).' %';
3959
+						$outvallabel .= " - ".$langs->transnoentities("Discount")." : ".vatrate($objp->remise_percent).' %';
3960 3960
 					}
3961 3961
 					if ($objp->duration) {
3962
-						$optlabel .= " - " . $objp->duration;
3963
-						$outvallabel .= " - " . $objp->duration;
3962
+						$optlabel .= " - ".$objp->duration;
3963
+						$outvallabel .= " - ".$objp->duration;
3964 3964
 					}
3965 3965
 					if (!$socid) {
3966
-						$optlabel .= " - " . dol_trunc($objp->name, 8);
3967
-						$outvallabel .= " - " . dol_trunc($objp->name, 8);
3966
+						$optlabel .= " - ".dol_trunc($objp->name, 8);
3967
+						$outvallabel .= " - ".dol_trunc($objp->name, 8);
3968 3968
 					}
3969 3969
 					if ($objp->supplier_reputation) {
3970 3970
 						//TODO dictionary
3971 3971
 						$reputations = array('' => $langs->trans('Standard'), 'FAVORITE' => $langs->trans('Favorite'), 'NOTTHGOOD' => $langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER' => $langs->trans('DoNotOrderThisProductToThisSupplier'));
3972 3972
 
3973
-						$optlabel .= " - " . $reputations[$objp->supplier_reputation];
3974
-						$outvallabel .= " - " . $reputations[$objp->supplier_reputation];
3973
+						$optlabel .= " - ".$reputations[$objp->supplier_reputation];
3974
+						$outvallabel .= " - ".$reputations[$objp->supplier_reputation];
3975 3975
 					}
3976 3976
 				} else {
3977
-					$optlabel .= " - <span class='opacitymedium'>" . $langs->trans("NoPriceDefinedForThisSupplier") . '</span>';
3978
-					$outvallabel .= ' - ' . $langs->transnoentities("NoPriceDefinedForThisSupplier");
3977
+					$optlabel .= " - <span class='opacitymedium'>".$langs->trans("NoPriceDefinedForThisSupplier").'</span>';
3978
+					$outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier");
3979 3979
 				}
3980 3980
 
3981 3981
 				if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) {
3982 3982
 					$novirtualstock = ($showstockinlist == 2);
3983 3983
 
3984 3984
 					if ($user->hasRight('stock', 'lire')) {
3985
-						$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3985
+						$outvallabel .= ' - '.$langs->trans("Stock").': '.price(price2num($objp->stock, 'MS'), 0, $langs, 0, 0);
3986 3986
 
3987 3987
 						if ($objp->stock > 0) {
3988 3988
 							$optlabel .= ' - <span class="product_line_stock_ok">';
3989 3989
 						} elseif ($objp->stock <= 0) {
3990 3990
 							$optlabel .= ' - <span class="product_line_stock_too_low">';
3991 3991
 						}
3992
-						$optlabel .= $langs->transnoentities("Stock") . ':' . price(price2num($objp->stock, 'MS'));
3992
+						$optlabel .= $langs->transnoentities("Stock").':'.price(price2num($objp->stock, 'MS'));
3993 3993
 						$optlabel .= '</span>';
3994 3994
 						if (empty($novirtualstock) && getDolGlobalString('STOCK_SHOW_VIRTUAL_STOCK_IN_PRODUCTS_COMBO')) {  // Warning, this option may slow down combo list generation
3995 3995
 							$langs->load("stocks");
@@ -3999,9 +3999,9 @@  discard block
 block discarded – undo
3999 3999
 							$tmpproduct->load_virtual_stock();
4000 4000
 							$virtualstock = $tmpproduct->stock_theorique;
4001 4001
 
4002
-							$outvallabel .= ' - ' . $langs->trans("VirtualStock") . ':' . $virtualstock;
4002
+							$outvallabel .= ' - '.$langs->trans("VirtualStock").':'.$virtualstock;
4003 4003
 
4004
-							$optlabel .= ' - ' . $langs->transnoentities("VirtualStock") . ':';
4004
+							$optlabel .= ' - '.$langs->transnoentities("VirtualStock").':';
4005 4005
 							if ($virtualstock > 0) {
4006 4006
 								$optlabel .= '<span class="product_line_stock_ok">';
4007 4007
 							} elseif ($virtualstock <= 0) {
@@ -4015,7 +4015,7 @@  discard block
 block discarded – undo
4015 4015
 					}
4016 4016
 				}
4017 4017
 
4018
-				$optstart = '<option value="' . $outkey . '"';
4018
+				$optstart = '<option value="'.$outkey.'"';
4019 4019
 				if ($selected && $selected == $objp->idprodfournprice) {
4020 4020
 					$optstart .= ' selected';
4021 4021
 				}
@@ -4024,31 +4024,31 @@  discard block
 block discarded – undo
4024 4024
 				}
4025 4025
 
4026 4026
 				if (!empty($objp->idprodfournprice) && $objp->idprodfournprice > 0) {
4027
-					$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
4028
-					$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
4029
-					$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
4030
-					$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
4031
-					$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
4032
-					$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
4033
-					$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
4034
-					$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
4035
-					$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
4036
-					$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
4027
+					$optstart .= ' data-product-id="'.dol_escape_htmltag($objp->rowid).'"';
4028
+					$optstart .= ' data-price-id="'.dol_escape_htmltag($objp->idprodfournprice).'"';
4029
+					$optstart .= ' data-qty="'.dol_escape_htmltag($objp->quantity).'"';
4030
+					$optstart .= ' data-up="'.dol_escape_htmltag(price2num($objp->unitprice)).'"';
4031
+					$optstart .= ' data-up-locale="'.dol_escape_htmltag(price($objp->unitprice)).'"';
4032
+					$optstart .= ' data-discount="'.dol_escape_htmltag($outdiscount).'"';
4033
+					$optstart .= ' data-tvatx="'.dol_escape_htmltag(price2num($objp->tva_tx)).'"';
4034
+					$optstart .= ' data-tvatx-formated="'.dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)).'"';
4035
+					$optstart .= ' data-default-vat-code="'.dol_escape_htmltag($objp->default_vat_code).'"';
4036
+					$optstart .= ' data-supplier-ref="'.dol_escape_htmltag($objp->ref_fourn).'"';
4037 4037
 					if (isModEnabled('multicurrency')) {
4038
-						$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
4039
-						$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
4038
+						$optstart .= ' data-multicurrency-code="'.dol_escape_htmltag($objp->multicurrency_code).'"';
4039
+						$optstart .= ' data-multicurrency-unitprice="'.dol_escape_htmltag($objp->multicurrency_unitprice).'"';
4040 4040
 					}
4041 4041
 				}
4042
-				$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
4042
+				$optstart .= ' data-description="'.dol_escape_htmltag($objp->description, 0, 1).'"';
4043 4043
 
4044 4044
 				$outarrayentry = array(
4045 4045
 					'key' => $outkey,
4046 4046
 					'value' => $outref,
4047 4047
 					'label' => $outvallabel,
4048 4048
 					'qty' => $outqty,
4049
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),    // Keep higher resolution for price for the min qty
4050
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4051
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4049
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4050
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4051
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4052 4052
 					'tva_tx_formated' => price($objp->tva_tx, 0, $langs, 1, -1, 2),
4053 4053
 					'tva_tx' => price2num($objp->tva_tx),
4054 4054
 					'default_vat_code' => $objp->default_vat_code,
@@ -4079,17 +4079,17 @@  discard block
 block discarded – undo
4079 4079
 				// Add new entry
4080 4080
 				// "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
4081 4081
 				// "label" value of json key array is used by jQuery automatically as text for combo box
4082
-				$out .= $optstart . ' data-html="' . dol_escape_htmltag($optlabel) . '">' . $optlabel . "</option>\n";
4082
+				$out .= $optstart.' data-html="'.dol_escape_htmltag($optlabel).'">'.$optlabel."</option>\n";
4083 4083
 				$outarraypush = array(
4084 4084
 					'key' => $outkey,
4085 4085
 					'value' => $outref,
4086 4086
 					'label' => $outvallabel,
4087 4087
 					'qty' => $outqty,
4088
-					'price_qty_ht' => price2num($objp->fprice, 'MU'),        // Keep higher resolution for price for the min qty
4088
+					'price_qty_ht' => price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty
4089 4089
 					'price_qty_ht_locale' => price($objp->fprice),
4090
-					'price_unit_ht' => price2num($objp->unitprice, 'MU'),    // This is used to fill the Unit Price
4090
+					'price_unit_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price
4091 4091
 					'price_unit_ht_locale' => price($objp->unitprice),
4092
-					'price_ht' => price2num($objp->unitprice, 'MU'),        // This is used to fill the Unit Price (for compatibility)
4092
+					'price_ht' => price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility)
4093 4093
 					'tva_tx_formated' => price($objp->tva_tx),
4094 4094
 					'tva_tx' => price2num($objp->tva_tx),
4095 4095
 					'default_vat_code' => $objp->default_vat_code,
@@ -4122,7 +4122,7 @@  discard block
 block discarded – undo
4122 4122
 
4123 4123
 			$this->db->free($result);
4124 4124
 
4125
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
4125
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
4126 4126
 			$out .= ajax_combobox($htmlname);
4127 4127
 		} else {
4128 4128
 			dol_print_error($this->db);
@@ -4154,43 +4154,43 @@  discard block
 block discarded – undo
4154 4154
 		$sql = "SELECT p.rowid, p.ref, p.label, p.price, p.duration, pfp.fk_soc,";
4155 4155
 		$sql .= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,";
4156 4156
 		$sql .= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name";
4157
-		$sql .= " FROM " . $this->db->prefix() . "product as p";
4158
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4159
-		$sql .= " LEFT JOIN " . $this->db->prefix() . "societe as s ON pfp.fk_soc = s.rowid";
4160
-		$sql .= " WHERE pfp.entity IN (" . getEntity('productsupplierprice') . ")";
4157
+		$sql .= " FROM ".$this->db->prefix()."product as p";
4158
+		$sql .= " LEFT JOIN ".$this->db->prefix()."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
4159
+		$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON pfp.fk_soc = s.rowid";
4160
+		$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
4161 4161
 		$sql .= " AND p.tobuy = 1";
4162 4162
 		$sql .= " AND s.fournisseur = 1";
4163
-		$sql .= " AND p.rowid = " . ((int) $productid);
4163
+		$sql .= " AND p.rowid = ".((int) $productid);
4164 4164
 		if (!getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED')) {
4165 4165
 			$sql .= " ORDER BY s.nom, pfp.ref_fourn DESC";
4166 4166
 		} else {
4167 4167
 			$sql .= " ORDER BY pfp.unitprice ASC";
4168 4168
 		}
4169 4169
 
4170
-		dol_syslog(get_class($this) . "::select_product_fourn_price", LOG_DEBUG);
4170
+		dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG);
4171 4171
 		$result = $this->db->query($sql);
4172 4172
 
4173 4173
 		if ($result) {
4174 4174
 			$num = $this->db->num_rows($result);
4175 4175
 
4176
-			$form = '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4176
+			$form = '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4177 4177
 
4178 4178
 			if (!$num) {
4179
-				$form .= '<option value="0">-- ' . $langs->trans("NoSupplierPriceDefinedForThisProduct") . ' --</option>';
4179
+				$form .= '<option value="0">-- '.$langs->trans("NoSupplierPriceDefinedForThisProduct").' --</option>';
4180 4180
 			} else {
4181
-				require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4181
+				require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4182 4182
 				$form .= '<option value="0">&nbsp;</option>';
4183 4183
 
4184 4184
 				$i = 0;
4185 4185
 				while ($i < $num) {
4186 4186
 					$objp = $this->db->fetch_object($result);
4187 4187
 
4188
-					$opt = '<option value="' . $objp->idprodfournprice . '"';
4188
+					$opt = '<option value="'.$objp->idprodfournprice.'"';
4189 4189
 					//if there is only one supplier, preselect it
4190 4190
 					if ($num == 1 || ($selected_supplier > 0 && $objp->fk_soc == $selected_supplier) || ($i == 0 && getDolGlobalString('PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED'))) {
4191 4191
 						$opt .= ' selected';
4192 4192
 					}
4193
-					$opt .= '>' . $objp->name . ' - ' . $objp->ref_fourn . ' - ';
4193
+					$opt .= '>'.$objp->name.' - '.$objp->ref_fourn.' - ';
4194 4194
 
4195 4195
 					if (isModEnabled('dynamicprices') && !empty($objp->fk_supplier_price_expression)) {
4196 4196
 						$prod_supplier = new ProductFournisseur($this->db);
@@ -4200,7 +4200,7 @@  discard block
 block discarded – undo
4200 4200
 						$prod_supplier->fourn_tva_tx = $objp->tva_tx;
4201 4201
 						$prod_supplier->fk_supplier_price_expression = $objp->fk_supplier_price_expression;
4202 4202
 
4203
-						require_once DOL_DOCUMENT_ROOT . '/product/dynamic_price/class/price_parser.class.php';
4203
+						require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
4204 4204
 						$priceparser = new PriceParser($this->db);
4205 4205
 						$price_result = $priceparser->parseProductSupplier($prod_supplier);
4206 4206
 						if ($price_result >= 0) {
@@ -4211,10 +4211,10 @@  discard block
 block discarded – undo
4211 4211
 						}
4212 4212
 					}
4213 4213
 					if ($objp->quantity == 1) {
4214
-						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency) . "/";
4214
+						$opt .= price($objp->fprice * (getDolGlobalString('DISPLAY_DISCOUNTED_SUPPLIER_PRICE') ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/";
4215 4215
 					}
4216 4216
 
4217
-					$opt .= $objp->quantity . ' ';
4217
+					$opt .= $objp->quantity.' ';
4218 4218
 
4219 4219
 					if ($objp->quantity == 1) {
4220 4220
 						$opt .= $langs->trans("Unit");
@@ -4223,10 +4223,10 @@  discard block
 block discarded – undo
4223 4223
 					}
4224 4224
 					if ($objp->quantity > 1) {
4225 4225
 						$opt .= " - ";
4226
-						$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");
4226
+						$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");
4227 4227
 					}
4228 4228
 					if ($objp->duration) {
4229
-						$opt .= " - " . $objp->duration;
4229
+						$opt .= " - ".$objp->duration;
4230 4230
 					}
4231 4231
 					$opt .= "</option>\n";
4232 4232
 
@@ -4264,8 +4264,8 @@  discard block
 block discarded – undo
4264 4264
 		dol_syslog(__METHOD__, LOG_DEBUG);
4265 4265
 
4266 4266
 		$sql = "SELECT rowid, code, libelle as label, deposit_percent";
4267
-		$sql .= " FROM " . $this->db->prefix() . 'c_payment_term';
4268
-		$sql .= " WHERE entity IN (" . getEntity('c_payment_term') . ")";
4267
+		$sql .= " FROM ".$this->db->prefix().'c_payment_term';
4268
+		$sql .= " WHERE entity IN (".getEntity('c_payment_term').")";
4269 4269
 		$sql .= " AND active > 0";
4270 4270
 		$sql .= " ORDER BY sortorder";
4271 4271
 
@@ -4277,7 +4277,7 @@  discard block
 block discarded – undo
4277 4277
 				$obj = $this->db->fetch_object($resql);
4278 4278
 
4279 4279
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4280
-				$label = ($langs->trans("PaymentConditionShort" . $obj->code) != "PaymentConditionShort" . $obj->code ? $langs->trans("PaymentConditionShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4280
+				$label = ($langs->trans("PaymentConditionShort".$obj->code) != "PaymentConditionShort".$obj->code ? $langs->trans("PaymentConditionShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4281 4281
 				$this->cache_conditions_paiements[$obj->rowid]['code'] = $obj->code;
4282 4282
 				$this->cache_conditions_paiements[$obj->rowid]['label'] = $label;
4283 4283
 				$this->cache_conditions_paiements[$obj->rowid]['deposit_percent'] = $obj->deposit_percent;
@@ -4305,7 +4305,7 @@  discard block
 block discarded – undo
4305 4305
 		// phpcs:enable
4306 4306
 		global $langs;
4307 4307
 
4308
-		$num = count($this->cache_availability);    // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4308
+		$num = count($this->cache_availability); // TODO Use $conf->cache['availability'] instead of $this->cache_availability
4309 4309
 		if ($num > 0) {
4310 4310
 			return 0; // Cache already loaded
4311 4311
 		}
@@ -4315,7 +4315,7 @@  discard block
 block discarded – undo
4315 4315
 		$langs->load('propal');
4316 4316
 
4317 4317
 		$sql = "SELECT rowid, code, label, position";
4318
-		$sql .= " FROM " . $this->db->prefix() . 'c_availability';
4318
+		$sql .= " FROM ".$this->db->prefix().'c_availability';
4319 4319
 		$sql .= " WHERE active > 0";
4320 4320
 
4321 4321
 		$resql = $this->db->query($sql);
@@ -4326,7 +4326,7 @@  discard block
 block discarded – undo
4326 4326
 				$obj = $this->db->fetch_object($resql);
4327 4327
 
4328 4328
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4329
-				$label = ($langs->trans("AvailabilityType" . $obj->code) != "AvailabilityType" . $obj->code ? $langs->trans("AvailabilityType" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4329
+				$label = ($langs->trans("AvailabilityType".$obj->code) != "AvailabilityType".$obj->code ? $langs->trans("AvailabilityType".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4330 4330
 				$this->cache_availability[$obj->rowid]['code'] = $obj->code;
4331 4331
 				$this->cache_availability[$obj->rowid]['label'] = $label;
4332 4332
 				$this->cache_availability[$obj->rowid]['position'] = $obj->position;
@@ -4358,17 +4358,17 @@  discard block
 block discarded – undo
4358 4358
 
4359 4359
 		$this->load_cache_availability();
4360 4360
 
4361
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4361
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4362 4362
 
4363
-		print '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4363
+		print '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4364 4364
 		if ($addempty) {
4365 4365
 			print '<option value="0">&nbsp;</option>';
4366 4366
 		}
4367 4367
 		foreach ($this->cache_availability as $id => $arrayavailability) {
4368 4368
 			if ($selected == $id) {
4369
-				print '<option value="' . $id . '" selected>';
4369
+				print '<option value="'.$id.'" selected>';
4370 4370
 			} else {
4371
-				print '<option value="' . $id . '">';
4371
+				print '<option value="'.$id.'">';
4372 4372
 			}
4373 4373
 			print dol_escape_htmltag($arrayavailability['label']);
4374 4374
 			print '</option>';
@@ -4389,13 +4389,13 @@  discard block
 block discarded – undo
4389 4389
 	{
4390 4390
 		global $langs;
4391 4391
 
4392
-		$num = count($this->cache_demand_reason);    // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4392
+		$num = count($this->cache_demand_reason); // TODO Use $conf->cache['input_reason'] instead of $this->cache_demand_reason
4393 4393
 		if ($num > 0) {
4394 4394
 			return 0; // Cache already loaded
4395 4395
 		}
4396 4396
 
4397 4397
 		$sql = "SELECT rowid, code, label";
4398
-		$sql .= " FROM " . $this->db->prefix() . 'c_input_reason';
4398
+		$sql .= " FROM ".$this->db->prefix().'c_input_reason';
4399 4399
 		$sql .= " WHERE active > 0";
4400 4400
 
4401 4401
 		$resql = $this->db->query($sql);
@@ -4408,8 +4408,8 @@  discard block
 block discarded – undo
4408 4408
 
4409 4409
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4410 4410
 				$label = ($obj->label != '-' ? $obj->label : '');
4411
-				if ($langs->trans("DemandReasonType" . $obj->code) != "DemandReasonType" . $obj->code) {
4412
-					$label = $langs->trans("DemandReasonType" . $obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4411
+				if ($langs->trans("DemandReasonType".$obj->code) != "DemandReasonType".$obj->code) {
4412
+					$label = $langs->trans("DemandReasonType".$obj->code); // So translation key DemandReasonTypeSRC_XXX will work
4413 4413
 				}
4414 4414
 				if ($langs->trans($obj->code) != $obj->code) {
4415 4415
 					$label = $langs->trans($obj->code); // So translation key SRC_XXX will work
@@ -4449,9 +4449,9 @@  discard block
 block discarded – undo
4449 4449
 
4450 4450
 		$this->loadCacheInputReason();
4451 4451
 
4452
-		print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4452
+		print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4453 4453
 		if ($addempty) {
4454
-			print '<option value="0"' . (empty($selected) ? ' selected' : '') . '>&nbsp;</option>';
4454
+			print '<option value="0"'.(empty($selected) ? ' selected' : '').'>&nbsp;</option>';
4455 4455
 		}
4456 4456
 		foreach ($this->cache_demand_reason as $id => $arraydemandreason) {
4457 4457
 			if ($arraydemandreason['code'] == $exclude) {
@@ -4459,9 +4459,9 @@  discard block
 block discarded – undo
4459 4459
 			}
4460 4460
 
4461 4461
 			if ($selected && ($selected == $arraydemandreason['id'] || $selected == $arraydemandreason['code'])) {
4462
-				print '<option value="' . $arraydemandreason['id'] . '" selected>';
4462
+				print '<option value="'.$arraydemandreason['id'].'" selected>';
4463 4463
 			} else {
4464
-				print '<option value="' . $arraydemandreason['id'] . '">';
4464
+				print '<option value="'.$arraydemandreason['id'].'">';
4465 4465
 			}
4466 4466
 			$label = $arraydemandreason['label']; // Translation of label was already done into the ->loadCacheInputReason
4467 4467
 			print $langs->trans($label);
@@ -4471,7 +4471,7 @@  discard block
 block discarded – undo
4471 4471
 		if ($user->admin && empty($notooltip)) {
4472 4472
 			print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4473 4473
 		}
4474
-		print ajax_combobox('select_' . $htmlname);
4474
+		print ajax_combobox('select_'.$htmlname);
4475 4475
 	}
4476 4476
 
4477 4477
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -4486,7 +4486,7 @@  discard block
 block discarded – undo
4486 4486
 		// phpcs:enable
4487 4487
 		global $langs;
4488 4488
 
4489
-		$num = count($this->cache_types_paiements);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4489
+		$num = count($this->cache_types_paiements); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_types_paiements
4490 4490
 		if ($num > 0) {
4491 4491
 			return $num; // Cache already loaded
4492 4492
 		}
@@ -4496,8 +4496,8 @@  discard block
 block discarded – undo
4496 4496
 		$this->cache_types_paiements = array();
4497 4497
 
4498 4498
 		$sql = "SELECT id, code, libelle as label, type, active";
4499
-		$sql .= " FROM " . $this->db->prefix() . "c_paiement";
4500
-		$sql .= " WHERE entity IN (" . getEntity('c_paiement') . ")";
4499
+		$sql .= " FROM ".$this->db->prefix()."c_paiement";
4500
+		$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
4501 4501
 
4502 4502
 		$resql = $this->db->query($sql);
4503 4503
 		if ($resql) {
@@ -4507,7 +4507,7 @@  discard block
 block discarded – undo
4507 4507
 				$obj = $this->db->fetch_object($resql);
4508 4508
 
4509 4509
 				// Si traduction existe, on l'utilise, sinon on prend le libelle par default
4510
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4510
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4511 4511
 				$this->cache_types_paiements[$obj->id]['id'] = $obj->id;
4512 4512
 				$this->cache_types_paiements[$obj->id]['code'] = $obj->code;
4513 4513
 				$this->cache_types_paiements[$obj->id]['label'] = $label;
@@ -4579,17 +4579,17 @@  discard block
 block discarded – undo
4579 4579
 		global $langs, $user, $conf;
4580 4580
 
4581 4581
 		$out = '';
4582
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
4582
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
4583 4583
 
4584 4584
 		$this->load_cache_conditions_paiements();
4585 4585
 
4586 4586
 		// Set default value if not already set by caller
4587 4587
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID')) {
4588
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4588
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TERM_ID", LOG_NOTICE);
4589 4589
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TERM_ID');
4590 4590
 		}
4591 4591
 
4592
-		$out .= '<select id="' . $htmlname . '" class="flat selectpaymentterms' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4592
+		$out .= '<select id="'.$htmlname.'" class="flat selectpaymentterms'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4593 4593
 		if ($addempty) {
4594 4594
 			$out .= '<option value="0">&nbsp;</option>';
4595 4595
 		}
@@ -4603,9 +4603,9 @@  discard block
 block discarded – undo
4603 4603
 
4604 4604
 			if ($selected == $id) {
4605 4605
 				$selectedDepositPercent = $deposit_percent > 0 ? $deposit_percent : $arrayconditions['deposit_percent'];
4606
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '" selected>';
4606
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'" selected>';
4607 4607
 			} else {
4608
-				$out .= '<option value="' . $id . '" data-deposit_percent="' . $arrayconditions['deposit_percent'] . '">';
4608
+				$out .= '<option value="'.$id.'" data-deposit_percent="'.$arrayconditions['deposit_percent'].'">';
4609 4609
 			}
4610 4610
 			$label = $arrayconditions['label'];
4611 4611
 
@@ -4623,21 +4623,21 @@  discard block
 block discarded – undo
4623 4623
 		$out .= ajax_combobox($htmlname);
4624 4624
 
4625 4625
 		if ($deposit_percent >= 0) {
4626
-			$out .= ' <span id="' . $htmlname . '_deposit_percent_container"' . (empty($selectedDepositPercent) ? ' style="display: none"' : '') . '>';
4627
-			$out .= $langs->trans('DepositPercent') . ' : ';
4628
-			$out .= '<input id="' . $htmlname . '_deposit_percent" name="' . $htmlname . '_deposit_percent" class="maxwidth50" value="' . $deposit_percent . '" />';
4626
+			$out .= ' <span id="'.$htmlname.'_deposit_percent_container"'.(empty($selectedDepositPercent) ? ' style="display: none"' : '').'>';
4627
+			$out .= $langs->trans('DepositPercent').' : ';
4628
+			$out .= '<input id="'.$htmlname.'_deposit_percent" name="'.$htmlname.'_deposit_percent" class="maxwidth50" value="'.$deposit_percent.'" />';
4629 4629
 			$out .= '</span>';
4630 4630
 			$out .= '
4631
-				<script nonce="' . getNonce() . '">
4631
+				<script nonce="' . getNonce().'">
4632 4632
 					$(document).ready(function () {
4633
-						$("#' . $htmlname . '").change(function () {
4633
+						$("#' . $htmlname.'").change(function () {
4634 4634
 							let $selected = $(this).find("option:selected");
4635 4635
 							let depositPercent = $selected.attr("data-deposit_percent");
4636 4636
 
4637 4637
 							if (depositPercent.length > 0) {
4638
-								$("#' . $htmlname . '_deposit_percent_container").show().find("#' . $htmlname . '_deposit_percent").val(depositPercent);
4638
+								$("#' . $htmlname.'_deposit_percent_container").show().find("#'.$htmlname.'_deposit_percent").val(depositPercent);
4639 4639
 							} else {
4640
-								$("#' . $htmlname . '_deposit_percent_container").hide();
4640
+								$("#' . $htmlname.'_deposit_percent_container").hide();
4641 4641
 							}
4642 4642
 
4643 4643
 							return true;
@@ -4675,7 +4675,7 @@  discard block
 block discarded – undo
4675 4675
 
4676 4676
 		$out = '';
4677 4677
 
4678
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $filtertype . ", " . $format, LOG_DEBUG);
4678
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG);
4679 4679
 
4680 4680
 		$filterarray = array();
4681 4681
 		if ($filtertype == 'CRDT') {
@@ -4690,11 +4690,11 @@  discard block
 block discarded – undo
4690 4690
 
4691 4691
 		// Set default value if not already set by caller
4692 4692
 		if (empty($selected) && getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID')) {
4693
-			dol_syslog(__METHOD__ . "Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4693
+			dol_syslog(__METHOD__."Using deprecated option MAIN_DEFAULT_PAYMENT_TYPE_ID", LOG_NOTICE);
4694 4694
 			$selected = getDolGlobalString('MAIN_DEFAULT_PAYMENT_TYPE_ID');
4695 4695
 		}
4696 4696
 
4697
-		$out .= '<select id="select' . $htmlname . '" class="flat selectpaymenttypes' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4697
+		$out .= '<select id="select'.$htmlname.'" class="flat selectpaymenttypes'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4698 4698
 		if ($empty) {
4699 4699
 			$out .= '<option value="">&nbsp;</option>';
4700 4700
 		}
@@ -4715,13 +4715,13 @@  discard block
 block discarded – undo
4715 4715
 			}
4716 4716
 
4717 4717
 			if ($format == 0) {
4718
-				$out .= '<option value="' . $id . '"';
4718
+				$out .= '<option value="'.$id.'"';
4719 4719
 			} elseif ($format == 1) {
4720
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4720
+				$out .= '<option value="'.$arraytypes['code'].'"';
4721 4721
 			} elseif ($format == 2) {
4722
-				$out .= '<option value="' . $arraytypes['code'] . '"';
4722
+				$out .= '<option value="'.$arraytypes['code'].'"';
4723 4723
 			} elseif ($format == 3) {
4724
-				$out .= '<option value="' . $id . '"';
4724
+				$out .= '<option value="'.$id.'"';
4725 4725
 			}
4726 4726
 			// Print attribute selected or not
4727 4727
 			if ($format == 1 || $format == 2) {
@@ -4751,7 +4751,7 @@  discard block
 block discarded – undo
4751 4751
 		if ($user->admin && !$noadmininfo) {
4752 4752
 			$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
4753 4753
 		}
4754
-		$out .= ajax_combobox('select' . $htmlname);
4754
+		$out .= ajax_combobox('select'.$htmlname);
4755 4755
 
4756 4756
 		if (empty($nooutput)) {
4757 4757
 			print $out;
@@ -4774,19 +4774,19 @@  discard block
 block discarded – undo
4774 4774
 	 */
4775 4775
 	public function selectTypesIban($selected = '', $htmlname = 'ribList', $empty = 0, $morecss = '', $nooutput = 0, $ribForSelection = [])
4776 4776
 	{
4777
-		$out = '<select id="select' . $htmlname . '" class="flat selectrib' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4777
+		$out = '<select id="select'.$htmlname.'" class="flat selectrib'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4778 4778
 		if ($empty) {
4779 4779
 			$out .= '<option value="">&nbsp;</option>';
4780 4780
 		}
4781 4781
 
4782 4782
 		foreach ($ribForSelection as $rib) {
4783 4783
 			$selectedAttribute = $selected == $rib ? 'selected' : '';
4784
-			$out .= '<option value="' . $rib . '" '.$selectedAttribute.'>';
4784
+			$out .= '<option value="'.$rib.'" '.$selectedAttribute.'>';
4785 4785
 			$out .= $rib;
4786 4786
 			$out .= '</option>';
4787 4787
 		}
4788 4788
 		$out .= '</select>';
4789
-		$out .= ajax_combobox('select' . $htmlname);
4789
+		$out .= ajax_combobox('select'.$htmlname);
4790 4790
 
4791 4791
 		if (empty($nooutput)) {
4792 4792
 			print $out;
@@ -4808,22 +4808,22 @@  discard block
 block discarded – undo
4808 4808
 	{
4809 4809
 		global $langs;
4810 4810
 
4811
-		$return = '<select class="flat maxwidth100" id="select_' . $htmlname . '" name="' . $htmlname . '">';
4811
+		$return = '<select class="flat maxwidth100" id="select_'.$htmlname.'" name="'.$htmlname.'">';
4812 4812
 		$options = array(
4813 4813
 			'HT' => $langs->trans("HT"),
4814 4814
 			'TTC' => $langs->trans("TTC")
4815 4815
 		);
4816 4816
 		foreach ($options as $id => $value) {
4817 4817
 			if ($selected == $id) {
4818
-				$return .= '<option value="' . $id . '" selected>' . $value;
4818
+				$return .= '<option value="'.$id.'" selected>'.$value;
4819 4819
 			} else {
4820
-				$return .= '<option value="' . $id . '">' . $value;
4820
+				$return .= '<option value="'.$id.'">'.$value;
4821 4821
 			}
4822 4822
 			$return .= '</option>';
4823 4823
 		}
4824 4824
 		$return .= '</select>';
4825 4825
 		if ($addjscombo) {
4826
-			$return .= ajax_combobox('select_' . $htmlname);
4826
+			$return .= ajax_combobox('select_'.$htmlname);
4827 4827
 		}
4828 4828
 
4829 4829
 		return $return;
@@ -4841,7 +4841,7 @@  discard block
 block discarded – undo
4841 4841
 		// phpcs:enable
4842 4842
 		global $langs;
4843 4843
 
4844
-		$num = count($this->cache_transport_mode);        // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4844
+		$num = count($this->cache_transport_mode); // TODO Use $conf->cache['payment_mode'] instead of $this->cache_transport_mode
4845 4845
 		if ($num > 0) {
4846 4846
 			return $num; // Cache already loaded
4847 4847
 		}
@@ -4851,8 +4851,8 @@  discard block
 block discarded – undo
4851 4851
 		$this->cache_transport_mode = array();
4852 4852
 
4853 4853
 		$sql = "SELECT rowid, code, label, active";
4854
-		$sql .= " FROM " . $this->db->prefix() . "c_transport_mode";
4855
-		$sql .= " WHERE entity IN (" . getEntity('c_transport_mode') . ")";
4854
+		$sql .= " FROM ".$this->db->prefix()."c_transport_mode";
4855
+		$sql .= " WHERE entity IN (".getEntity('c_transport_mode').")";
4856 4856
 
4857 4857
 		$resql = $this->db->query($sql);
4858 4858
 		if ($resql) {
@@ -4862,7 +4862,7 @@  discard block
 block discarded – undo
4862 4862
 				$obj = $this->db->fetch_object($resql);
4863 4863
 
4864 4864
 				// If traduction exist, we use it else we take the default label
4865
-				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) != "PaymentTypeShort" . $obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
4865
+				$label = ($langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) != "PaymentTypeShort".$obj->code ? $langs->transnoentitiesnoconv("PaymentTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
4866 4866
 				$this->cache_transport_mode[$obj->rowid]['rowid'] = $obj->rowid;
4867 4867
 				$this->cache_transport_mode[$obj->rowid]['code'] = $obj->code;
4868 4868
 				$this->cache_transport_mode[$obj->rowid]['label'] = $label;
@@ -4896,11 +4896,11 @@  discard block
 block discarded – undo
4896 4896
 	{
4897 4897
 		global $langs, $user;
4898 4898
 
4899
-		dol_syslog(__METHOD__ . " " . $selected . ", " . $htmlname . ", " . $format, LOG_DEBUG);
4899
+		dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$format, LOG_DEBUG);
4900 4900
 
4901 4901
 		$this->load_cache_transport_mode();
4902 4902
 
4903
-		print '<select id="select' . $htmlname . '" class="flat selectmodetransport' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
4903
+		print '<select id="select'.$htmlname.'" class="flat selectmodetransport'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
4904 4904
 		if ($empty) {
4905 4905
 			print '<option value="">&nbsp;</option>';
4906 4906
 		}
@@ -4916,13 +4916,13 @@  discard block
 block discarded – undo
4916 4916
 			}
4917 4917
 
4918 4918
 			if ($format == 0) {
4919
-				print '<option value="' . $id . '"';
4919
+				print '<option value="'.$id.'"';
4920 4920
 			} elseif ($format == 1) {
4921
-				print '<option value="' . $arraytypes['code'] . '"';
4921
+				print '<option value="'.$arraytypes['code'].'"';
4922 4922
 			} elseif ($format == 2) {
4923
-				print '<option value="' . $arraytypes['code'] . '"';
4923
+				print '<option value="'.$arraytypes['code'].'"';
4924 4924
 			} elseif ($format == 3) {
4925
-				print '<option value="' . $id . '"';
4925
+				print '<option value="'.$id.'"';
4926 4926
 			}
4927 4927
 			// If text is selected, we compare with code, else with id
4928 4928
 			if (preg_match('/[a-z]/i', $selected) && $selected == $arraytypes['code']) {
@@ -4973,31 +4973,31 @@  discard block
 block discarded – undo
4973 4973
 		$langs->load("deliveries");
4974 4974
 
4975 4975
 		$sql = "SELECT rowid, code, libelle as label";
4976
-		$sql .= " FROM " . $this->db->prefix() . "c_shipment_mode";
4976
+		$sql .= " FROM ".$this->db->prefix()."c_shipment_mode";
4977 4977
 		$sql .= " WHERE active > 0";
4978 4978
 		if ($filtre) {
4979
-			$sql .= " AND " . $filtre;
4979
+			$sql .= " AND ".$filtre;
4980 4980
 		}
4981 4981
 		$sql .= " ORDER BY libelle ASC";
4982 4982
 
4983
-		dol_syslog(get_class($this) . "::selectShippingMode", LOG_DEBUG);
4983
+		dol_syslog(get_class($this)."::selectShippingMode", LOG_DEBUG);
4984 4984
 		$result = $this->db->query($sql);
4985 4985
 		if ($result) {
4986 4986
 			$num = $this->db->num_rows($result);
4987 4987
 			$i = 0;
4988 4988
 			if ($num) {
4989
-				print '<select id="select' . $htmlname . '" class="flat selectshippingmethod' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
4989
+				print '<select id="select'.$htmlname.'" class="flat selectshippingmethod'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
4990 4990
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
4991 4991
 					print '<option value="-1">&nbsp;</option>';
4992 4992
 				}
4993 4993
 				while ($i < $num) {
4994 4994
 					$obj = $this->db->fetch_object($result);
4995 4995
 					if ($selected == $obj->rowid) {
4996
-						print '<option value="' . $obj->rowid . '" selected>';
4996
+						print '<option value="'.$obj->rowid.'" selected>';
4997 4997
 					} else {
4998
-						print '<option value="' . $obj->rowid . '">';
4998
+						print '<option value="'.$obj->rowid.'">';
4999 4999
 					}
5000
-					print ($langs->trans("SendingMethod" . strtoupper($obj->code)) != "SendingMethod" . strtoupper($obj->code)) ? $langs->trans("SendingMethod" . strtoupper($obj->code)) : $obj->label;
5000
+					print ($langs->trans("SendingMethod".strtoupper($obj->code)) != "SendingMethod".strtoupper($obj->code)) ? $langs->trans("SendingMethod".strtoupper($obj->code)) : $obj->label;
5001 5001
 					print '</option>';
5002 5002
 					$i++;
5003 5003
 				}
@@ -5006,7 +5006,7 @@  discard block
 block discarded – undo
5006 5006
 					print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
5007 5007
 				}
5008 5008
 
5009
-				print ajax_combobox('select' . $htmlname);
5009
+				print ajax_combobox('select'.$htmlname);
5010 5010
 			} else {
5011 5011
 				print $langs->trans("NoShippingMethodDefined");
5012 5012
 			}
@@ -5031,16 +5031,16 @@  discard block
 block discarded – undo
5031 5031
 		$langs->load("deliveries");
5032 5032
 
5033 5033
 		if ($htmlname != "none") {
5034
-			print '<form method="POST" action="' . $page . '">';
5034
+			print '<form method="POST" action="'.$page.'">';
5035 5035
 			print '<input type="hidden" name="action" value="setshippingmethod">';
5036
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5036
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5037 5037
 			$this->selectShippingMethod($selected, $htmlname, '', $addempty);
5038
-			print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
5038
+			print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
5039 5039
 			print '</form>';
5040 5040
 		} else {
5041 5041
 			if ($selected) {
5042 5042
 				$code = $langs->getLabelFromKey($this->db, $selected, 'c_shipment_mode', 'rowid', 'code');
5043
-				print $langs->trans("SendingMethod" . strtoupper($code));
5043
+				print $langs->trans("SendingMethod".strtoupper($code));
5044 5044
 			} else {
5045 5045
 				print "&nbsp;";
5046 5046
 			}
@@ -5063,10 +5063,10 @@  discard block
 block discarded – undo
5063 5063
 
5064 5064
 		$opt = '<option value="" selected></option>';
5065 5065
 		$sql = "SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc";
5066
-		$sql .= ' FROM ' . $this->db->prefix() . 'facture';
5067
-		$sql .= ' WHERE entity IN (' . getEntity('invoice') . ')';
5066
+		$sql .= ' FROM '.$this->db->prefix().'facture';
5067
+		$sql .= ' WHERE entity IN ('.getEntity('invoice').')';
5068 5068
 		$sql .= ' AND situation_counter >= 1';
5069
-		$sql .= ' AND fk_soc = ' . (int) $socid;
5069
+		$sql .= ' AND fk_soc = '.(int) $socid;
5070 5070
 		$sql .= ' AND type <> 2';
5071 5071
 		$sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
5072 5072
 		$resql = $this->db->query($sql);
@@ -5084,19 +5084,19 @@  discard block
 block discarded – undo
5084 5084
 						//Not prov?
5085 5085
 						if (substr($obj->ref, 1, 4) != 'PROV') {
5086 5086
 							if ($selected == $obj->rowid) {
5087
-								$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
5087
+								$opt .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.'</option>';
5088 5088
 							} else {
5089
-								$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
5089
+								$opt .= '<option value="'.$obj->rowid.'">'.$obj->ref.'</option>';
5090 5090
 							}
5091 5091
 						}
5092 5092
 					}
5093 5093
 				}
5094 5094
 			}
5095 5095
 		} else {
5096
-			dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
5096
+			dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR);
5097 5097
 		}
5098 5098
 		if ($opt == '<option value ="" selected></option>') {
5099
-			$opt = '<option value ="0" selected>' . $langs->trans('NoSituations') . '</option>';
5099
+			$opt = '<option value ="0" selected>'.$langs->trans('NoSituations').'</option>';
5100 5100
 		}
5101 5101
 		return $opt;
5102 5102
 	}
@@ -5116,12 +5116,12 @@  discard block
 block discarded – undo
5116 5116
 
5117 5117
 		$langs->load('products');
5118 5118
 
5119
-		$return = '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
5119
+		$return = '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
5120 5120
 
5121
-		$sql = "SELECT rowid, label, code FROM " . $this->db->prefix() . "c_units";
5121
+		$sql = "SELECT rowid, label, code FROM ".$this->db->prefix()."c_units";
5122 5122
 		$sql .= ' WHERE active > 0';
5123 5123
 		if (!empty($unit_type)) {
5124
-			$sql .= " AND unit_type = '" . $this->db->escape($unit_type) . "'";
5124
+			$sql .= " AND unit_type = '".$this->db->escape($unit_type)."'";
5125 5125
 		}
5126 5126
 		$sql .= " ORDER BY sortorder";
5127 5127
 
@@ -5133,14 +5133,14 @@  discard block
 block discarded – undo
5133 5133
 
5134 5134
 			while ($res = $this->db->fetch_object($resql)) {
5135 5135
 				$unitLabel = $res->label;
5136
-				if (!empty($langs->tab_translate['unit' . $res->code])) {    // check if Translation is available before
5137
-					$unitLabel = $langs->trans('unit' . $res->code) != $res->label ? $langs->trans('unit' . $res->code) : $res->label;
5136
+				if (!empty($langs->tab_translate['unit'.$res->code])) {    // check if Translation is available before
5137
+					$unitLabel = $langs->trans('unit'.$res->code) != $res->label ? $langs->trans('unit'.$res->code) : $res->label;
5138 5138
 				}
5139 5139
 
5140 5140
 				if ($selected == $res->rowid) {
5141
-					$return .= '<option value="' . $res->rowid . '" selected>' . $unitLabel . '</option>';
5141
+					$return .= '<option value="'.$res->rowid.'" selected>'.$unitLabel.'</option>';
5142 5142
 				} else {
5143
-					$return .= '<option value="' . $res->rowid . '">' . $unitLabel . '</option>';
5143
+					$return .= '<option value="'.$res->rowid.'">'.$unitLabel.'</option>';
5144 5144
 				}
5145 5145
 			}
5146 5146
 			$return .= '</select>';
@@ -5175,29 +5175,29 @@  discard block
 block discarded – undo
5175 5175
 		$num = 0;
5176 5176
 
5177 5177
 		$sql = "SELECT rowid, label, bank, clos as status, currency_code";
5178
-		$sql .= " FROM " . $this->db->prefix() . "bank_account";
5179
-		$sql .= " WHERE entity IN (" . getEntity('bank_account') . ")";
5178
+		$sql .= " FROM ".$this->db->prefix()."bank_account";
5179
+		$sql .= " WHERE entity IN (".getEntity('bank_account').")";
5180 5180
 		if ($status != 2) {
5181
-			$sql .= " AND clos = " . (int) $status;
5181
+			$sql .= " AND clos = ".(int) $status;
5182 5182
 		}
5183 5183
 		if ($filtre) {	// TODO Support USF
5184
-			$sql .= " AND " . $filtre;
5184
+			$sql .= " AND ".$filtre;
5185 5185
 		}
5186 5186
 		$sql .= " ORDER BY label";
5187 5187
 
5188
-		dol_syslog(get_class($this) . "::select_comptes", LOG_DEBUG);
5188
+		dol_syslog(get_class($this)."::select_comptes", LOG_DEBUG);
5189 5189
 		$result = $this->db->query($sql);
5190 5190
 		if ($result) {
5191 5191
 			$num = $this->db->num_rows($result);
5192 5192
 			$i = 0;
5193 5193
 
5194
-			$out .= '<select id="select' . $htmlname . '" class="flat selectbankaccount' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5194
+			$out .= '<select id="select'.$htmlname.'" class="flat selectbankaccount'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5195 5195
 
5196 5196
 			if ($num == 0) {
5197 5197
 				if ($status == 0) {
5198
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoActiveBankAccountDefined") . '</span>';
5198
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
5199 5199
 				} else {
5200
-					$out .= '<option class="opacitymedium" value="-1">' . $langs->trans("NoBankAccountFound") . '</span>';
5200
+					$out .= '<option class="opacitymedium" value="-1">'.$langs->trans("NoBankAccountFound").'</span>';
5201 5201
 				}
5202 5202
 			} else {
5203 5203
 				if (!empty($useempty) && !is_numeric($useempty)) {
@@ -5213,25 +5213,25 @@  discard block
 block discarded – undo
5213 5213
 				$labeltoshow = trim($obj->label);
5214 5214
 				$labeltoshowhtml = trim($obj->label);
5215 5215
 				if ($showcurrency) {
5216
-					$labeltoshow .= ' (' . $obj->currency_code . ')';
5217
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $obj->currency_code . ')</span>';
5216
+					$labeltoshow .= ' ('.$obj->currency_code.')';
5217
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$obj->currency_code.')</span>';
5218 5218
 				}
5219 5219
 				if ($status == 2 && $obj->status == 1) {
5220
-					$labeltoshow .= ' (' . $langs->trans("Closed") . ')';
5221
-					$labeltoshowhtml .= ' <span class="opacitymedium">(' . $langs->trans("Closed") . ')</span>';
5220
+					$labeltoshow .= ' ('.$langs->trans("Closed").')';
5221
+					$labeltoshowhtml .= ' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
5222 5222
 				}
5223 5223
 
5224 5224
 				if ($selected == $obj->rowid || ($useempty == 2 && $num == 1 && empty($selected))) {
5225
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5225
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'" selected>';
5226 5226
 				} else {
5227
-					$out .= '<option value="' . $obj->rowid . '" data-currency-code="' . $obj->currency_code . '" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5227
+					$out .= '<option value="'.$obj->rowid.'" data-currency-code="'.$obj->currency_code.'" data-html="'.dolPrintHTMLForAttribute($labeltoshowhtml).'">';
5228 5228
 				}
5229 5229
 				$out .= $labeltoshow;
5230 5230
 				$out .= '</option>';
5231 5231
 				$i++;
5232 5232
 			}
5233 5233
 			$out .= "</select>";
5234
-			$out .= ajax_combobox('select' . $htmlname);
5234
+			$out .= ajax_combobox('select'.$htmlname);
5235 5235
 		} else {
5236 5236
 			dol_print_error($this->db);
5237 5237
 		}
@@ -5265,23 +5265,23 @@  discard block
 block discarded – undo
5265 5265
 		$num = 0;
5266 5266
 
5267 5267
 		$sql = "SELECT rowid, name, fk_country, status, entity";
5268
-		$sql .= " FROM " . $this->db->prefix() . "establishment";
5268
+		$sql .= " FROM ".$this->db->prefix()."establishment";
5269 5269
 		$sql .= " WHERE 1=1";
5270 5270
 		if ($status != 2) {
5271
-			$sql .= " AND status = " . (int) $status;
5271
+			$sql .= " AND status = ".(int) $status;
5272 5272
 		}
5273 5273
 		if ($filtre) {	// TODO Support USF
5274
-			$sql .= " AND " . $filtre;
5274
+			$sql .= " AND ".$filtre;
5275 5275
 		}
5276 5276
 		$sql .= " ORDER BY name";
5277 5277
 
5278
-		dol_syslog(get_class($this) . "::select_establishment", LOG_DEBUG);
5278
+		dol_syslog(get_class($this)."::select_establishment", LOG_DEBUG);
5279 5279
 		$result = $this->db->query($sql);
5280 5280
 		if ($result) {
5281 5281
 			$num = $this->db->num_rows($result);
5282 5282
 			$i = 0;
5283 5283
 			if ($num) {
5284
-				print '<select id="select' . $htmlname . '" class="flat selectestablishment" name="' . $htmlname . '"' . ($moreattrib ? ' ' . $moreattrib : '') . '>';
5284
+				print '<select id="select'.$htmlname.'" class="flat selectestablishment" name="'.$htmlname.'"'.($moreattrib ? ' '.$moreattrib : '').'>';
5285 5285
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5286 5286
 					print '<option value="-1">&nbsp;</option>';
5287 5287
 				}
@@ -5289,13 +5289,13 @@  discard block
 block discarded – undo
5289 5289
 				while ($i < $num) {
5290 5290
 					$obj = $this->db->fetch_object($result);
5291 5291
 					if ($selected == $obj->rowid) {
5292
-						print '<option value="' . $obj->rowid . '" selected>';
5292
+						print '<option value="'.$obj->rowid.'" selected>';
5293 5293
 					} else {
5294
-						print '<option value="' . $obj->rowid . '">';
5294
+						print '<option value="'.$obj->rowid.'">';
5295 5295
 					}
5296 5296
 					print trim($obj->name);
5297 5297
 					if ($status == 2 && $obj->status == 1) {
5298
-						print ' (' . $langs->trans("Closed") . ')';
5298
+						print ' ('.$langs->trans("Closed").')';
5299 5299
 					}
5300 5300
 					print '</option>';
5301 5301
 					$i++;
@@ -5303,9 +5303,9 @@  discard block
 block discarded – undo
5303 5303
 				print "</select>";
5304 5304
 			} else {
5305 5305
 				if ($status == 0) {
5306
-					print '<span class="opacitymedium">' . $langs->trans("NoActiveEstablishmentDefined") . '</span>';
5306
+					print '<span class="opacitymedium">'.$langs->trans("NoActiveEstablishmentDefined").'</span>';
5307 5307
 				} else {
5308
-					print '<span class="opacitymedium">' . $langs->trans("NoEstablishmentFound") . '</span>';
5308
+					print '<span class="opacitymedium">'.$langs->trans("NoEstablishmentFound").'</span>';
5309 5309
 				}
5310 5310
 			}
5311 5311
 
@@ -5329,20 +5329,20 @@  discard block
 block discarded – undo
5329 5329
 	{
5330 5330
 		global $langs;
5331 5331
 		if ($htmlname != "none") {
5332
-			print '<form method="POST" action="' . $page . '">';
5332
+			print '<form method="POST" action="'.$page.'">';
5333 5333
 			print '<input type="hidden" name="action" value="setbankaccount">';
5334
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
5334
+			print '<input type="hidden" name="token" value="'.newToken().'">';
5335 5335
 			print img_picto('', 'bank_account', 'class="pictofixedwidth"');
5336 5336
 			$nbaccountfound = $this->select_comptes($selected, $htmlname, 0, '', $addempty);
5337 5337
 			if ($nbaccountfound > 0) {
5338
-				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
5338
+				print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
5339 5339
 			}
5340 5340
 			print '</form>';
5341 5341
 		} else {
5342 5342
 			$langs->load('banks');
5343 5343
 
5344 5344
 			if ($selected) {
5345
-				require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
5345
+				require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
5346 5346
 				$bankstatic = new Account($this->db);
5347 5347
 				$result = $bankstatic->fetch($selected);
5348 5348
 				if ($result) {
@@ -5381,11 +5381,11 @@  discard block
 block discarded – undo
5381 5381
 		global $conf, $langs;
5382 5382
 		$langs->load("categories");
5383 5383
 
5384
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5384
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5385 5385
 
5386 5386
 		// For backward compatibility
5387 5387
 		if (is_numeric($type)) {
5388
-			dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5388
+			dol_syslog(__METHOD__.': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
5389 5389
 		}
5390 5390
 
5391 5391
 		if ($type === Categorie::TYPE_BANK_LINE) {
@@ -5393,8 +5393,8 @@  discard block
 block discarded – undo
5393 5393
 			$cat = new Categorie($this->db);
5394 5394
 			$cate_arbo = array();
5395 5395
 			$sql = "SELECT c.label, c.rowid";
5396
-			$sql .= " FROM " . $this->db->prefix() . "categorie as c";
5397
-			$sql .= " WHERE entity = " . $conf->entity . " AND type = " . ((int) $cat->getMapId()[$type]);
5396
+			$sql .= " FROM ".$this->db->prefix()."categorie as c";
5397
+			$sql .= " WHERE entity = ".$conf->entity." AND type = ".((int) $cat->getMapId()[$type]);
5398 5398
 			$sql .= " ORDER BY c.label";
5399 5399
 			$result = $this->db->query($sql);
5400 5400
 			if ($result) {
@@ -5420,12 +5420,12 @@  discard block
 block discarded – undo
5420 5420
 		$outarrayrichhtml = array();
5421 5421
 
5422 5422
 
5423
-		$output = '<select class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
5423
+		$output = '<select class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
5424 5424
 		if (is_array($cate_arbo)) {
5425 5425
 			$num = count($cate_arbo);
5426 5426
 
5427 5427
 			if (!$num) {
5428
-				$output .= '<option value="-1" disabled>' . $langs->trans("NoCategoriesDefined") . '</option>';
5428
+				$output .= '<option value="-1" disabled>'.$langs->trans("NoCategoriesDefined").'</option>';
5429 5429
 			} else {
5430 5430
 				if ($useempty == 1 || ($useempty == 2 && $num > 1)) {
5431 5431
 					$output .= '<option value="-1">&nbsp;</option>';
@@ -5437,15 +5437,15 @@  discard block
 block discarded – undo
5437 5437
 						$add = '';
5438 5438
 					}
5439 5439
 
5440
-					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #' . $cate_arbo[$key]['color'] . '"');
5440
+					$labeltoshow = img_picto('', 'category', 'class="pictofixedwidth" style="color: #'.$cate_arbo[$key]['color'].'"');
5441 5441
 					$labeltoshow .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5442 5442
 
5443 5443
 					$outarray[$cate_arbo[$key]['id']] = $cate_arbo[$key]['fulllabel'];
5444 5444
 
5445 5445
 					$outarrayrichhtml[$cate_arbo[$key]['id']] = $labeltoshow;
5446 5446
 
5447
-					$output .= '<option ' . $add . 'value="' . $cate_arbo[$key]['id'] . '"';
5448
-					$output .= ' data-html="' . dol_escape_htmltag($labeltoshow) . '"';
5447
+					$output .= '<option '.$add.'value="'.$cate_arbo[$key]['id'].'"';
5448
+					$output .= ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
5449 5449
 					$output .= '>';
5450 5450
 					$output .= dol_trunc($cate_arbo[$key]['fulllabel'], $maxlength, 'middle');
5451 5451
 					$output .= '</option>';
@@ -5491,7 +5491,7 @@  discard block
 block discarded – undo
5491 5491
 	public function form_confirm($page, $title, $question, $action, $formquestion = array(), $selectedchoice = "", $useajax = 0, $height = 170, $width = 500)
5492 5492
 	{
5493 5493
 		// phpcs:enable
5494
-		dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5494
+		dol_syslog(__METHOD__.': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING);
5495 5495
 		print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width);
5496 5496
 	}
5497 5497
 
@@ -5526,7 +5526,7 @@  discard block
 block discarded – undo
5526 5526
 	{
5527 5527
 		global $langs, $conf;
5528 5528
 
5529
-		$more = '<!-- formconfirm - before call, page=' . dol_escape_htmltag($page) . ' -->';
5529
+		$more = '<!-- formconfirm - before call, page='.dol_escape_htmltag($page).' -->';
5530 5530
 		$formconfirm = '';
5531 5531
 		$inputok = array();
5532 5532
 		$inputko = array();
@@ -5550,27 +5550,27 @@  discard block
 block discarded – undo
5550 5550
 			foreach ($formquestion as $key => $input) {
5551 5551
 				if (is_array($input) && !empty($input)) {
5552 5552
 					if ($input['type'] == 'hidden') {
5553
-						$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5554
-						$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5553
+						$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5554
+						$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5555 5555
 
5556
-						$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";
5556
+						$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";
5557 5557
 					}
5558 5558
 				}
5559 5559
 			}
5560 5560
 
5561 5561
 			// Now add questions
5562 5562
 			$moreonecolumn = '';
5563
-			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">' . "\n";
5563
+			$more .= '<div class="tagtable paddingtopbottomonly centpercent noborderspacing">'."\n";
5564 5564
 			foreach ($formquestion as $key => $input) {
5565 5565
 				if (is_array($input) && !empty($input)) {
5566
-					$size = (!empty($input['size']) ? ' size="' . $input['size'] . '"' : '');    // deprecated. Use morecss instead.
5567
-					$moreattr = (!empty($input['moreattr']) ? ' ' . $input['moreattr'] : '');
5568
-					$morecss = (!empty($input['morecss']) ? ' ' . $input['morecss'] : '');
5566
+					$size = (!empty($input['size']) ? ' size="'.$input['size'].'"' : ''); // deprecated. Use morecss instead.
5567
+					$moreattr = (!empty($input['moreattr']) ? ' '.$input['moreattr'] : '');
5568
+					$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
5569 5569
 
5570 5570
 					if ($input['type'] == 'text') {
5571
-						$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";
5571
+						$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";
5572 5572
 					} elseif ($input['type'] == 'password') {
5573
-						$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";
5573
+						$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";
5574 5574
 					} elseif ($input['type'] == 'textarea') {
5575 5575
 						/*$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div><div class="tagtd">';
5576 5576
 						$more .= '<textarea name="'.$input['name'].'" class="'.$morecss.'"'.$moreattr.'>';
@@ -5578,8 +5578,8 @@  discard block
 block discarded – undo
5578 5578
 						$more .= '</textarea>';
5579 5579
 						$more .= '</div></div>'."\n";*/
5580 5580
 						$moreonecolumn .= '<div class="margintoponly">';
5581
-						$moreonecolumn .= $input['label'] . '<br>';
5582
-						$moreonecolumn .= '<textarea name="' . dol_escape_htmltag($input['name']) . '" id="' . dol_escape_htmltag($input['name']) . '" class="' . $morecss . '"' . $moreattr . '>';
5581
+						$moreonecolumn .= $input['label'].'<br>';
5582
+						$moreonecolumn .= '<textarea name="'.dol_escape_htmltag($input['name']).'" id="'.dol_escape_htmltag($input['name']).'" class="'.$morecss.'"'.$moreattr.'>';
5583 5583
 						$moreonecolumn .= $input['value'];
5584 5584
 						$moreonecolumn .= '</textarea>';
5585 5585
 						$moreonecolumn .= '</div>';
@@ -5596,20 +5596,20 @@  discard block
 block discarded – undo
5596 5596
 						$disabled = isset($input['select_disabled']) ? $input['select_disabled'] : 0;
5597 5597
 						$sort = isset($input['select_sort']) ? $input['select_sort'] : '';
5598 5598
 
5599
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">';
5599
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5600 5600
 						if (!empty($input['label'])) {
5601
-							$more .= $input['label'] . '</div><div class="tagtd left">';
5601
+							$more .= $input['label'].'</div><div class="tagtd left">';
5602 5602
 						}
5603 5603
 						if ($input['type'] == 'select') {
5604 5604
 							$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);
5605 5605
 						} else {
5606 5606
 							$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);
5607 5607
 						}
5608
-						$more .= '</div></div>' . "\n";
5608
+						$more .= '</div></div>'."\n";
5609 5609
 					} elseif ($input['type'] == 'checkbox') {
5610 5610
 						$more .= '<div class="tagtr">';
5611
-						$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '"><label for="' . dol_escape_htmltag($input['name']) . '">' . $input['label'] . '</label></div><div class="tagtd">';
5612
-						$more .= '<input type="checkbox" class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . dol_escape_htmltag($input['name']) . '" name="' . dol_escape_htmltag($input['name']) . '"' . $moreattr;
5611
+						$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'"><label for="'.dol_escape_htmltag($input['name']).'">'.$input['label'].'</label></div><div class="tagtd">';
5612
+						$more .= '<input type="checkbox" class="flat'.($morecss ? ' '.$morecss : '').'" id="'.dol_escape_htmltag($input['name']).'" name="'.dol_escape_htmltag($input['name']).'"'.$moreattr;
5613 5613
 						if (!is_bool($input['value']) && $input['value'] != 'false' && $input['value'] != '0' && $input['value'] != '') {
5614 5614
 							$more .= ' checked';
5615 5615
 						}
@@ -5620,19 +5620,19 @@  discard block
 block discarded – undo
5620 5620
 							$more .= ' disabled';
5621 5621
 						}
5622 5622
 						$more .= ' /></div>';
5623
-						$more .= '</div>' . "\n";
5623
+						$more .= '</div>'."\n";
5624 5624
 					} elseif ($input['type'] == 'radio') {
5625 5625
 						$i = 0;
5626 5626
 						foreach ($input['values'] as $selkey => $selval) {
5627 5627
 							$more .= '<div class="tagtr">';
5628 5628
 							if (isset($input['label'])) {
5629 5629
 								if ($i == 0) {
5630
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? ' tdtop' : (' tdtop ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5630
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? ' tdtop' : (' tdtop '.$input['tdclass'])).'">'.$input['label'].'</div>';
5631 5631
 								} else {
5632
-									$more .= '<div class="tagtd' . (empty($input['tdclass']) ? '' : (' "' . $input['tdclass'])) . '">&nbsp;</div>';
5632
+									$more .= '<div class="tagtd'.(empty($input['tdclass']) ? '' : (' "'.$input['tdclass'])).'">&nbsp;</div>';
5633 5633
 								}
5634 5634
 							}
5635
-							$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;
5635
+							$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;
5636 5636
 							if (!empty($input['disabled'])) {
5637 5637
 								$more .= ' disabled';
5638 5638
 							}
@@ -5640,12 +5640,12 @@  discard block
 block discarded – undo
5640 5640
 								$more .= ' checked="checked"';
5641 5641
 							}
5642 5642
 							$more .= ' /> ';
5643
-							$more .= '<label for="' . dol_escape_htmltag($input['name'] . $selkey) . '" class="valignmiddle">' . $selval . '</label>';
5644
-							$more .= '</div></div>' . "\n";
5643
+							$more .= '<label for="'.dol_escape_htmltag($input['name'].$selkey).'" class="valignmiddle">'.$selval.'</label>';
5644
+							$more .= '</div></div>'."\n";
5645 5645
 							$i++;
5646 5646
 						}
5647 5647
 					} elseif ($input['type'] == 'date' || $input['type'] == 'datetime') {
5648
-						$more .= '<div class="tagtr"><div class="tagtd' . (empty($input['tdclass']) ? '' : (' ' . $input['tdclass'])) . '">' . $input['label'] . '</div>';
5648
+						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">'.$input['label'].'</div>';
5649 5649
 						$more .= '<div class="tagtd">';
5650 5650
 						$addnowlink = (empty($input['datenow']) ? 0 : 1);
5651 5651
 						$h = $m = 0;
@@ -5663,24 +5663,24 @@  discard block
 block discarded – undo
5663 5663
 					} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
5664 5664
 						$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
5665 5665
 						if (!empty($input['label'])) {
5666
-							$more .= $input['label'] . '</div><div class="tagtd">';
5666
+							$more .= $input['label'].'</div><div class="tagtd">';
5667 5667
 						}
5668 5668
 						$more .= $input['value'];
5669
-						$more .= '</div></div>' . "\n";
5669
+						$more .= '</div></div>'."\n";
5670 5670
 					} elseif ($input['type'] == 'onecolumn') {
5671 5671
 						$moreonecolumn .= '<div class="margintoponly">';
5672 5672
 						$moreonecolumn .= $input['value'];
5673
-						$moreonecolumn .= '</div>' . "\n";
5673
+						$moreonecolumn .= '</div>'."\n";
5674 5674
 					} elseif ($input['type'] == 'hidden') {
5675 5675
 						// Do nothing more, already added by a previous loop
5676 5676
 					} elseif ($input['type'] == 'separator') {
5677 5677
 						$more .= '<br>';
5678 5678
 					} else {
5679
-						$more .= 'Error type ' . $input['type'] . ' for the confirm box is not a supported type';
5679
+						$more .= 'Error type '.$input['type'].' for the confirm box is not a supported type';
5680 5680
 					}
5681 5681
 				}
5682 5682
 			}
5683
-			$more .= '</div>' . "\n";
5683
+			$more .= '</div>'."\n";
5684 5684
 			$more .= $moreonecolumn;
5685 5685
 		}
5686 5686
 
@@ -5702,10 +5702,10 @@  discard block
 block discarded – undo
5702 5702
 				$button = $useajax;
5703 5703
 				$useajax = 1;
5704 5704
 				$autoOpen = false;
5705
-				$dialogconfirm .= '-' . $button;
5705
+				$dialogconfirm .= '-'.$button;
5706 5706
 			}
5707
-			$pageyes = $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=yes';
5708
-			$pageno = ($useajax == 2 ? $page . (preg_match('/\?/', $page) ? '&' : '?') . 'action=' . urlencode($action) . '&confirm=no' : '');
5707
+			$pageyes = $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=yes';
5708
+			$pageno = ($useajax == 2 ? $page.(preg_match('/\?/', $page) ? '&' : '?').'action='.urlencode($action).'&confirm=no' : '');
5709 5709
 
5710 5710
 			// Add input fields into list of fields to read during submit (inputok and inputko)
5711 5711
 			if (is_array($formquestion)) {
@@ -5728,24 +5728,24 @@  discard block
 block discarded – undo
5728 5728
 			}
5729 5729
 
5730 5730
 			// Show JQuery confirm box.
5731
-			$formconfirm .= '<div id="' . $dialogconfirm . '" title="' . dol_escape_htmltag($title) . '" style="display: none;">';
5731
+			$formconfirm .= '<div id="'.$dialogconfirm.'" title="'.dol_escape_htmltag($title).'" style="display: none;">';
5732 5732
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5733
-				$formconfirm .= '<div class="confirmtext">' . $formquestion['text'] . '</div>' . "\n";
5733
+				$formconfirm .= '<div class="confirmtext">'.$formquestion['text'].'</div>'."\n";
5734 5734
 			}
5735 5735
 			if (!empty($more)) {
5736
-				$formconfirm .= '<div class="confirmquestions">' . $more . '</div>' . "\n";
5736
+				$formconfirm .= '<div class="confirmquestions">'.$more.'</div>'."\n";
5737 5737
 			}
5738
-			$formconfirm .= ($question ? '<div class="confirmmessage">' . img_help(0, '') . ' ' . $question . '</div>' : '');
5739
-			$formconfirm .= '</div>' . "\n";
5738
+			$formconfirm .= ($question ? '<div class="confirmmessage">'.img_help(0, '').' '.$question.'</div>' : '');
5739
+			$formconfirm .= '</div>'."\n";
5740 5740
 
5741
-			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=" . $page . " -->\n";
5742
-			$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5741
+			$formconfirm .= "\n<!-- begin code of popup for formconfirm page=".$page." -->\n";
5742
+			$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5743 5743
 			$formconfirm .= "/* Code for the jQuery('#dialogforpopup').dialog() */\n";
5744 5744
 			$formconfirm .= 'jQuery(document).ready(function() {
5745 5745
             $(function() {
5746
-            	$( "#' . $dialogconfirm . '" ).dialog(
5746
+            	$( "#' . $dialogconfirm.'" ).dialog(
5747 5747
             	{
5748
-                    autoOpen: ' . ($autoOpen ? "true" : "false") . ',';
5748
+                    autoOpen: ' . ($autoOpen ? "true" : "false").',';
5749 5749
 			if ($newselectedchoice == 'no') {
5750 5750
 				$formconfirm .= '
5751 5751
 						open: function() {
@@ -5755,24 +5755,24 @@  discard block
 block discarded – undo
5755 5755
 
5756 5756
 			$jsforcursor = '';
5757 5757
 			if ($useajax == 1) {
5758
-				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor' . "\n";
5759
-				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");' . "\n";
5758
+				$jsforcursor = '// The call to urljump can be slow, so we set the wait cursor'."\n";
5759
+				$jsforcursor .= 'jQuery("html,body,#id-container").addClass("cursorwait");'."\n";
5760 5760
 			}
5761 5761
 
5762 5762
 			$postconfirmas = 'GET';
5763 5763
 
5764 5764
 			$formconfirm .= '
5765 5765
                     resizable: false,
5766
-                    height: "' . $height . '",
5767
-                    width: "' . $width . '",
5766
+                    height: "' . $height.'",
5767
+                    width: "' . $width.'",
5768 5768
                     modal: true,
5769 5769
                     closeOnEscape: false,
5770 5770
                     buttons: {
5771
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() {
5772
-							var options = "token=' . urlencode(newToken()) . '";
5773
-                        	var inputok = ' . json_encode($inputok) . ';	/* List of fields into form */
5774
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5775
-                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '";
5771
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonyes)).'": function() {
5772
+							var options = "token=' . urlencode(newToken()).'";
5773
+                        	var inputok = ' . json_encode($inputok).';	/* List of fields into form */
5774
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5775
+                         	var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '').'";
5776 5776
 
5777 5777
                          	if (inputok.length > 0) {
5778 5778
                          		$.each(inputok, function(i, inputname) {
@@ -5806,11 +5806,11 @@  discard block
 block discarded – undo
5806 5806
 							}
5807 5807
 	                        $(this).dialog("close");
5808 5808
                         },
5809
-                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)) . '": function() {
5810
-                        	var options = "token=' . urlencode(newToken()) . '";
5811
-                         	var inputko = ' . json_encode($inputko) . ';	/* List of fields into form */
5812
-							var page = "' . dol_escape_js(!empty($page) ? $page : '') . '";
5813
-                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '') . '";
5809
+                        "' . dol_escape_js($langs->transnoentities($labelbuttonno)).'": function() {
5810
+                        	var options = "token=' . urlencode(newToken()).'";
5811
+                         	var inputko = ' . json_encode($inputko).';	/* List of fields into form */
5812
+							var page = "' . dol_escape_js(!empty($page) ? $page : '').'";
5813
+                         	var pageno="' . dol_escape_js(!empty($pageno) ? $pageno : '').'";
5814 5814
                          	if (inputko.length > 0) {
5815 5815
                          		$.each(inputko, function(i, inputname) {
5816 5816
                          			var more = "";
@@ -5842,10 +5842,10 @@  discard block
 block discarded – undo
5842 5842
                 }
5843 5843
                 );
5844 5844
 
5845
-            	var button = "' . $button . '";
5845
+            	var button = "' . $button.'";
5846 5846
             	if (button.length > 0) {
5847 5847
                 	$( "#" + button ).click(function() {
5848
-                		$("#' . $dialogconfirm . '").dialog("open");
5848
+                		$("#' . $dialogconfirm.'").dialog("open");
5849 5849
         			});
5850 5850
                 }
5851 5851
             });
@@ -5853,44 +5853,44 @@  discard block
 block discarded – undo
5853 5853
             </script>';
5854 5854
 			$formconfirm .= "<!-- end ajax formconfirm -->\n";
5855 5855
 		} else {
5856
-			$formconfirm .= "\n<!-- begin formconfirm page=" . dol_escape_htmltag($page) . " -->\n";
5856
+			$formconfirm .= "\n<!-- begin formconfirm page=".dol_escape_htmltag($page)." -->\n";
5857 5857
 
5858 5858
 			if (empty($disableformtag)) {
5859
-				$formconfirm .= '<form method="POST" action="' . $page . '" class="notoptoleftnoright">' . "\n";
5859
+				$formconfirm .= '<form method="POST" action="'.$page.'" class="notoptoleftnoright">'."\n";
5860 5860
 			}
5861 5861
 
5862
-			$formconfirm .= '<input type="hidden" name="action" value="' . $action . '">' . "\n";
5863
-			$formconfirm .= '<input type="hidden" name="token" value="' . newToken() . '">' . "\n";
5862
+			$formconfirm .= '<input type="hidden" name="action" value="'.$action.'">'."\n";
5863
+			$formconfirm .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
5864 5864
 
5865
-			$formconfirm .= '<table class="valid centpercent">' . "\n";
5865
+			$formconfirm .= '<table class="valid centpercent">'."\n";
5866 5866
 
5867 5867
 			// Line title
5868 5868
 			$formconfirm .= '<tr class="validtitre"><td class="validtitre" colspan="2">';
5869
-			$formconfirm .= img_picto('', 'pictoconfirm') . ' ' . $title;
5870
-			$formconfirm .= '</td></tr>' . "\n";
5869
+			$formconfirm .= img_picto('', 'pictoconfirm').' '.$title;
5870
+			$formconfirm .= '</td></tr>'."\n";
5871 5871
 
5872 5872
 			// Line text
5873 5873
 			if (is_array($formquestion) && array_key_exists('text', $formquestion) && !empty($formquestion['text'])) {
5874
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . $formquestion['text'] . '</td></tr>' . "\n";
5874
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'.$formquestion['text'].'</td></tr>'."\n";
5875 5875
 			}
5876 5876
 
5877 5877
 			// Line form fields
5878 5878
 			if ($more) {
5879
-				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">' . "\n";
5879
+				$formconfirm .= '<tr class="valid"><td class="valid" colspan="2">'."\n";
5880 5880
 				$formconfirm .= $more;
5881
-				$formconfirm .= '</td></tr>' . "\n";
5881
+				$formconfirm .= '</td></tr>'."\n";
5882 5882
 			}
5883 5883
 
5884 5884
 			// Line with question
5885 5885
 			$formconfirm .= '<tr class="valid">';
5886
-			$formconfirm .= '<td class="valid">' . $question . '</td>';
5886
+			$formconfirm .= '<td class="valid">'.$question.'</td>';
5887 5887
 			$formconfirm .= '<td class="valid center">';
5888 5888
 			$formconfirm .= $this->selectyesno("confirm", $newselectedchoice, 0, false, 0, 0, 'marginleftonly marginrightonly', $labelbuttonyes, $labelbuttonno);
5889
-			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="' . $langs->trans("Validate") . '">';
5889
+			$formconfirm .= '<input class="button valignmiddle confirmvalidatebutton small" type="submit" value="'.$langs->trans("Validate").'">';
5890 5890
 			$formconfirm .= '</td>';
5891
-			$formconfirm .= '</tr>' . "\n";
5891
+			$formconfirm .= '</tr>'."\n";
5892 5892
 
5893
-			$formconfirm .= '</table>' . "\n";
5893
+			$formconfirm .= '</table>'."\n";
5894 5894
 
5895 5895
 			if (empty($disableformtag)) {
5896 5896
 				$formconfirm .= "</form>\n";
@@ -5899,7 +5899,7 @@  discard block
 block discarded – undo
5899 5899
 
5900 5900
 			if (!empty($conf->use_javascript_ajax)) {
5901 5901
 				$formconfirm .= '<!-- code to disable button to avoid double clic -->';
5902
-				$formconfirm .= '<script nonce="' . getNonce() . '" type="text/javascript">' . "\n";
5902
+				$formconfirm .= '<script nonce="'.getNonce().'" type="text/javascript">'."\n";
5903 5903
 				$formconfirm .= '
5904 5904
 				$(document).ready(function () {
5905 5905
 					$(".confirmvalidatebutton").on("click", function() {
@@ -5911,7 +5911,7 @@  discard block
 block discarded – undo
5911 5911
 					});
5912 5912
 				});
5913 5913
 				';
5914
-				$formconfirm .= '</script>' . "\n";
5914
+				$formconfirm .= '</script>'."\n";
5915 5915
 			}
5916 5916
 
5917 5917
 			$formconfirm .= "<!-- end formconfirm -->\n";
@@ -5943,8 +5943,8 @@  discard block
 block discarded – undo
5943 5943
 		// phpcs:enable
5944 5944
 		global $langs;
5945 5945
 
5946
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
5947
-		require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
5946
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
5947
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
5948 5948
 
5949 5949
 		$out = '';
5950 5950
 
@@ -5952,11 +5952,11 @@  discard block
 block discarded – undo
5952 5952
 
5953 5953
 		$langs->load("project");
5954 5954
 		if ($htmlname != "none") {
5955
-			$out .= '<form method="post" action="' . $page . '">';
5955
+			$out .= '<form method="post" action="'.$page.'">';
5956 5956
 			$out .= '<input type="hidden" name="action" value="classin">';
5957
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
5957
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
5958 5958
 			$out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1, 0, $morecss);
5959
-			$out .= '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
5959
+			$out .= '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
5960 5960
 			$out .= '</form>';
5961 5961
 		} else {
5962 5962
 			$out .= '<span class="project_head_block">';
@@ -5965,7 +5965,7 @@  discard block
 block discarded – undo
5965 5965
 				$projet->fetch($selected);
5966 5966
 				$out .= $projet->getNomUrl(0, '', 1);
5967 5967
 			} else {
5968
-				$out .= '<span class="opacitymedium">' . $textifnoproject . '</span>';
5968
+				$out .= '<span class="opacitymedium">'.$textifnoproject.'</span>';
5969 5969
 			}
5970 5970
 			$out .= '</span>';
5971 5971
 		}
@@ -6002,14 +6002,14 @@  discard block
 block discarded – undo
6002 6002
 		$out = '';
6003 6003
 
6004 6004
 		if ($htmlname != "none") {
6005
-			$out .= '<form method="POST" action="' . $page . '">';
6005
+			$out .= '<form method="POST" action="'.$page.'">';
6006 6006
 			$out .= '<input type="hidden" name="action" value="setconditions">';
6007
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6007
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6008 6008
 			if ($type) {
6009
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6009
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6010 6010
 			}
6011 6011
 			$out .= $this->getSelectConditionsPaiements($selected, $htmlname, $filtertype, $addempty, 0, '', $deposit_percent);
6012
-			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6012
+			$out .= '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
6013 6013
 			$out .= '</form>';
6014 6014
 		} else {
6015 6015
 			if ($selected) {
@@ -6054,12 +6054,12 @@  discard block
 block discarded – undo
6054 6054
 		// phpcs:enable
6055 6055
 		global $langs;
6056 6056
 		if ($htmlname != "none") {
6057
-			print '<form method="post" action="' . $page . '">';
6057
+			print '<form method="post" action="'.$page.'">';
6058 6058
 			print '<input type="hidden" name="action" value="setavailability">';
6059
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6059
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6060 6060
 			$this->selectAvailabilityDelay($selected, $htmlname, '', $addempty);
6061
-			print '<input type="submit" name="modify" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6062
-			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="' . $langs->trans("Cancel") . '">';
6061
+			print '<input type="submit" name="modify" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6062
+			print '<input type="submit" name="cancel" class="button smallpaddingimp" value="'.$langs->trans("Cancel").'">';
6063 6063
 			print '</form>';
6064 6064
 		} else {
6065 6065
 			if ($selected) {
@@ -6085,11 +6085,11 @@  discard block
 block discarded – undo
6085 6085
 	{
6086 6086
 		global $langs;
6087 6087
 		if ($htmlname != "none") {
6088
-			print '<form method="post" action="' . $page . '">';
6088
+			print '<form method="post" action="'.$page.'">';
6089 6089
 			print '<input type="hidden" name="action" value="setdemandreason">';
6090
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6090
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6091 6091
 			$this->selectInputReason($selected, $htmlname, '-1', $addempty);
6092
-			print '<input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '">';
6092
+			print '<input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'">';
6093 6093
 			print '</form>';
6094 6094
 		} else {
6095 6095
 			if ($selected) {
@@ -6129,17 +6129,17 @@  discard block
 block discarded – undo
6129 6129
 		$ret = '';
6130 6130
 
6131 6131
 		if ($htmlname != "none") {
6132
-			$ret .= '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6133
-			$ret .= '<input type="hidden" name="action" value="set' . $htmlname . '">';
6134
-			$ret .= '<input type="hidden" name="token" value="' . newToken() . '">';
6132
+			$ret .= '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6133
+			$ret .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
6134
+			$ret .= '<input type="hidden" name="token" value="'.newToken().'">';
6135 6135
 			if ($type) {
6136
-				$ret .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6136
+				$ret .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6137 6137
 			}
6138 6138
 			$ret .= '<table class="nobordernopadding">';
6139 6139
 			$ret .= '<tr><td>';
6140
-			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form' . $htmlname, 1, 0);
6140
+			$ret .= $this->selectDate($selected, $htmlname, $displayhour, $displaymin, 1, 'form'.$htmlname, 1, 0);
6141 6141
 			$ret .= '</td>';
6142
-			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6142
+			$ret .= '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6143 6143
 			$ret .= '</tr></table></form>';
6144 6144
 		} else {
6145 6145
 			if ($displayhour) {
@@ -6174,15 +6174,15 @@  discard block
 block discarded – undo
6174 6174
 		global $langs;
6175 6175
 
6176 6176
 		if ($htmlname != "none") {
6177
-			print '<form method="POST" action="' . $page . '" name="form' . $htmlname . '">';
6178
-			print '<input type="hidden" name="action" value="set' . $htmlname . '">';
6179
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6177
+			print '<form method="POST" action="'.$page.'" name="form'.$htmlname.'">';
6178
+			print '<input type="hidden" name="action" value="set'.$htmlname.'">';
6179
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6180 6180
 			print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include);
6181
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6181
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6182 6182
 			print '</form>';
6183 6183
 		} else {
6184 6184
 			if ($selected) {
6185
-				require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
6185
+				require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
6186 6186
 				$theuser = new User($this->db);
6187 6187
 				$theuser->fetch($selected);
6188 6188
 				print $theuser->getNomUrl(1);
@@ -6215,14 +6215,14 @@  discard block
 block discarded – undo
6215 6215
 
6216 6216
 		$out = '';
6217 6217
 		if ($htmlname != "none") {
6218
-			$out .= '<form method="POST" action="' . $page . '">';
6218
+			$out .= '<form method="POST" action="'.$page.'">';
6219 6219
 			$out .= '<input type="hidden" name="action" value="setmode">';
6220
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6220
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6221 6221
 			if ($type) {
6222
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6222
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6223 6223
 			}
6224 6224
 			$out .= $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active, '', 1);
6225
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6225
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6226 6226
 			$out .= '</form>';
6227 6227
 		} else {
6228 6228
 			if ($selected) {
@@ -6255,11 +6255,11 @@  discard block
 block discarded – undo
6255 6255
 	{
6256 6256
 		global $langs;
6257 6257
 		if ($htmlname != "none") {
6258
-			print '<form method="POST" action="' . $page . '">';
6258
+			print '<form method="POST" action="'.$page.'">';
6259 6259
 			print '<input type="hidden" name="action" value="settransportmode">';
6260
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6260
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6261 6261
 			$this->selectTransportMode($selected, $htmlname, 0, $addempty, 0, 0, $active);
6262
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6262
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6263 6263
 			print '</form>';
6264 6264
 		} else {
6265 6265
 			if ($selected) {
@@ -6286,14 +6286,14 @@  discard block
 block discarded – undo
6286 6286
 		// phpcs:enable
6287 6287
 		global $langs;
6288 6288
 		if ($htmlname != "none") {
6289
-			print '<form method="POST" action="' . $page . '">';
6289
+			print '<form method="POST" action="'.$page.'">';
6290 6290
 			print '<input type="hidden" name="action" value="setmulticurrencycode">';
6291
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6291
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6292 6292
 			print $this->selectMultiCurrency($selected, $htmlname, 0);
6293
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6293
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6294 6294
 			print '</form>';
6295 6295
 		} else {
6296
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6296
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6297 6297
 			print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
6298 6298
 		}
6299 6299
 	}
@@ -6315,22 +6315,22 @@  discard block
 block discarded – undo
6315 6315
 		global $langs, $mysoc, $conf;
6316 6316
 
6317 6317
 		if ($htmlname != "none") {
6318
-			print '<form method="POST" action="' . $page . '">';
6318
+			print '<form method="POST" action="'.$page.'">';
6319 6319
 			print '<input type="hidden" name="action" value="setmulticurrencyrate">';
6320
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6321
-			print '<input type="text" class="maxwidth75" name="' . $htmlname . '" value="' . (!empty($rate) ? price(price2num($rate, 'CU')) : 1) . '" /> ';
6320
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6321
+			print '<input type="text" class="maxwidth75" name="'.$htmlname.'" value="'.(!empty($rate) ? price(price2num($rate, 'CU')) : 1).'" /> ';
6322 6322
 			print '<select name="calculation_mode" id="calculation_mode">';
6323
-			print '<option value="1">Change ' . $langs->trans("PriceUHT") . ' of lines</option>';
6324
-			print '<option value="2">Change ' . $langs->trans("PriceUHTCurrency") . ' of lines</option>';
6323
+			print '<option value="1">Change '.$langs->trans("PriceUHT").' of lines</option>';
6324
+			print '<option value="2">Change '.$langs->trans("PriceUHTCurrency").' of lines</option>';
6325 6325
 			print '</select> ';
6326 6326
 			print ajax_combobox("calculation_mode");
6327
-			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6327
+			print '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6328 6328
 			print '</form>';
6329 6329
 		} else {
6330 6330
 			if (!empty($rate)) {
6331 6331
 				print price($rate, 1, $langs, 0, 0);
6332 6332
 				if ($currency && $rate != 1) {
6333
-					print ' &nbsp; <span class="opacitymedium">(' . price($rate, 1, $langs, 0, 0) . ' ' . $currency . ' = 1 ' . $conf->currency . ')</span>';
6333
+					print ' &nbsp; <span class="opacitymedium">('.price($rate, 1, $langs, 0, 0).' '.$currency.' = 1 '.$conf->currency.')</span>';
6334 6334
 				}
6335 6335
 			} else {
6336 6336
 				print 1;
@@ -6353,9 +6353,9 @@  discard block
 block discarded – undo
6353 6353
 	{
6354 6354
 		$out = '';
6355 6355
 		if ($htmlname != "none") {
6356
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6356
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6357 6357
 			if ($type) {
6358
-				$out .= '<input type="hidden" name="type" value="' . dol_escape_htmltag($type) . '">';
6358
+				$out .= '<input type="hidden" name="type" value="'.dol_escape_htmltag($type).'">';
6359 6359
 			}
6360 6360
 			$out .= $this->selectTypesIban($selected, $htmlname, $addempty, '', 1, $ribForSelection);
6361 6361
 		} else {
@@ -6395,9 +6395,9 @@  discard block
 block discarded – undo
6395 6395
 		// phpcs:enable
6396 6396
 		global $conf, $langs;
6397 6397
 		if ($htmlname != "none") {
6398
-			print '<form method="post" action="' . $page . '">';
6398
+			print '<form method="post" action="'.$page.'">';
6399 6399
 			print '<input type="hidden" name="action" value="setabsolutediscount">';
6400
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6400
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6401 6401
 			print '<div class="inline-block">';
6402 6402
 			if (!empty($discount_type)) {
6403 6403
 				if (getDolGlobalString('FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS')) {
@@ -6435,24 +6435,24 @@  discard block
 block discarded – undo
6435 6435
 			print '</div>';
6436 6436
 			if (empty($hidelist)) {
6437 6437
 				print '<div class="inline-block" style="padding-right: 10px">';
6438
-				$newfilter = 'discount_type=' . intval($discount_type);
6438
+				$newfilter = 'discount_type='.intval($discount_type);
6439 6439
 				if (!empty($discount_type)) {
6440 6440
 					$newfilter .= ' AND fk_invoice_supplier IS NULL AND fk_invoice_supplier_line IS NULL'; // Supplier discounts available
6441 6441
 				} else {
6442 6442
 					$newfilter .= ' AND fk_facture IS NULL AND fk_facture_line IS NULL'; // Customer discounts available
6443 6443
 				}
6444 6444
 				if ($filter) {
6445
-					$newfilter .= ' AND (' . $filter . ')';
6445
+					$newfilter .= ' AND ('.$filter.')';
6446 6446
 				}
6447 6447
 				// output the combo of discounts
6448 6448
 				$nbqualifiedlines = $this->select_remises((string) $selected, $htmlname, $newfilter, $socid, $maxvalue);
6449 6449
 				if ($nbqualifiedlines > 0) {
6450
-					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="' . dol_escape_htmltag($langs->trans("UseLine")) . '"';
6450
+					print ' &nbsp; <input type="submit" class="button smallpaddingimp" value="'.dol_escape_htmltag($langs->trans("UseLine")).'"';
6451 6451
 					if (!empty($discount_type) && $filter && $filter != "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") {
6452
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6452
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6453 6453
 					}
6454 6454
 					if (empty($discount_type) && $filter && $filter != "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") {
6455
-						print ' title="' . $langs->trans("UseCreditNoteInInvoicePayment") . '"';
6455
+						print ' title="'.$langs->trans("UseCreditNoteInInvoicePayment").'"';
6456 6456
 					}
6457 6457
 
6458 6458
 					print '>';
@@ -6492,23 +6492,23 @@  discard block
 block discarded – undo
6492 6492
 		global $langs;
6493 6493
 
6494 6494
 		if ($htmlname != "none") {
6495
-			print '<form method="post" action="' . $page . '">';
6495
+			print '<form method="post" action="'.$page.'">';
6496 6496
 			print '<input type="hidden" name="action" value="set_contact">';
6497
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
6497
+			print '<input type="hidden" name="token" value="'.newToken().'">';
6498 6498
 			print '<table class="nobordernopadding">';
6499 6499
 			print '<tr><td>';
6500 6500
 			print $this->selectcontacts($societe->id, $selected, $htmlname);
6501 6501
 			$num = $this->num;
6502 6502
 			if ($num == 0) {
6503 6503
 				$addcontact = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
6504
-				print '<a href="' . DOL_URL_ROOT . '/contact/card.php?socid=' . $societe->id . '&amp;action=create&amp;backtoreferer=1">' . $addcontact . '</a>';
6504
+				print '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$societe->id.'&amp;action=create&amp;backtoreferer=1">'.$addcontact.'</a>';
6505 6505
 			}
6506 6506
 			print '</td>';
6507
-			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="' . $langs->trans("Modify") . '"></td>';
6507
+			print '<td class="left"><input type="submit" class="button smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
6508 6508
 			print '</tr></table></form>';
6509 6509
 		} else {
6510 6510
 			if ($selected) {
6511
-				require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
6511
+				require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
6512 6512
 				$contact = new Contact($this->db);
6513 6513
 				$contact->fetch($selected);
6514 6514
 				print $contact->getFullName($langs);
@@ -6543,20 +6543,20 @@  discard block
 block discarded – undo
6543 6543
 
6544 6544
 		$out = '';
6545 6545
 		if ($htmlname != "none") {
6546
-			$out .= '<form method="post" action="' . $page . '">';
6546
+			$out .= '<form method="post" action="'.$page.'">';
6547 6547
 			$out .= '<input type="hidden" name="action" value="set_thirdparty">';
6548
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
6548
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
6549 6549
 			$out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, 0, 'minwidth100', '', '', 1, array(), false, $excludeids);
6550
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
6550
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
6551 6551
 			$out .= '</form>';
6552 6552
 		} else {
6553 6553
 			if ($selected) {
6554
-				require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
6554
+				require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
6555 6555
 				$soc = new Societe($this->db);
6556 6556
 				$soc->fetch($selected);
6557 6557
 				$out .= $soc->getNomUrl(0, '');
6558 6558
 			} else {
6559
-				$out .= '<span class="opacitymedium">' . $textifnothirdparty . '</span>';
6559
+				$out .= '<span class="opacitymedium">'.$textifnothirdparty.'</span>';
6560 6560
 			}
6561 6561
 		}
6562 6562
 
@@ -6606,22 +6606,22 @@  discard block
 block discarded – undo
6606 6606
 			$selected = 'EUR'; // Pour compatibilite
6607 6607
 		}
6608 6608
 
6609
-		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="' . $htmlname . '" id="' . $htmlname . '">';
6609
+		$out .= '<select class="flat maxwidth200onsmartphone minwidth300" name="'.$htmlname.'" id="'.$htmlname.'">';
6610 6610
 		if ($useempty) {
6611 6611
 			$out .= '<option value="-1" selected></option>';
6612 6612
 		}
6613 6613
 		foreach ($langs->cache_currencies as $code_iso => $currency) {
6614 6614
 			$labeltoshow = $currency['label'];
6615 6615
 			if ($mode == 1) {
6616
-				$labeltoshow .= ' <span class="opacitymedium">(' . $code_iso . ')</span>';
6616
+				$labeltoshow .= ' <span class="opacitymedium">('.$code_iso.')</span>';
6617 6617
 			} else {
6618
-				$labeltoshow .= ' <span class="opacitymedium">(' . $langs->getCurrencySymbol($code_iso) . ')</span>';
6618
+				$labeltoshow .= ' <span class="opacitymedium">('.$langs->getCurrencySymbol($code_iso).')</span>';
6619 6619
 			}
6620 6620
 
6621 6621
 			if ($selected && $selected == $code_iso) {
6622
-				$out .= '<option value="' . $code_iso . '" selected data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6622
+				$out .= '<option value="'.$code_iso.'" selected data-html="'.dol_escape_htmltag($labeltoshow).'">';
6623 6623
 			} else {
6624
-				$out .= '<option value="' . $code_iso . '" data-html="' . dol_escape_htmltag($labeltoshow) . '">';
6624
+				$out .= '<option value="'.$code_iso.'" data-html="'.dol_escape_htmltag($labeltoshow).'">';
6625 6625
 			}
6626 6626
 			$out .= $labeltoshow;
6627 6627
 			$out .= '</option>';
@@ -6632,7 +6632,7 @@  discard block
 block discarded – undo
6632 6632
 		}
6633 6633
 
6634 6634
 		// Make select dynamic
6635
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6635
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6636 6636
 		$out .= ajax_combobox($htmlname);
6637 6637
 
6638 6638
 		return $out;
@@ -6658,10 +6658,10 @@  discard block
 block discarded – undo
6658 6658
 
6659 6659
 		$TCurrency = array();
6660 6660
 
6661
-		$sql = "SELECT code FROM " . $this->db->prefix() . "multicurrency";
6662
-		$sql .= " WHERE entity IN ('" . getEntity('mutlicurrency') . "')";
6661
+		$sql = "SELECT code FROM ".$this->db->prefix()."multicurrency";
6662
+		$sql .= " WHERE entity IN ('".getEntity('mutlicurrency')."')";
6663 6663
 		if ($filter) {
6664
-			$sql .= " AND " . $filter;
6664
+			$sql .= " AND ".$filter;
6665 6665
 		}
6666 6666
 		$resql = $this->db->query($sql);
6667 6667
 		if ($resql) {
@@ -6671,7 +6671,7 @@  discard block
 block discarded – undo
6671 6671
 		}
6672 6672
 
6673 6673
 		$out = '';
6674
-		$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
6674
+		$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
6675 6675
 		if ($useempty) {
6676 6676
 			$out .= '<option value="">&nbsp;</option>';
6677 6677
 		}
@@ -6683,13 +6683,13 @@  discard block
 block discarded – undo
6683 6683
 			foreach ($langs->cache_currencies as $code_iso => $currency) {
6684 6684
 				if (isset($TCurrency[$code_iso])) {
6685 6685
 					if (!empty($selected) && $selected == $code_iso) {
6686
-						$out .= '<option value="' . $code_iso . '" selected="selected">';
6686
+						$out .= '<option value="'.$code_iso.'" selected="selected">';
6687 6687
 					} else {
6688
-						$out .= '<option value="' . $code_iso . '">';
6688
+						$out .= '<option value="'.$code_iso.'">';
6689 6689
 					}
6690 6690
 
6691 6691
 					$out .= $currency['label'];
6692
-					$out .= ' (' . $langs->getCurrencySymbol($code_iso) . ')';
6692
+					$out .= ' ('.$langs->getCurrencySymbol($code_iso).')';
6693 6693
 					$out .= '</option>';
6694 6694
 				}
6695 6695
 			}
@@ -6698,7 +6698,7 @@  discard block
 block discarded – undo
6698 6698
 		$out .= '</select>';
6699 6699
 
6700 6700
 		// Make select dynamic
6701
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
6701
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
6702 6702
 		$out .= ajax_combobox($htmlname);
6703 6703
 
6704 6704
 		return $out;
@@ -6729,7 +6729,7 @@  discard block
 block discarded – undo
6729 6729
 		$sql .= " WHERE t.fk_pays = c.rowid";
6730 6730
 		$sql .= " AND t.active > 0";
6731 6731
 		$sql .= " AND t.entity IN (".getEntity('c_tva').")";
6732
-		$sql .= " AND c.code IN (" . $this->db->sanitize($country_code, 1) . ")";
6732
+		$sql .= " AND c.code IN (".$this->db->sanitize($country_code, 1).")";
6733 6733
 		$sql .= " ORDER BY t.code ASC, t.taux ASC, t.recuperableonly ASC";
6734 6734
 
6735 6735
 		$resql = $this->db->query($sql);
@@ -6741,30 +6741,30 @@  discard block
 block discarded – undo
6741 6741
 
6742 6742
 					$tmparray = array();
6743 6743
 					$tmparray['rowid']			= $obj->rowid;
6744
-					$tmparray['type_vat']		= $obj->type_vat;
6745
-					$tmparray['code']			= $obj->code;
6744
+					$tmparray['type_vat'] = $obj->type_vat;
6745
+					$tmparray['code'] = $obj->code;
6746 6746
 					$tmparray['txtva']			= $obj->taux;
6747
-					$tmparray['nprtva']			= $obj->recuperableonly;
6747
+					$tmparray['nprtva'] = $obj->recuperableonly;
6748 6748
 					$tmparray['localtax1']	    = $obj->localtax1;
6749 6749
 					$tmparray['localtax1_type']	= $obj->localtax1_type;
6750 6750
 					$tmparray['localtax2']	    = $obj->localtax2;
6751 6751
 					$tmparray['localtax2_type']	= $obj->localtax1_type;
6752
-					$tmparray['label']			= $obj->taux . '%' . ($obj->code ? ' (' . $obj->code . ')' : ''); // Label must contains only 0-9 , . % or *
6753
-					$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
6752
+					$tmparray['label'] = $obj->taux.'%'.($obj->code ? ' ('.$obj->code.')' : ''); // Label must contains only 0-9 , . % or *
6753
+					$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
6754 6754
 					$positiverates = '';
6755 6755
 					if ($obj->taux) {
6756
-						$positiverates .= ($positiverates ? '/' : '') . $obj->taux;
6756
+						$positiverates .= ($positiverates ? '/' : '').$obj->taux;
6757 6757
 					}
6758 6758
 					if ($obj->localtax1) {
6759
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax1;
6759
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax1;
6760 6760
 					}
6761 6761
 					if ($obj->localtax2) {
6762
-						$positiverates .= ($positiverates ? '/' : '') . $obj->localtax2;
6762
+						$positiverates .= ($positiverates ? '/' : '').$obj->localtax2;
6763 6763
 					}
6764 6764
 					if (empty($positiverates)) {
6765 6765
 						$positiverates = '0';
6766 6766
 					}
6767
-					$tmparray['labelpositiverates'] = $positiverates . ($obj->code ? ' (' . $obj->code . ')' : ''); // Must never be used as key, only label
6767
+					$tmparray['labelpositiverates'] = $positiverates.($obj->code ? ' ('.$obj->code.')' : ''); // Must never be used as key, only label
6768 6768
 
6769 6769
 					$this->cache_vatrates[$obj->rowid] = $tmparray;
6770 6770
 				}
@@ -6784,7 +6784,7 @@  discard block
 block discarded – undo
6784 6784
 				return -1;
6785 6785
 			}
6786 6786
 		} else {
6787
-			$this->error = '<span class="error">' . $this->db->error() . '</span>';
6787
+			$this->error = '<span class="error">'.$this->db->error().'</span>';
6788 6788
 			return -2;
6789 6789
 		}
6790 6790
 	}
@@ -6837,9 +6837,9 @@  discard block
 block discarded – undo
6837 6837
 		// Check parameters
6838 6838
 		if (is_object($societe_vendeuse) && !$societe_vendeuse->country_code) {
6839 6839
 			if ($societe_vendeuse->id == $mysoc->id) {
6840
-				$return .= '<span class="error">' . $langs->trans("ErrorYourCountryIsNotDefined") . '</span>';
6840
+				$return .= '<span class="error">'.$langs->trans("ErrorYourCountryIsNotDefined").'</span>';
6841 6841
 			} else {
6842
-				$return .= '<span class="error">' . $langs->trans("ErrorSupplierCountryIsNotDefined") . '</span>';
6842
+				$return .= '<span class="error">'.$langs->trans("ErrorSupplierCountryIsNotDefined").'</span>';
6843 6843
 			}
6844 6844
 			return $return;
6845 6845
 		}
@@ -6851,12 +6851,12 @@  discard block
 block discarded – undo
6851 6851
 		// Define list of countries to use to search VAT rates to show
6852 6852
 		// First we defined code_country to use to find list
6853 6853
 		if (is_object($societe_vendeuse)) {
6854
-			$code_country = "'" . $societe_vendeuse->country_code . "'";
6854
+			$code_country = "'".$societe_vendeuse->country_code."'";
6855 6855
 		} else {
6856
-			$code_country = "'" . $mysoc->country_code . "'"; // Pour compatibilite ascendente
6856
+			$code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente
6857 6857
 		}
6858 6858
 		if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) {    // If option to have vat for end customer for services is on
6859
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
6859
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
6860 6860
 			// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
6861 6861
 			// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
6862 6862
 			$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
@@ -6866,27 +6866,27 @@  discard block
 block discarded – undo
6866 6866
 					if ($type == 1) { // We know product is a service
6867 6867
 						switch ($selectVatComboMode) {
6868 6868
 							case '1':
6869
-								$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6869
+								$code_country .= ",'".$societe_acheteuse->country_code."'";
6870 6870
 								break;
6871 6871
 							case '2':
6872
-								$code_country = "'" . $societe_acheteuse->country_code . "'";
6872
+								$code_country = "'".$societe_acheteuse->country_code."'";
6873 6873
 								break;
6874 6874
 						}
6875 6875
 					}
6876 6876
 				} elseif (!$idprod) {  // We don't know type of product
6877 6877
 					switch ($selectVatComboMode) {
6878 6878
 						case '1':
6879
-							$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6879
+							$code_country .= ",'".$societe_acheteuse->country_code."'";
6880 6880
 							break;
6881 6881
 						case '2':
6882
-							$code_country = "'" . $societe_acheteuse->country_code . "'";
6882
+							$code_country = "'".$societe_acheteuse->country_code."'";
6883 6883
 							break;
6884 6884
 					}
6885 6885
 				} else {
6886 6886
 					$prodstatic = new Product($this->db);
6887 6887
 					$prodstatic->fetch($idprod);
6888 6888
 					if ($prodstatic->type == Product::TYPE_SERVICE) {   // We know product is a service
6889
-						$code_country .= ",'" . $societe_acheteuse->country_code . "'";
6889
+						$code_country .= ",'".$societe_acheteuse->country_code."'";
6890 6890
 					}
6891 6891
 				}
6892 6892
 			}
@@ -6948,13 +6948,13 @@  discard block
 block discarded – undo
6948 6948
 				// Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead
6949 6949
 				// of using supplier invoices (this is a very bad idea !)
6950 6950
 				if (!getDolGlobalString('EXPENSEREPORT_OVERRIDE_VAT')) {
6951
-					$title = ' title="' . dol_escape_htmltag($langs->trans('VATIsNotUsed')) . '"';
6951
+					$title = ' title="'.dol_escape_htmltag($langs->trans('VATIsNotUsed')).'"';
6952 6952
 					$disabled = true;
6953 6953
 				}
6954 6954
 			}
6955 6955
 
6956 6956
 			if (!$options_only) {
6957
-				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="' . $htmlname . '" name="' . $htmlname . '"' . ($disabled ? ' disabled' : '') . $title . '>';
6957
+				$return .= '<select class="flat minwidth75imp maxwidth100 right" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled ? ' disabled' : '').$title.'>';
6958 6958
 			}
6959 6959
 
6960 6960
 			$selectedfound = false;
@@ -6968,13 +6968,13 @@  discard block
 block discarded – undo
6968 6968
 				$key = $rate['txtva'];
6969 6969
 				$key .= $rate['nprtva'] ? '*' : '';
6970 6970
 				if ($mode > 0 && $rate['code']) {
6971
-					$key .= ' (' . $rate['code'] . ')';
6971
+					$key .= ' ('.$rate['code'].')';
6972 6972
 				}
6973 6973
 				if ($mode < 0) {
6974 6974
 					$key = $rate['rowid'];
6975 6975
 				}
6976 6976
 
6977
-				$return .= '<option value="' . $key . '"';
6977
+				$return .= '<option value="'.$key.'"';
6978 6978
 				if (!$selectedfound) {
6979 6979
 					if ($defaultcode) { // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
6980 6980
 						if ($defaultcode == $rate['code']) {
@@ -7045,7 +7045,7 @@  discard block
 block discarded – undo
7045 7045
 	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 = '')
7046 7046
 	{
7047 7047
 		// phpcs:enable
7048
-		dol_syslog(__METHOD__ . ': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7048
+		dol_syslog(__METHOD__.': using select_date is deprecated. Use selectDate instead.', LOG_WARNING);
7049 7049
 		$retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof);
7050 7050
 		if (!empty($nooutput)) {
7051 7051
 			return $retstring;
@@ -7074,11 +7074,11 @@  discard block
 block discarded – undo
7074 7074
 	{
7075 7075
 		global $langs;
7076 7076
 
7077
-		$ret = $this->selectDate($set_time, $prefix . '_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7077
+		$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
7078 7078
 		if ($forcenewline) {
7079 7079
 			$ret .= '<br>';
7080 7080
 		}
7081
-		$ret .= $this->selectDate($set_time_end, $prefix . '_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7081
+		$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
7082 7082
 		return $ret;
7083 7083
 	}
7084 7084
 
@@ -7144,7 +7144,7 @@  discard block
 block discarded – undo
7144 7144
 		$orig_set_time = $set_time;
7145 7145
 
7146 7146
 		if ($set_time === '' && $emptydate == 0) {
7147
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7147
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7148 7148
 			if ($gm == 'tzuser' || $gm == 'tzuserrel') {
7149 7149
 				$set_time = dol_now($gm);
7150 7150
 			} else {
@@ -7216,38 +7216,38 @@  discard block
 block discarded – undo
7216 7216
 				// Calendrier popup version eldy
7217 7217
 				if ($usecalendar == "eldy") {
7218 7218
 					// Input area to enter date manually
7219
-					$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
7219
+					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7220 7220
 					$retstring .= ($disabled ? ' disabled' : '');
7221
-					$retstring .= ' onChange="dpChangeDay(\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7221
+					$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7222 7222
 					$retstring .= ' autocomplete="off">';
7223 7223
 
7224 7224
 					// Icon calendar
7225 7225
 					$retstringbuttom = '';
7226 7226
 					if (!$disabled) {
7227
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons"';
7228
-						$base = DOL_URL_ROOT . '/core/';
7229
-						$retstringbuttom .= ' onClick="showDP(\'' . $base . '\',\'' . $prefix . '\',\'' . $langs->trans("FormatDateShortJavaInput") . '\',\'' . $langs->defaultlang . '\');"';
7230
-						$retstringbuttom .= '>' . img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"') . '</button>';
7227
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
7228
+						$base = DOL_URL_ROOT.'/core/';
7229
+						$retstringbuttom .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"';
7230
+						$retstringbuttom .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').'</button>';
7231 7231
 					} else {
7232
-						$retstringbuttom = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7232
+						$retstringbuttom = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7233 7233
 					}
7234
-					$retstring = $retstringbuttom . $retstring;
7234
+					$retstring = $retstringbuttom.$retstring;
7235 7235
 
7236
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7237
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7238
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7236
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7237
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7238
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7239 7239
 				} elseif ($usecalendar == 'jquery' || $usecalendar == 'html') {
7240 7240
 					if (!$disabled && $usecalendar != 'html') {
7241 7241
 						// Output javascript for datepicker
7242 7242
 						$minYear = getDolGlobalInt('MIN_YEAR_SELECT_DATE', (idate('Y') - 100));
7243 7243
 						$maxYear = getDolGlobalInt('MAX_YEAR_SELECT_DATE', (idate('Y') + 100));
7244 7244
 
7245
-						$retstring .= '<script nonce="' . getNonce() . '" type="text/javascript">';
7246
-						$retstring .= "$(function(){ $('#" . $prefix . "').datepicker({
7247
-							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput") . "',
7245
+						$retstring .= '<script nonce="'.getNonce().'" type="text/javascript">';
7246
+						$retstring .= "$(function(){ $('#".$prefix."').datepicker({
7247
+							dateFormat: '" . $langs->trans("FormatDateShortJQueryInput")."',
7248 7248
 							autoclose: true,
7249 7249
 							todayHighlight: true,
7250
-							yearRange: '" . $minYear . ":" . $maxYear . "',";
7250
+							yearRange: '" . $minYear.":".$maxYear."',";
7251 7251
 						if (!empty($conf->dol_use_jmobile)) {
7252 7252
 							$retstring .= "
7253 7253
 								beforeShow: function (input, datePicker) {
@@ -7262,7 +7262,7 @@  discard block
 block discarded – undo
7262 7262
 						if (!getDolGlobalString('MAIN_POPUP_CALENDAR_ON_FOCUS')) {
7263 7263
 							$retstring .= "
7264 7264
 								showOn: 'button',	/* both has problem with autocompletion */
7265
-								buttonImage: '" . DOL_URL_ROOT . "/theme/" . dol_escape_js($conf->theme) . "/img/object_calendarday.png',
7265
+								buttonImage: '" . DOL_URL_ROOT."/theme/".dol_escape_js($conf->theme)."/img/object_calendarday.png',
7266 7266
 								buttonImageOnly: true";
7267 7267
 						}
7268 7268
 						$retstring .= "
@@ -7274,46 +7274,46 @@  discard block
 block discarded – undo
7274 7274
 					$retstring .= '<div class="nowraponall inline-block divfordateinput">';
7275 7275
 					$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
7276 7276
 					$retstring .= ($disabled ? ' disabled' : '');
7277
-					$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
7278
-					$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7277
+					$retstring .= ($placeholder ? ' placeholder="'.dol_escape_htmltag($placeholder).'"' : '');
7278
+					$retstring .= ' onChange="dpChangeDay(\''.dol_escape_js($prefix).'\',\''.dol_escape_js($langs->trans("FormatDateShortJavaInput")).'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
7279 7279
 					$retstring .= ' autocomplete="off">';
7280 7280
 
7281 7281
 					// Icone calendrier
7282 7282
 					if ($disabled) {
7283
-						$retstringbutton = '<button id="' . $prefix . 'Button" type="button" class="dpInvisibleButtons">' . img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"') . '</button>';
7284
-						$retstring = $retstringbutton . $retstring;
7283
+						$retstringbutton = '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons">'.img_object($langs->trans("Disabled"), 'calendarday', 'class="datecallink"').'</button>';
7284
+						$retstring = $retstringbutton.$retstring;
7285 7285
 					}
7286 7286
 
7287 7287
 					$retstring .= '</div>';
7288
-					$retstring .= '<input type="hidden" id="' . $prefix . 'day"   name="' . $prefix . 'day"   value="' . $sday . '">' . "\n";
7289
-					$retstring .= '<input type="hidden" id="' . $prefix . 'month" name="' . $prefix . 'month" value="' . $smonth . '">' . "\n";
7290
-					$retstring .= '<input type="hidden" id="' . $prefix . 'year"  name="' . $prefix . 'year"  value="' . $syear . '">' . "\n";
7288
+					$retstring .= '<input type="hidden" id="'.$prefix.'day"   name="'.$prefix.'day"   value="'.$sday.'">'."\n";
7289
+					$retstring .= '<input type="hidden" id="'.$prefix.'month" name="'.$prefix.'month" value="'.$smonth.'">'."\n";
7290
+					$retstring .= '<input type="hidden" id="'.$prefix.'year"  name="'.$prefix.'year"  value="'.$syear.'">'."\n";
7291 7291
 				} else {
7292 7292
 					$retstring .= "Bad value of MAIN_POPUP_CALENDAR";
7293 7293
 				}
7294 7294
 			} else {
7295 7295
 				// Show date with combo selects
7296 7296
 				// Day
7297
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50imp" id="' . $prefix . 'day" name="' . $prefix . 'day">';
7297
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50imp" id="'.$prefix.'day" name="'.$prefix.'day">';
7298 7298
 
7299 7299
 				if ($emptydate || $set_time == -1) {
7300 7300
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7301 7301
 				}
7302 7302
 
7303 7303
 				for ($day = 1; $day <= 31; $day++) {
7304
-					$retstring .= '<option value="' . $day . '"' . ($day == $sday ? ' selected' : '') . '>' . $day . '</option>';
7304
+					$retstring .= '<option value="'.$day.'"'.($day == $sday ? ' selected' : '').'>'.$day.'</option>';
7305 7305
 				}
7306 7306
 
7307 7307
 				$retstring .= "</select>";
7308 7308
 
7309
-				$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'month" name="' . $prefix . 'month">';
7309
+				$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'month" name="'.$prefix.'month">';
7310 7310
 				if ($emptydate || $set_time == -1) {
7311 7311
 					$retstring .= '<option value="0" selected>&nbsp;</option>';
7312 7312
 				}
7313 7313
 
7314 7314
 				// Month
7315 7315
 				for ($month = 1; $month <= 12; $month++) {
7316
-					$retstring .= '<option value="' . $month . '"' . ($month == $smonth ? ' selected' : '') . '>';
7316
+					$retstring .= '<option value="'.$month.'"'.($month == $smonth ? ' selected' : '').'>';
7317 7317
 					$retstring .= dol_print_date(mktime(12, 0, 0, $month, 1, 2000), "%b");
7318 7318
 					$retstring .= "</option>";
7319 7319
 				}
@@ -7321,13 +7321,13 @@  discard block
 block discarded – undo
7321 7321
 
7322 7322
 				// Year
7323 7323
 				if ($emptydate || $set_time == -1) {
7324
-					$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 . '">';
7324
+					$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.'">';
7325 7325
 				} else {
7326
-					$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth75imp" id="' . $prefix . 'year" name="' . $prefix . 'year">';
7326
+					$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth75imp" id="'.$prefix.'year" name="'.$prefix.'year">';
7327 7327
 
7328 7328
 					$syear = (int) $syear;
7329 7329
 					for ($year = $syear - 10; $year < (int) $syear + 10; $year++) {
7330
-						$retstring .= '<option value="' . $year . '"' . ($year == $syear ? ' selected' : '') . '>' . $year . '</option>';
7330
+						$retstring .= '<option value="'.$year.'"'.($year == $syear ? ' selected' : '').'>'.$year.'</option>';
7331 7331
 					}
7332 7332
 					$retstring .= "</select>\n";
7333 7333
 				}
@@ -7351,15 +7351,15 @@  discard block
 block discarded – undo
7351 7351
 				}
7352 7352
 			}
7353 7353
 			// Show hour
7354
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'hour' : '') . '" id="' . $prefix . 'hour" name="' . $prefix . 'hour">';
7354
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'hour' : '').'" id="'.$prefix.'hour" name="'.$prefix.'hour">';
7355 7355
 			if ($emptyhours) {
7356 7356
 				$retstring .= '<option value="-1">&nbsp;</option>';
7357 7357
 			}
7358 7358
 			for ($hour = $hourstart; $hour < $hourend; $hour++) {
7359 7359
 				if (strlen($hour) < 2) {
7360
-					$hour = "0" . $hour;
7360
+					$hour = "0".$hour;
7361 7361
 				}
7362
-				$retstring .= '<option value="' . $hour . '"' . (($hour == $shour) ? ' selected' : '') . '>' . $hour;
7362
+				$retstring .= '<option value="'.$hour.'"'.(($hour == $shour) ? ' selected' : '').'>'.$hour;
7363 7363
 				//$retstring .= (empty($conf->dol_optimize_smallscreen) ? '' : 'H');
7364 7364
 				$retstring .= '</option>';
7365 7365
 			}
@@ -7372,17 +7372,17 @@  discard block
 block discarded – undo
7372 7372
 
7373 7373
 		if ($m) {
7374 7374
 			// Show minutes
7375
-			$retstring .= '<select' . ($disabled ? ' disabled' : '') . ' class="flat valignmiddle maxwidth50 ' . ($fullday ? $fullday . 'min' : '') . '" id="' . $prefix . 'min" name="' . $prefix . 'min">';
7375
+			$retstring .= '<select'.($disabled ? ' disabled' : '').' class="flat valignmiddle maxwidth50 '.($fullday ? $fullday.'min' : '').'" id="'.$prefix.'min" name="'.$prefix.'min">';
7376 7376
 			if ($emptyhours) {
7377 7377
 				$retstring .= '<option value="-1">&nbsp;</option>';
7378 7378
 			}
7379 7379
 			for ($min = 0; $min < 60; $min += $stepminutes) {
7380 7380
 				$min_str = sprintf("%02d", $min);
7381
-				$retstring .= '<option value="' . $min_str . '"' . (($min_str == $smin) ? ' selected' : '') . '>' . $min_str . '</option>';
7381
+				$retstring .= '<option value="'.$min_str.'"'.(($min_str == $smin) ? ' selected' : '').'>'.$min_str.'</option>';
7382 7382
 			}
7383 7383
 			$retstring .= '</select>';
7384 7384
 
7385
-			$retstring .= '<input type="hidden" name="' . $prefix . 'sec" value="' . $ssec . '">';
7385
+			$retstring .= '<input type="hidden" name="'.$prefix.'sec" value="'.$ssec.'">';
7386 7386
 		}
7387 7387
 
7388 7388
 		if ($d && $h) {
@@ -7405,10 +7405,10 @@  discard block
 block discarded – undo
7405 7405
 
7406 7406
 			// Generate the date part, depending on the use or not of the javascript calendar
7407 7407
 			if ($addnowlink == 1) { // server time expressed in user time setup
7408
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7409
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7410
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7411
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7408
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7409
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7410
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7411
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7412 7412
 			} elseif ($addnowlink == 2) {
7413 7413
 				/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
7414 7414
 				 * This break application for foreign languages.
@@ -7417,10 +7417,10 @@  discard block
 block discarded – undo
7417 7417
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
7418 7418
 				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
7419 7419
 				*/
7420
-				$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'day', 'tzuserrel') . '\');';
7421
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7422
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7423
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7420
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
7421
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7422
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7423
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7424 7424
 			}
7425 7425
 			/*if ($usecalendar == "eldy")
7426 7426
 			{
@@ -7440,11 +7440,11 @@  discard block
 block discarded – undo
7440 7440
 				}
7441 7441
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
7442 7442
 				if ($addnowlink == 1) {
7443
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7444
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7443
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7444
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7445 7445
 				} elseif ($addnowlink == 2) {
7446
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(d.getHours().pad());';
7447
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').change();';
7446
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());';
7447
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
7448 7448
 				}
7449 7449
 
7450 7450
 				if ($fullday) {
@@ -7458,11 +7458,11 @@  discard block
 block discarded – undo
7458 7458
 				}
7459 7459
 				//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
7460 7460
 				if ($addnowlink == 1) {
7461
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7462
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7461
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7462
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7463 7463
 				} elseif ($addnowlink == 2) {
7464
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(d.getMinutes().pad());';
7465
-					$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').change();';
7464
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());';
7465
+					$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
7466 7466
 				}
7467 7467
 				if ($fullday) {
7468 7468
 					$reset_scripts .= ' } ';
@@ -7470,7 +7470,7 @@  discard block
 block discarded – undo
7470 7470
 			}
7471 7471
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7472 7472
 			if ($reset_scripts && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
7473
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonNow" type="button" name="_useless" value="now" onClick="' . $reset_scripts . '">';
7473
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonNow" type="button" name="_useless" value="now" onClick="'.$reset_scripts.'">';
7474 7474
 				$retstring .= $langs->trans("Now");
7475 7475
 				$retstring .= '</button> ';
7476 7476
 			}
@@ -7482,16 +7482,16 @@  discard block
 block discarded – undo
7482 7482
 			$reset_scripts = "";
7483 7483
 
7484 7484
 			// Generate the date part, depending on the use or not of the javascript calendar
7485
-			$reset_scripts .= 'jQuery(\'#' . $prefix . '\').val(\'' . dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel') . '\');';
7486
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'day\').val(\'' . dol_print_date($nowgmt, '%d', 'tzuserrel') . '\');';
7487
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'month\').val(\'' . dol_print_date($nowgmt, '%m', 'tzuserrel') . '\');';
7488
-			$reset_scripts .= 'jQuery(\'#' . $prefix . 'year\').val(\'' . dol_print_date($nowgmt, '%Y', 'tzuserrel') . '\');';
7485
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
7486
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
7487
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
7488
+			$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
7489 7489
 			// Update the hour part
7490 7490
 			if ($h) {
7491 7491
 				if ($fullday) {
7492 7492
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7493 7493
 				}
7494
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'hour\').val(\'' . dol_print_date($nowgmt, '%H', 'tzuserrel') . '\');';
7494
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
7495 7495
 				if ($fullday) {
7496 7496
 					$reset_scripts .= ' } ';
7497 7497
 				}
@@ -7501,14 +7501,14 @@  discard block
 block discarded – undo
7501 7501
 				if ($fullday) {
7502 7502
 					$reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
7503 7503
 				}
7504
-				$reset_scripts .= 'jQuery(\'#' . $prefix . 'min\').val(\'' . dol_print_date($nowgmt, '%M', 'tzuserrel') . '\');';
7504
+				$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
7505 7505
 				if ($fullday) {
7506 7506
 					$reset_scripts .= ' } ';
7507 7507
 				}
7508 7508
 			}
7509 7509
 			// If reset_scripts is not empty, print the link with the reset_scripts in the onClick
7510 7510
 			if ($reset_scripts && empty($conf->dol_optimize_smallscreen)) {
7511
-				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="' . $prefix . 'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="' . $reset_scripts . '">';
7511
+				$retstring .= ' <button class="dpInvisibleButtons datenowlink" id="'.$prefix.'ButtonPlusOne" type="button" name="_useless2" value="plusone" onClick="'.$reset_scripts.'">';
7512 7512
 				$retstring .= $langs->trans("DateStartPlusOne");
7513 7513
 				$retstring .= '</button> ';
7514 7514
 			}
@@ -7566,17 +7566,17 @@  discard block
 block discarded – undo
7566 7566
 			unset($TDurationTypes[$value]);
7567 7567
 		}
7568 7568
 
7569
-		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_' . $prefix . 'type_duration" name="' . $prefix . 'type_duration">';
7569
+		$retstring = '<select class="flat minwidth75 maxwidth100" id="select_'.$prefix.'type_duration" name="'.$prefix.'type_duration">';
7570 7570
 		foreach ($TDurationTypes as $key => $typeduration) {
7571
-			$retstring .= '<option value="' . $key . '"';
7571
+			$retstring .= '<option value="'.$key.'"';
7572 7572
 			if ($key == $selected) {
7573 7573
 				$retstring .= " selected";
7574 7574
 			}
7575
-			$retstring .= ">" . $typeduration . "</option>";
7575
+			$retstring .= ">".$typeduration."</option>";
7576 7576
 		}
7577 7577
 		$retstring .= "</select>";
7578 7578
 
7579
-		$retstring .= ajax_combobox('select_' . $prefix . 'type_duration');
7579
+		$retstring .= ajax_combobox('select_'.$prefix.'type_duration');
7580 7580
 
7581 7581
 		return $retstring;
7582 7582
 	}
@@ -7608,30 +7608,30 @@  discard block
 block discarded – undo
7608 7608
 
7609 7609
 		// Hours
7610 7610
 		if ($iSecond != '') {
7611
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
7611
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
7612 7612
 
7613 7613
 			$hourSelected = convertSecondToTime($iSecond, 'allhour');
7614 7614
 			$minSelected = convertSecondToTime($iSecond, 'min');
7615 7615
 		}
7616 7616
 
7617 7617
 		if ($typehour == 'select') {
7618
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'hour" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . '>';
7618
+			$retstring .= '<select class="flat" id="select_'.$prefix.'hour" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').'>';
7619 7619
 			for ($hour = 0; $hour < 25; $hour++) {    // For a duration, we allow 24 hours
7620
-				$retstring .= '<option value="' . $hour . '"';
7620
+				$retstring .= '<option value="'.$hour.'"';
7621 7621
 				if (is_numeric($hourSelected) && $hourSelected == $hour) {
7622 7622
 					$retstring .= " selected";
7623 7623
 				}
7624
-				$retstring .= ">" . $hour . "</option>";
7624
+				$retstring .= ">".$hour."</option>";
7625 7625
 			}
7626 7626
 			$retstring .= "</select>";
7627 7627
 		} elseif ($typehour == 'text' || $typehour == 'textselect') {
7628
-			$retstring .= '<input placeholder="' . $langs->trans('HourShort') . '" type="number" min="0" name="' . $prefix . 'hour"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputhour right" value="' . (($hourSelected != '') ? ((int) $hourSelected) : '') . '">';
7628
+			$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour right" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
7629 7629
 		} else {
7630 7630
 			return 'BadValueForParameterTypeHour';
7631 7631
 		}
7632 7632
 
7633 7633
 		if ($typehour != 'text') {
7634
-			$retstring .= ' ' . $langs->trans('HourShort');
7634
+			$retstring .= ' '.$langs->trans('HourShort');
7635 7635
 		} else {
7636 7636
 			$retstring .= '<span class="">:</span>';
7637 7637
 		}
@@ -7646,21 +7646,21 @@  discard block
 block discarded – undo
7646 7646
 		}
7647 7647
 
7648 7648
 		if ($typehour == 'select' || $typehour == 'textselect') {
7649
-			$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
7649
+			$retstring .= '<select class="flat" id="select_'.$prefix.'min" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').'>';
7650 7650
 			for ($min = 0; $min <= 55; $min += 5) {
7651
-				$retstring .= '<option value="' . $min . '"';
7651
+				$retstring .= '<option value="'.$min.'"';
7652 7652
 				if (is_numeric($minSelected) && $minSelected == $min) {
7653 7653
 					$retstring .= ' selected';
7654 7654
 				}
7655
-				$retstring .= '>' . $min . '</option>';
7655
+				$retstring .= '>'.$min.'</option>';
7656 7656
 			}
7657 7657
 			$retstring .= "</select>";
7658 7658
 		} elseif ($typehour == 'text') {
7659
-			$retstring .= '<input placeholder="' . $langs->trans('MinuteShort') . '" type="number" min="0" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . ' class="flat maxwidth50 inputminute right" value="' . (($minSelected != '') ? ((int) $minSelected) : '') . '">';
7659
+			$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute right" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
7660 7660
 		}
7661 7661
 
7662 7662
 		if ($typehour != 'text') {
7663
-			$retstring .= ' ' . $langs->trans('MinuteShort');
7663
+			$retstring .= ' '.$langs->trans('MinuteShort');
7664 7664
 		}
7665 7665
 
7666 7666
 		$retstring .= "</span>";
@@ -7708,7 +7708,7 @@  discard block
 block discarded – undo
7708 7708
 			$placeholder = '';
7709 7709
 
7710 7710
 			if ($selected && empty($selected_input_value)) {
7711
-				require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7711
+				require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7712 7712
 				$tickettmpselect = new Ticket($this->db);
7713 7713
 				$tickettmpselect->fetch($selected);
7714 7714
 				$selected_input_value = $tickettmpselect->ref;
@@ -7716,17 +7716,17 @@  discard block
 block discarded – undo
7716 7716
 			}
7717 7717
 
7718 7718
 			$urloption = '';
7719
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7719
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7720 7720
 
7721 7721
 			if (empty($hidelabel)) {
7722
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7722
+				$out .= $langs->trans("RefOrLabel").' : ';
7723 7723
 			} elseif ($hidelabel > 1) {
7724
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7724
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7725 7725
 				if ($hidelabel == 2) {
7726 7726
 					$out .= img_picto($langs->trans("Search"), 'search');
7727 7727
 				}
7728 7728
 			}
7729
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7729
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7730 7730
 			if ($hidelabel == 3) {
7731 7731
 				$out .= img_picto($langs->trans("Search"), 'search');
7732 7732
 			}
@@ -7770,8 +7770,8 @@  discard block
 block discarded – undo
7770 7770
 
7771 7771
 		$sql = "SELECT ";
7772 7772
 		$sql .= $selectFields;
7773
-		$sql .= " FROM " . $this->db->prefix() . "ticket as p";
7774
-		$sql .= ' WHERE p.entity IN (' . getEntity('ticket') . ')';
7773
+		$sql .= " FROM ".$this->db->prefix()."ticket as p";
7774
+		$sql .= ' WHERE p.entity IN ('.getEntity('ticket').')';
7775 7775
 
7776 7776
 		// Add criteria on ref/label
7777 7777
 		if ($filterkey != '') {
@@ -7787,7 +7787,7 @@  discard block
 block discarded – undo
7787 7787
 				if ($i > 0) {
7788 7788
 					$sql .= " AND ";
7789 7789
 				}
7790
-				$sql .= "(p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%' OR p.subject LIKE '" . $this->db->escape($prefix . $crit) . "%'";
7790
+				$sql .= "(p.ref LIKE '".$this->db->escape($prefix.$crit)."%' OR p.subject LIKE '".$this->db->escape($prefix.$crit)."%'";
7791 7791
 				$sql .= ")";
7792 7792
 				$i++;
7793 7793
 			}
@@ -7800,22 +7800,22 @@  discard block
 block discarded – undo
7800 7800
 		$sql .= $this->db->plimit($limit, 0);
7801 7801
 
7802 7802
 		// Build output string
7803
-		dol_syslog(get_class($this) . "::selectTicketsList search tickets", LOG_DEBUG);
7803
+		dol_syslog(get_class($this)."::selectTicketsList search tickets", LOG_DEBUG);
7804 7804
 		$result = $this->db->query($sql);
7805 7805
 		if ($result) {
7806
-			require_once DOL_DOCUMENT_ROOT . '/ticket/class/ticket.class.php';
7807
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php';
7806
+			require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
7807
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php';
7808 7808
 
7809 7809
 			$num = $this->db->num_rows($result);
7810 7810
 
7811 7811
 			$events = array();
7812 7812
 
7813 7813
 			if (!$forcecombo) {
7814
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
7814
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
7815 7815
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('TICKET_USE_SEARCH_TO_SELECT'));
7816 7816
 			}
7817 7817
 
7818
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
7818
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
7819 7819
 
7820 7820
 			$textifempty = '';
7821 7821
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -7832,7 +7832,7 @@  discard block
 block discarded – undo
7832 7832
 				}
7833 7833
 			}
7834 7834
 			if ($showempty) {
7835
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
7835
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
7836 7836
 			}
7837 7837
 
7838 7838
 			$i = 0;
@@ -7887,13 +7887,13 @@  discard block
 block discarded – undo
7887 7887
 		$outkey = $objp->rowid;
7888 7888
 		$outref = $objp->ref;
7889 7889
 
7890
-		$opt = '<option value="' . $objp->rowid . '"';
7890
+		$opt = '<option value="'.$objp->rowid.'"';
7891 7891
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
7892 7892
 		$opt .= '>';
7893 7893
 		$opt .= $objp->ref;
7894 7894
 		$objRef = $objp->ref;
7895 7895
 		if (!empty($filterkey) && $filterkey != '') {
7896
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
7896
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
7897 7897
 		}
7898 7898
 
7899 7899
 		$opt .= "</option>\n";
@@ -7934,7 +7934,7 @@  discard block
 block discarded – undo
7934 7934
 			$placeholder = '';
7935 7935
 
7936 7936
 			if ($selected && empty($selected_input_value)) {
7937
-				require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
7937
+				require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
7938 7938
 				$projecttmpselect = new Project($this->db);
7939 7939
 				$projecttmpselect->fetch($selected);
7940 7940
 				$selected_input_value = $projecttmpselect->ref;
@@ -7942,17 +7942,17 @@  discard block
 block discarded – undo
7942 7942
 			}
7943 7943
 
7944 7944
 			$urloption = '';
7945
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7945
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
7946 7946
 
7947 7947
 			if (empty($hidelabel)) {
7948
-				$out .= $langs->trans("RefOrLabel") . ' : ';
7948
+				$out .= $langs->trans("RefOrLabel").' : ';
7949 7949
 			} elseif ($hidelabel > 1) {
7950
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
7950
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
7951 7951
 				if ($hidelabel == 2) {
7952 7952
 					$out .= img_picto($langs->trans("Search"), 'search');
7953 7953
 				}
7954 7954
 			}
7955
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
7955
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
7956 7956
 			if ($hidelabel == 3) {
7957 7957
 				$out .= img_picto($langs->trans("Search"), 'search');
7958 7958
 			}
@@ -7995,8 +7995,8 @@  discard block
 block discarded – undo
7995 7995
 
7996 7996
 		$sql = "SELECT ";
7997 7997
 		$sql .= $selectFields;
7998
-		$sql .= " FROM " . $this->db->prefix() . "projet as p";
7999
-		$sql .= ' WHERE p.entity IN (' . getEntity('project') . ')';
7998
+		$sql .= " FROM ".$this->db->prefix()."projet as p";
7999
+		$sql .= ' WHERE p.entity IN ('.getEntity('project').')';
8000 8000
 
8001 8001
 		// Add criteria on ref/label
8002 8002
 		if ($filterkey != '') {
@@ -8012,7 +8012,7 @@  discard block
 block discarded – undo
8012 8012
 				if ($i > 0) {
8013 8013
 					$sql .= " AND ";
8014 8014
 				}
8015
-				$sql .= "p.ref LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8015
+				$sql .= "p.ref LIKE '".$this->db->escape($prefix.$crit)."%'";
8016 8016
 				$sql .= "";
8017 8017
 				$i++;
8018 8018
 			}
@@ -8025,22 +8025,22 @@  discard block
 block discarded – undo
8025 8025
 		$sql .= $this->db->plimit($limit, 0);
8026 8026
 
8027 8027
 		// Build output string
8028
-		dol_syslog(get_class($this) . "::selectProjectsList search projects", LOG_DEBUG);
8028
+		dol_syslog(get_class($this)."::selectProjectsList search projects", LOG_DEBUG);
8029 8029
 		$result = $this->db->query($sql);
8030 8030
 		if ($result) {
8031
-			require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
8032
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php';
8031
+			require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
8032
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
8033 8033
 
8034 8034
 			$num = $this->db->num_rows($result);
8035 8035
 
8036 8036
 			$events = array();
8037 8037
 
8038 8038
 			if (!$forcecombo) {
8039
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8039
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8040 8040
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalInt('PROJECT_USE_SEARCH_TO_SELECT'));
8041 8041
 			}
8042 8042
 
8043
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8043
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8044 8044
 
8045 8045
 			$textifempty = '';
8046 8046
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8057,7 +8057,7 @@  discard block
 block discarded – undo
8057 8057
 				}
8058 8058
 			}
8059 8059
 			if ($showempty) {
8060
-				$out .= '<option value="0" selected>' . $textifempty . '</option>';
8060
+				$out .= '<option value="0" selected>'.$textifempty.'</option>';
8061 8061
 			}
8062 8062
 
8063 8063
 			$i = 0;
@@ -8115,13 +8115,13 @@  discard block
 block discarded – undo
8115 8115
 		$outlabel = $objp->label;
8116 8116
 		$outtype = $objp->fk_product_type;
8117 8117
 
8118
-		$opt = '<option value="' . $objp->rowid . '"';
8118
+		$opt = '<option value="'.$objp->rowid.'"';
8119 8119
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8120 8120
 		$opt .= '>';
8121 8121
 		$opt .= $objp->ref;
8122 8122
 		$objRef = $objp->ref;
8123 8123
 		if (!empty($filterkey) && $filterkey != '') {
8124
-			$objRef = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $objRef, 1);
8124
+			$objRef = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $objRef, 1);
8125 8125
 		}
8126 8126
 
8127 8127
 		$opt .= "</option>\n";
@@ -8163,7 +8163,7 @@  discard block
 block discarded – undo
8163 8163
 			$placeholder = '';
8164 8164
 
8165 8165
 			if ($selected && empty($selected_input_value)) {
8166
-				require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8166
+				require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8167 8167
 				$adherenttmpselect = new Adherent($this->db);
8168 8168
 				$adherenttmpselect->fetch($selected);
8169 8169
 				$selected_input_value = $adherenttmpselect->ref;
@@ -8172,17 +8172,17 @@  discard block
 block discarded – undo
8172 8172
 
8173 8173
 			$urloption = '';
8174 8174
 
8175
-			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8175
+			$out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/adherents/ajax/adherents.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions);
8176 8176
 
8177 8177
 			if (empty($hidelabel)) {
8178
-				$out .= $langs->trans("RefOrLabel") . ' : ';
8178
+				$out .= $langs->trans("RefOrLabel").' : ';
8179 8179
 			} elseif ($hidelabel > 1) {
8180
-				$placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"';
8180
+				$placeholder = ' placeholder="'.$langs->trans("RefOrLabel").'"';
8181 8181
 				if ($hidelabel == 2) {
8182 8182
 					$out .= img_picto($langs->trans("Search"), 'search');
8183 8183
 				}
8184 8184
 			}
8185
-			$out .= '<input type="text" class="minwidth100" name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . $placeholder . ' ' . (getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '') . ' />';
8185
+			$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(getDolGlobalString('PRODUCT_SEARCH_AUTOFOCUS') ? 'autofocus' : '').' />';
8186 8186
 			if ($hidelabel == 3) {
8187 8187
 				$out .= img_picto($langs->trans("Search"), 'search');
8188 8188
 			}
@@ -8227,8 +8227,8 @@  discard block
 block discarded – undo
8227 8227
 
8228 8228
 		$sql = "SELECT ";
8229 8229
 		$sql .= $selectFields;
8230
-		$sql .= " FROM " . $this->db->prefix() . "adherent as p";
8231
-		$sql .= ' WHERE p.entity IN (' . getEntity('adherent') . ')';
8230
+		$sql .= " FROM ".$this->db->prefix()."adherent as p";
8231
+		$sql .= ' WHERE p.entity IN ('.getEntity('adherent').')';
8232 8232
 
8233 8233
 		// Add criteria on ref/label
8234 8234
 		if ($filterkey != '') {
@@ -8244,8 +8244,8 @@  discard block
 block discarded – undo
8244 8244
 				if ($i > 0) {
8245 8245
 					$sql .= " AND ";
8246 8246
 				}
8247
-				$sql .= "(p.firstname LIKE '" . $this->db->escape($prefix . $crit) . "%'";
8248
-				$sql .= " OR p.lastname LIKE '" . $this->db->escape($prefix . $crit) . "%')";
8247
+				$sql .= "(p.firstname LIKE '".$this->db->escape($prefix.$crit)."%'";
8248
+				$sql .= " OR p.lastname LIKE '".$this->db->escape($prefix.$crit)."%')";
8249 8249
 				$i++;
8250 8250
 			}
8251 8251
 			if (count($search_crit) > 1) {
@@ -8254,27 +8254,27 @@  discard block
 block discarded – undo
8254 8254
 			$sql .= ')';
8255 8255
 		}
8256 8256
 		if ($status != -1) {
8257
-			$sql .= ' AND statut = ' . ((int) $status);
8257
+			$sql .= ' AND statut = '.((int) $status);
8258 8258
 		}
8259 8259
 		$sql .= $this->db->plimit($limit, 0);
8260 8260
 
8261 8261
 		// Build output string
8262
-		dol_syslog(get_class($this) . "::selectMembersList search adherents", LOG_DEBUG);
8262
+		dol_syslog(get_class($this)."::selectMembersList search adherents", LOG_DEBUG);
8263 8263
 		$result = $this->db->query($sql);
8264 8264
 		if ($result) {
8265
-			require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
8266
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/member.lib.php';
8265
+			require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
8266
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
8267 8267
 
8268 8268
 			$num = $this->db->num_rows($result);
8269 8269
 
8270 8270
 			$events = array();
8271 8271
 
8272 8272
 			if (!$forcecombo) {
8273
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8273
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8274 8274
 				$out .= ajax_combobox($htmlname, $events, getDolGlobalString('PROJECT_USE_SEARCH_TO_SELECT') ? $conf->global->PROJECT_USE_SEARCH_TO_SELECT : '');
8275 8275
 			}
8276 8276
 
8277
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
8277
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
8278 8278
 
8279 8279
 			$textifempty = '';
8280 8280
 			// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
@@ -8291,7 +8291,7 @@  discard block
 block discarded – undo
8291 8291
 				}
8292 8292
 			}
8293 8293
 			if ($showempty) {
8294
-				$out .= '<option value="-1" selected>' . $textifempty . '</option>';
8294
+				$out .= '<option value="-1" selected>'.$textifempty.'</option>';
8295 8295
 			}
8296 8296
 
8297 8297
 			$i = 0;
@@ -8347,11 +8347,11 @@  discard block
 block discarded – undo
8347 8347
 		$outlabel = dolGetFirstLastname($objp->firstname, $objp->lastname);
8348 8348
 		$outtype = $objp->fk_adherent_type;
8349 8349
 
8350
-		$opt = '<option value="' . $objp->rowid . '"';
8350
+		$opt = '<option value="'.$objp->rowid.'"';
8351 8351
 		$opt .= ($objp->rowid == $selected) ? ' selected' : '';
8352 8352
 		$opt .= '>';
8353 8353
 		if (!empty($filterkey) && $filterkey != '') {
8354
-			$outlabel = preg_replace('/(' . preg_quote($filterkey, '/') . ')/i', '<strong>$1</strong>', $outlabel, 1);
8354
+			$outlabel = preg_replace('/('.preg_quote($filterkey, '/').')/i', '<strong>$1</strong>', $outlabel, 1);
8355 8355
 		}
8356 8356
 		$opt .= $outlabel;
8357 8357
 		$opt .= "</option>\n";
@@ -8406,8 +8406,8 @@  discard block
 block discarded – undo
8406 8406
 		$objecttmp = null;
8407 8407
 		$InfoFieldList = array();
8408 8408
 		$classname = '';
8409
-		$filter = '';  // Ensure filter has value (for static analysis)
8410
-		$sortfield = '';  // Ensure filter has value (for static analysis)
8409
+		$filter = ''; // Ensure filter has value (for static analysis)
8410
+		$sortfield = ''; // Ensure filter has value (for static analysis)
8411 8411
 
8412 8412
 		if ($objectfield) {	// We must retrieve the objectdesc from the field or extrafield
8413 8413
 			// Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield'
@@ -8451,9 +8451,9 @@  discard block
 block discarded – undo
8451 8451
 			$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
8452 8452
 			$reg = array();
8453 8453
 			if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
8454
-				$InfoFieldList[4] = $reg[1];    // take the sort field
8454
+				$InfoFieldList[4] = $reg[1]; // take the sort field
8455 8455
 			}
8456
-			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp);    // take the filter field
8456
+			$InfoFieldList[3] = preg_replace('/:\w*$/', '', $vartmp); // take the filter field
8457 8457
 
8458 8458
 			$classname = $InfoFieldList[0];
8459 8459
 			$classpath = empty($InfoFieldList[1]) ? '' : $InfoFieldList[1];
@@ -8484,8 +8484,8 @@  discard block
 block discarded – undo
8484 8484
 		);
8485 8485
 
8486 8486
 		if (!is_object($objecttmp)) {
8487
-			dol_syslog('selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8488
-			return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8487
+			dol_syslog('selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc, LOG_WARNING);
8488
+			return 'selectForForms: Error bad setup of field objectdescorig='.$objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
8489 8489
 		}
8490 8490
 		'@phan-var-force CommonObject $objecttmp';
8491 8491
 
@@ -8497,9 +8497,9 @@  discard block
 block discarded – undo
8497 8497
 		if ($prefixforautocompletemode == 'product') {
8498 8498
 			$prefixforautocompletemode = 'produit';
8499 8499
 		}
8500
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8500
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8501 8501
 
8502
-		dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
8502
+		dol_syslog(get_class($this)."::selectForForms filter=".$filter, LOG_DEBUG);
8503 8503
 
8504 8504
 		// Generate the combo HTML component
8505 8505
 		$out = '';
@@ -8528,13 +8528,13 @@  discard block
 block discarded – undo
8528 8528
 			}
8529 8529
 
8530 8530
 			// Set url and param to call to get json of the search results
8531
-			$urlforajaxcall = DOL_URL_ROOT . '/core/ajax/selectobject.php';
8532
-			$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
8531
+			$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
8532
+			$urloption = 'htmlname='.urlencode($htmlname).'&outjson=1&objectdesc='.urlencode($objectdescorig).'&objectfield='.urlencode($objectfield).($sortfield ? '&sortfield='.urlencode($sortfield) : '');
8533 8533
 
8534 8534
 			// Activate the auto complete using ajax call.
8535 8535
 			$out .= ajax_autocompleter((string) $preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalInt($confkeyforautocompletemode), 0);
8536 8536
 			$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
8537
-			$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) . '"' : '') . ' />';
8537
+			$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).'"' : '').' />';
8538 8538
 		} else {
8539 8539
 			// Immediate load of table record.
8540 8540
 			$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
@@ -8574,16 +8574,16 @@  discard block
 block discarded – undo
8574 8574
 		if ($prefixforautocompletemode == 'societe') {
8575 8575
 			$prefixforautocompletemode = 'company';
8576 8576
 		}
8577
-		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8577
+		$confkeyforautocompletemode = strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
8578 8578
 
8579 8579
 		if (!empty($objecttmp->fields)) {    // For object that declare it, it is better to use declared fields (like societe, contact, ...)
8580 8580
 			$tmpfieldstoshow = '';
8581 8581
 			foreach ($objecttmp->fields as $key => $val) {
8582
-				if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
8582
+				if (!(int) dol_eval($val['enabled'], 1, 1, '1')) {
8583 8583
 					continue;
8584 8584
 				}
8585 8585
 				if (!empty($val['showoncombobox'])) {
8586
-					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '') . 't.' . $key;
8586
+					$tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key;
8587 8587
 				}
8588 8588
 			}
8589 8589
 			if ($tmpfieldstoshow) {
@@ -8620,25 +8620,25 @@  discard block
 block discarded – undo
8620 8620
 		$num = 0;
8621 8621
 
8622 8622
 		// Search data
8623
-		$sql = "SELECT t.rowid, " . $fieldstoshow . " FROM " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . " as t";
8623
+		$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)." as t";
8624 8624
 		if (!empty($objecttmp->isextrafieldmanaged)) {
8625
-			$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($objecttmp->table_element) . "_extrafields as e ON t.rowid = e.fk_object";
8625
+			$sql .= " LEFT JOIN ".$this->db->prefix().$this->db->sanitize($objecttmp->table_element)."_extrafields as e ON t.rowid = e.fk_object";
8626 8626
 		}
8627 8627
 		if (!empty($objecttmp->parent_element)) {
8628 8628
 			$parent_properties = getElementProperties($objecttmp->parent_element);
8629
-			$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($parent_properties['table_element']) . " as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8629
+			$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($parent_properties['table_element'])." as o ON o.rowid = t.".$objecttmp->fk_parent_attribute;
8630 8630
 		}
8631 8631
 		if (in_array($objecttmp->parent_element, ['commande', 'propal', 'facture', 'expedition'])) {
8632
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product as p ON p.rowid = t.fk_product";
8632
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = t.fk_product";
8633 8633
 		}
8634 8634
 		if (isset($objecttmp->ismultientitymanaged)) {
8635 8635
 			if (!is_numeric($objecttmp->ismultientitymanaged)) {
8636 8636
 				$tmparray = explode('@', $objecttmp->ismultientitymanaged);
8637
-				$sql .= " INNER JOIN " . $this->db->prefix() . $this->db->sanitize($tmparray[1]) . " as parenttable ON parenttable.rowid = t." . $this->db->sanitize($tmparray[0]);
8637
+				$sql .= " INNER JOIN ".$this->db->prefix().$this->db->sanitize($tmparray[1])." as parenttable ON parenttable.rowid = t.".$this->db->sanitize($tmparray[0]);
8638 8638
 			}
8639 8639
 			if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8640 8640
 				if (!$user->hasRight('societe', 'client', 'voir')) {
8641
-					$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
8641
+					$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
8642 8642
 				}
8643 8643
 			}
8644 8644
 		}
@@ -8658,27 +8658,27 @@  discard block
 block discarded – undo
8658 8658
 			$sql .= " WHERE 1=1";
8659 8659
 			if (isset($objecttmp->ismultientitymanaged)) {
8660 8660
 				if ($objecttmp->ismultientitymanaged == 1) {
8661
-					$sql .= " AND t.entity IN (" . getEntity($objecttmp->table_element) . ")";
8661
+					$sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
8662 8662
 				}
8663 8663
 				if (!is_numeric($objecttmp->ismultientitymanaged)) {
8664
-					$sql .= " AND parenttable.entity = t." . $this->db->sanitize($tmparray[0]);
8664
+					$sql .= " AND parenttable.entity = t.".$this->db->sanitize($tmparray[0]);
8665 8665
 				}
8666 8666
 				if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
8667 8667
 					if ($objecttmp->element == 'societe') {
8668
-						$sql .= " AND t.rowid = " . ((int) $user->socid);
8668
+						$sql .= " AND t.rowid = ".((int) $user->socid);
8669 8669
 					} else {
8670
-						$sql .= " AND t.fk_soc = " . ((int) $user->socid);
8670
+						$sql .= " AND t.fk_soc = ".((int) $user->socid);
8671 8671
 					}
8672 8672
 				}
8673 8673
 				if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
8674 8674
 					if (!$user->hasRight('societe', 'client', 'voir')) {
8675
-						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
8675
+						$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
8676 8676
 					}
8677 8677
 				}
8678 8678
 			}
8679 8679
 			$splittedfieldstoshow = explode(',', $fieldstoshow);
8680 8680
 			foreach ($splittedfieldstoshow as &$field2) {
8681
-				if (is_numeric($pos=strpos($field2, ' '))) {
8681
+				if (is_numeric($pos = strpos($field2, ' '))) {
8682 8682
 					$field2 = substr($field2, 0, $pos);
8683 8683
 				}
8684 8684
 			}
@@ -8690,7 +8690,7 @@  discard block
 block discarded – undo
8690 8690
 				$errormessage = '';
8691 8691
 				$sql .= forgeSQLFromUniversalSearchCriteria($filter, $errormessage);
8692 8692
 				if ($errormessage) {
8693
-					return 'Error forging a SQL request from an universal criteria: ' . $errormessage;
8693
+					return 'Error forging a SQL request from an universal criteria: '.$errormessage;
8694 8694
 				}
8695 8695
 			}
8696 8696
 		}
@@ -8702,7 +8702,7 @@  discard block
 block discarded – undo
8702 8702
 		$resql = $this->db->query($sql);
8703 8703
 		if ($resql) {
8704 8704
 			// Construct $out and $outarray
8705
-			$out .= '<select id="' . $htmlname . '" class="flat minwidth100' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ($moreparams ? ' ' . $moreparams : '') . ' name="' . $htmlname . '">' . "\n";
8705
+			$out .= '<select id="'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').($moreparams ? ' '.$moreparams : '').' name="'.$htmlname.'">'."\n";
8706 8706
 
8707 8707
 			// Warning: Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'. Seems it is no more true with selec2 v4
8708 8708
 			$textifempty = '&nbsp;';
@@ -8716,7 +8716,7 @@  discard block
 block discarded – undo
8716 8716
 				}
8717 8717
 			}
8718 8718
 			if ($showempty) {
8719
-				$out .= '<option value="-1">' . $textifempty . '</option>' . "\n";
8719
+				$out .= '<option value="-1">'.$textifempty.'</option>'."\n";
8720 8720
 			}
8721 8721
 
8722 8722
 			$num = $this->db->num_rows($resql);
@@ -8739,9 +8739,9 @@  discard block
 block discarded – undo
8739 8739
 					}
8740 8740
 					if (empty($outputmode)) {
8741 8741
 						if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) {
8742
-							$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>';
8742
+							$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>';
8743 8743
 						} else {
8744
-							$out .= '<option value="' . $obj->rowid . '" data-html="' . dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1) . '">' . dol_escape_htmltag($label, 0, 0, '', 0, 1) . '</option>';
8744
+							$out .= '<option value="'.$obj->rowid.'" data-html="'.dol_escape_htmltag($labelhtml, 0, 0, '', 0, 1).'">'.dol_escape_htmltag($label, 0, 0, '', 0, 1).'</option>';
8745 8745
 						}
8746 8746
 					} else {
8747 8747
 						array_push($outarray, array('key' => $obj->rowid, 'value' => $label, 'label' => $label));
@@ -8754,10 +8754,10 @@  discard block
 block discarded – undo
8754 8754
 				}
8755 8755
 			}
8756 8756
 
8757
-			$out .= '</select>' . "\n";
8757
+			$out .= '</select>'."\n";
8758 8758
 
8759 8759
 			if (!$forcecombo) {
8760
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8760
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8761 8761
 				$out .= ajax_combobox($htmlname, array(), getDolGlobalInt($confkeyforautocompletemode, 0));
8762 8762
 			}
8763 8763
 		} else {
@@ -8821,8 +8821,8 @@  discard block
 block discarded – undo
8821 8821
 			}
8822 8822
 		}
8823 8823
 		$idname = str_replace(array('[', ']'), array('', ''), $htmlname);
8824
-		$out .= '<select id="' . preg_replace('/^\./', '', $idname) . '" ' . ($disabled ? 'disabled="disabled" ' : '') . 'class="flat ' . (preg_replace('/^\./', '', $htmlname)) . ($morecss ? ' ' . $morecss : '') . ' selectformat"';
8825
-		$out .= ' name="' . preg_replace('/^\./', '', $htmlname) . '" ' . ($moreparam ? $moreparam : '');
8824
+		$out .= '<select id="'.preg_replace('/^\./', '', $idname).'" '.($disabled ? 'disabled="disabled" ' : '').'class="flat '.(preg_replace('/^\./', '', $htmlname)).($morecss ? ' '.$morecss : '').' selectformat"';
8825
+		$out .= ' name="'.preg_replace('/^\./', '', $htmlname).'" '.($moreparam ? $moreparam : '');
8826 8826
 		$out .= '>'."\n";
8827 8827
 
8828 8828
 		if ($show_empty) {
@@ -8833,7 +8833,7 @@  discard block
 block discarded – undo
8833 8833
 			if (!is_numeric($show_empty)) {
8834 8834
 				$textforempty = $show_empty;
8835 8835
 			}
8836
-			$out .= '<option class="optiongrey" ' . ($moreparamonempty ? $moreparamonempty . ' ' : '') . 'value="' . (((int) $show_empty) < 0 ? $show_empty : -1) . '"' . ($id == $show_empty ? ' selected' : '') . '>' . $textforempty . '</option>' . "\n";
8836
+			$out .= '<option class="optiongrey" '.($moreparamonempty ? $moreparamonempty.' ' : '').'value="'.(((int) $show_empty) < 0 ? $show_empty : -1).'"'.($id == $show_empty ? ' selected' : '').'>'.$textforempty.'</option>'."\n";
8837 8837
 		}
8838 8838
 		if (is_array($array)) {
8839 8839
 			// Translate
@@ -8858,7 +8858,7 @@  discard block
 block discarded – undo
8858 8858
 					$value = $tmpvalue['label'];
8859 8859
 					//$valuehtml = empty($tmpvalue['data-html']) ? $value : $tmpvalue['data-html'];
8860 8860
 					$disabled = empty($tmpvalue['disabled']) ? '' : ' disabled';
8861
-					$style = empty($tmpvalue['css']) ? '' : ' class="' . $tmpvalue['css'] . '"';
8861
+					$style = empty($tmpvalue['css']) ? '' : ' class="'.$tmpvalue['css'].'"';
8862 8862
 				} else {
8863 8863
 					$value = $tmpvalue;
8864 8864
 					//$valuehtml = $tmpvalue;
@@ -8874,9 +8874,9 @@  discard block
 block discarded – undo
8874 8874
 				}
8875 8875
 				if ($key_in_label) {
8876 8876
 					if (empty($nohtmlescape)) {
8877
-						$selectOptionValue = dol_escape_htmltag($key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value));
8877
+						$selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value));
8878 8878
 					} else {
8879
-						$selectOptionValue = $key . ' - ' . ($maxlen ? dol_trunc($value, $maxlen) : $value);
8879
+						$selectOptionValue = $key.' - '.($maxlen ? dol_trunc($value, $maxlen) : $value);
8880 8880
 					}
8881 8881
 				} else {
8882 8882
 					if (empty($nohtmlescape)) {
@@ -8888,8 +8888,8 @@  discard block
 block discarded – undo
8888 8888
 						$selectOptionValue = '&nbsp;';
8889 8889
 					}
8890 8890
 				}
8891
-				$out .= '<option value="' . $key . '"';
8892
-				$out .= $style . $disabled;
8891
+				$out .= '<option value="'.$key.'"';
8892
+				$out .= $style.$disabled;
8893 8893
 				if (is_array($id)) {
8894 8894
 					if (in_array($key, $id) && !$disabled) {
8895 8895
 						$out .= ' selected'; // To preselect a value
@@ -8901,7 +8901,7 @@  discard block
 block discarded – undo
8901 8901
 					}
8902 8902
 				}
8903 8903
 				if (!empty($nohtmlescape)) {	// deprecated. Use instead the key 'data-html' into input $array, managed at next step to use HTML content.
8904
-					$out .= ' data-html="' . dol_escape_htmltag($selectOptionValue) . '"';
8904
+					$out .= ' data-html="'.dol_escape_htmltag($selectOptionValue).'"';
8905 8905
 				}
8906 8906
 
8907 8907
 				if (is_array($tmpvalue)) {
@@ -8924,7 +8924,7 @@  discard block
 block discarded – undo
8924 8924
 		// Add code for jquery to use multiselect
8925 8925
 		if ($addjscombo && $jsbeautify) {
8926 8926
 			// Enhance with select2
8927
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
8927
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
8928 8928
 			$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
8929 8929
 		}
8930 8930
 
@@ -8952,28 +8952,28 @@  discard block
 block discarded – undo
8952 8952
 	public static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0)
8953 8953
 	{
8954 8954
 		global $conf, $langs;
8955
-		global $delayedhtmlcontent;    // Will be used later outside of this function
8955
+		global $delayedhtmlcontent; // Will be used later outside of this function
8956 8956
 
8957 8957
 		// TODO Use an internal dolibarr component instead of select2
8958 8958
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
8959 8959
 			return '';
8960 8960
 		}
8961 8961
 
8962
-		$out = '<select type="text" class="' . $htmlname . ($morecss ? ' ' . $morecss : '') . '" ' . ($moreparam ? $moreparam . ' ' : '') . 'name="' . $htmlname . '"></select>';
8962
+		$out = '<select type="text" class="'.$htmlname.($morecss ? ' '.$morecss : '').'" '.($moreparam ? $moreparam.' ' : '').'name="'.$htmlname.'"></select>';
8963 8963
 
8964 8964
 		$outdelayed = '';
8965 8965
 		if (!empty($conf->use_javascript_ajax)) {
8966 8966
 			$tmpplugin = 'select2';
8967
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
8968
-		    	<script nonce="' . getNonce() . '">
8967
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
8968
+		    	<script nonce="' . getNonce().'">
8969 8969
 		    	$(document).ready(function () {
8970 8970
 
8971
-	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '') . '
8971
+	    	        ' . ($callurlonselect ? 'var saveRemoteData = [];' : '').'
8972 8972
 
8973
-	                $(".' . $htmlname . '").select2({
8973
+	                $(".' . $htmlname.'").select2({
8974 8974
 				    	ajax: {
8975 8975
 					    	dir: "ltr",
8976
-					    	url: "' . $url . '",
8976
+					    	url: "' . $url.'",
8977 8977
 					    	dataType: \'json\',
8978 8978
 					    	delay: 250,
8979 8979
 					    	data: function (params) {
@@ -9000,9 +9000,9 @@  discard block
 block discarded – undo
9000 9000
 				    	},
9001 9001
 		 				language: select2arrayoflanguage,
9002 9002
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9003
-					    placeholder: "' . dol_escape_js($placeholder) . '",
9003
+					    placeholder: "' . dol_escape_js($placeholder).'",
9004 9004
 				    	escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9005
-				    	minimumInputLength: ' . ((int) $minimumInputLength) . ',
9005
+				    	minimumInputLength: ' . ((int) $minimumInputLength).',
9006 9006
 				        formatResult: function (result, container, query, escapeMarkup) {
9007 9007
 	                        return escapeMarkup(result.text);
9008 9008
 	                    },
@@ -9010,10 +9010,10 @@  discard block
 block discarded – undo
9010 9010
 
9011 9011
 	                ' . ($callurlonselect ? '
9012 9012
 	                /* Code to execute a GET when we select a value */
9013
-	                $(".' . $htmlname . '").change(function() {
9014
-				    	var selected = $(".' . $htmlname . '").val();
9013
+	                $(".' . $htmlname.'").change(function() {
9014
+				    	var selected = $(".' . $htmlname.'").val();
9015 9015
 	                	console.log("We select in selectArrayAjax the entry "+selected)
9016
-				        $(".' . $htmlname . '").val("");  /* reset visible combo value */
9016
+				        $(".' . $htmlname.'").val("");  /* reset visible combo value */
9017 9017
 	    			    $.each( saveRemoteData, function( key, value ) {
9018 9018
 	    				        if (key == selected)
9019 9019
 	    			            {
@@ -9021,7 +9021,7 @@  discard block
 block discarded – undo
9021 9021
 	    			                 location.assign(value.url);
9022 9022
 	    			            }
9023 9023
 	                    });
9024
-	    			});' : '') . '
9024
+	    			});' : '').'
9025 9025
 
9026 9026
 	    	   });
9027 9027
 		       </script>';
@@ -9057,14 +9057,14 @@  discard block
 block discarded – undo
9057 9057
 	public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0, $textfortitle = '')
9058 9058
 	{
9059 9059
 		global $conf, $langs;
9060
-		global $delayedhtmlcontent;    // Will be used later outside of this function
9060
+		global $delayedhtmlcontent; // Will be used later outside of this function
9061 9061
 
9062 9062
 		// TODO Use an internal dolibarr component instead of select2
9063 9063
 		if (!getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') && !defined('REQUIRE_JQUERY_MULTISELECT')) {
9064 9064
 			return '';
9065 9065
 		}
9066 9066
 
9067
-		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' ' . $morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9067
+		$out = '<select type="text"'.($textfortitle ? ' title="'.dol_escape_htmltag($textfortitle).'"' : '').' id="'.$htmlname.'" class="'.$htmlname.($morecss ? ' '.$morecss : '').'"'.($moreparam ? ' '.$moreparam : '').' name="'.$htmlname.'"><option></option></select>';
9068 9068
 
9069 9069
 		$formattedarrayresult = array();
9070 9070
 
@@ -9079,20 +9079,20 @@  discard block
 block discarded – undo
9079 9079
 		$outdelayed = '';
9080 9080
 		if (!empty($conf->use_javascript_ajax)) {
9081 9081
 			$tmpplugin = 'select2';
9082
-			$outdelayed = "\n" . '<!-- JS CODE TO ENABLE ' . $tmpplugin . ' for id ' . $htmlname . ' -->
9083
-				<script nonce="' . getNonce() . '">
9082
+			$outdelayed = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
9083
+				<script nonce="' . getNonce().'">
9084 9084
 				$(document).ready(function () {
9085
-					var data = ' . json_encode($formattedarrayresult) . ';
9085
+					var data = ' . json_encode($formattedarrayresult).';
9086 9086
 
9087
-					' . ($callurlonselect ? 'var saveRemoteData = ' . json_encode($array) . ';' : '') . '
9087
+					' . ($callurlonselect ? 'var saveRemoteData = '.json_encode($array).';' : '').'
9088 9088
 
9089
-					$(".' . $htmlname . '").select2({
9089
+					$(".' . $htmlname.'").select2({
9090 9090
 						data: data,
9091 9091
 						language: select2arrayoflanguage,
9092 9092
 						containerCssClass: \':all:\',					/* Line to add class from the original SELECT propagated to the new <span class="select2-selection...> tag */
9093
-						placeholder: "' . dol_escape_js($placeholder) . '",
9093
+						placeholder: "' . dol_escape_js($placeholder).'",
9094 9094
 						escapeMarkup: function (markup) { return markup; }, 	// let our custom formatter work
9095
-						minimumInputLength: ' . $minimumInputLength . ',
9095
+						minimumInputLength: ' . $minimumInputLength.',
9096 9096
 						formatResult: function (result, container, query, escapeMarkup) {
9097 9097
 							return escapeMarkup(result.text);
9098 9098
 						},
@@ -9131,11 +9131,11 @@  discard block
 block discarded – undo
9131 9131
 
9132 9132
 					' . ($callurlonselect ? '
9133 9133
 					/* Code to execute a GET when we select a value */
9134
-					$(".' . $htmlname . '").change(function() {
9135
-						var selected = $(".' . $htmlname . '").val();
9134
+					$(".' . $htmlname.'").change(function() {
9135
+						var selected = $(".' . $htmlname.'").val();
9136 9136
 						console.log("We select "+selected)
9137 9137
 
9138
-						$(".' . $htmlname . '").val("");  /* reset visible combo value */
9138
+						$(".' . $htmlname.'").val("");  /* reset visible combo value */
9139 9139
 						$.each( saveRemoteData, function( key, value ) {
9140 9140
 							if (key == selected)
9141 9141
 							{
@@ -9143,7 +9143,7 @@  discard block
 block discarded – undo
9143 9143
 								location.assign(value.url);
9144 9144
 							}
9145 9145
 						});
9146
-					});' : '') . '
9146
+					});' : '').'
9147 9147
 
9148 9148
 				});
9149 9149
 				</script>';
@@ -9192,7 +9192,7 @@  discard block
 block discarded – undo
9192 9192
 		$useenhancedmultiselect = 0;
9193 9193
 		if (!empty($conf->use_javascript_ajax) && !defined('MAIN_DO_NOT_USE_JQUERY_MULTISELECT') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
9194 9194
 			if ($addjscombo) {
9195
-				$useenhancedmultiselect = 1;	// Use the js multiselect in one line. Possible only if $addjscombo not 0.
9195
+				$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
9196 9196
 			}
9197 9197
 		}
9198 9198
 
@@ -9201,7 +9201,7 @@  discard block
 block discarded – undo
9201 9201
 		// submitted to nothing.
9202 9202
 		$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
9203 9203
 		// Output select component
9204
-		$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";
9204
+		$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";
9205 9205
 		if (is_array($array) && !empty($array)) {
9206 9206
 			if ($value_as_key) {
9207 9207
 				$array = array_combine($array, $array);
@@ -9222,33 +9222,33 @@  discard block
 block discarded – undo
9222 9222
 						$tmplabelhtml = empty($value['labelhtml']) ? (empty($value['data-html']) ? '' : $value['data-html']) : $value['labelhtml'];
9223 9223
 					}
9224 9224
 					$newval = ($translate ? $langs->trans($tmpvalue) : $tmpvalue);
9225
-					$newval = ($key_in_label ? $tmpkey . ' - ' . $newval : $newval);
9225
+					$newval = ($key_in_label ? $tmpkey.' - '.$newval : $newval);
9226 9226
 
9227
-					$out .= '<option value="' . $tmpkey . '"';
9227
+					$out .= '<option value="'.$tmpkey.'"';
9228 9228
 					if (is_array($selected) && !empty($selected) && in_array((string) $tmpkey, $selected) && ((string) $tmpkey != '')) {
9229 9229
 						$out .= ' selected';
9230 9230
 					}
9231 9231
 					if (!empty($tmplabelhtml)) {
9232
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9232
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9233 9233
 					} else {
9234
-						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #' . $tmpcolor . '"') : '') . $newval;
9235
-						$out .= ' data-html="' . dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1) . '"';
9234
+						$tmplabelhtml = ($tmppicto ? img_picto('', $tmppicto, 'class="pictofixedwidth" style="color: #'.$tmpcolor.'"') : '').$newval;
9235
+						$out .= ' data-html="'.dol_escape_htmltag($tmplabelhtml, 0, 0, '', 0, 1).'"';
9236 9236
 					}
9237 9237
 					$out .= '>';
9238 9238
 					$out .= dol_htmlentitiesbr($newval);
9239
-					$out .= '</option>' . "\n";
9239
+					$out .= '</option>'."\n";
9240 9240
 				}
9241 9241
 			}
9242 9242
 		}
9243
-		$out .= '</select>' . "\n";
9243
+		$out .= '</select>'."\n";
9244 9244
 
9245 9245
 		// Add code for jquery to use multiselect
9246 9246
 		if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
9247
-			$out .= "\n" . '<!-- JS CODE TO ENABLE select for id ' . $htmlname . ', addjscombo=' . $addjscombo . ' -->';
9248
-			$out .= "\n" . '<script nonce="' . getNonce() . '">' . "\n";
9247
+			$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
9248
+			$out .= "\n".'<script nonce="'.getNonce().'">'."\n";
9249 9249
 			if ($addjscombo == 1) {
9250 9250
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
9251
-				$out .= 'function formatResult(record, container) {' . "\n";
9251
+				$out .= 'function formatResult(record, container) {'."\n";
9252 9252
 				// If property data-html set, we decode html entities and use this.
9253 9253
 				// Note that HTML content must have been sanitized from js with dol_escape_htmltag(xxx, 0, 0, '', 0, 1) when building the select option.
9254 9254
 				$out .= '	if ($(record.element).attr("data-html") != undefined && typeof htmlEntityDecodeJs === "function") {';
@@ -9256,26 +9256,26 @@  discard block
 block discarded – undo
9256 9256
 				$out .= '		return htmlEntityDecodeJs($(record.element).attr("data-html"));';
9257 9257
 				$out .= '	}'."\n";
9258 9258
 				$out .= '	return record.text;';
9259
-				$out .= '}' . "\n";
9260
-				$out .= 'function formatSelection(record) {' . "\n";
9259
+				$out .= '}'."\n";
9260
+				$out .= 'function formatSelection(record) {'."\n";
9261 9261
 				if ($elemtype == 'category') {
9262
-					$out .= 'return \'<span><img src="' . DOL_URL_ROOT . '/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9262
+					$out .= 'return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png"> \'+record.text+\'</span>\';';
9263 9263
 				} else {
9264 9264
 					$out .= 'return record.text;';
9265 9265
 				}
9266
-				$out .= '}' . "\n";
9266
+				$out .= '}'."\n";
9267 9267
 				$out .= '$(document).ready(function () {
9268
-							$(\'#' . $htmlname . '\').' . $tmpplugin . '({';
9268
+							$(\'#' . $htmlname.'\').'.$tmpplugin.'({';
9269 9269
 				if ($placeholder) {
9270 9270
 					$out .= '
9271 9271
 								placeholder: {
9272 9272
 								    id: \'-1\',
9273
-								    text: \'' . dol_escape_js($placeholder) . '\'
9273
+								    text: \'' . dol_escape_js($placeholder).'\'
9274 9274
 								  },';
9275 9275
 				}
9276 9276
 				$out .= '		dir: \'ltr\',
9277 9277
 								containerCssClass: \':all:\',					/* Line to add class of origin SELECT propagated to the new <span class="select2-selection...> tag (ko with multiselect) */
9278
-								dropdownCssClass: \'' . $morecss . '\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9278
+								dropdownCssClass: \'' . $morecss.'\',				/* Line to add class on the new <span class="select2-selection...> tag (ok with multiselect). Need full version of select2. */
9279 9279
 								// Specify format function for dropdown item
9280 9280
 								formatResult: formatResult,
9281 9281
 							 	templateResult: formatResult,		/* For 4.0 */
@@ -9287,21 +9287,21 @@  discard block
 block discarded – undo
9287 9287
 
9288 9288
 							/* Add also morecss to the css .select2 that is after the #htmlname, for component that are show dynamically after load, because select2 set
9289 9289
 								 the size only if component is not hidden by default on load */
9290
-							$(\'#' . $htmlname . ' + .select2\').addClass(\'' . $morecss . '\');
9290
+							$(\'#' . $htmlname.' + .select2\').addClass(\''.$morecss.'\');
9291 9291
 						});' . "\n";
9292 9292
 			} elseif ($addjscombo == 2 && !defined('DISABLE_MULTISELECT')) {
9293 9293
 				// Add other js lib
9294 9294
 				// TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin
9295 9295
 				// ...
9296
-				$out .= 'console.log(\'addjscombo=2 for htmlname=' . $htmlname . '\');';
9296
+				$out .= 'console.log(\'addjscombo=2 for htmlname='.$htmlname.'\');';
9297 9297
 				$out .= '$(document).ready(function () {
9298
-							$(\'#' . $htmlname . '\').multiSelect({
9298
+							$(\'#' . $htmlname.'\').multiSelect({
9299 9299
 								containerHTML: \'<div class="multi-select-container">\',
9300 9300
 								menuHTML: \'<div class="multi-select-menu">\',
9301
-								buttonHTML: \'<span class="multi-select-button ' . $morecss . '">\',
9301
+								buttonHTML: \'<span class="multi-select-button ' . $morecss.'">\',
9302 9302
 								menuItemHTML: \'<label class="multi-select-menuitem">\',
9303 9303
 								activeClass: \'multi-select-container--open\',
9304
-								noneText: \'' . $placeholder . '\'
9304
+								noneText: \'' . $placeholder.'\'
9305 9305
 							});
9306 9306
 						})';
9307 9307
 			}
@@ -9334,7 +9334,7 @@  discard block
 block discarded – undo
9334 9334
 			return '';
9335 9335
 		}
9336 9336
 
9337
-		$tmpvar = "MAIN_SELECTEDFIELDS_" . $varpage; // To get list of saved selected fields to show
9337
+		$tmpvar = "MAIN_SELECTEDFIELDS_".$varpage; // To get list of saved selected fields to show
9338 9338
 
9339 9339
 		if (!empty($user->conf->$tmpvar)) {        // A list of fields was already customized for user
9340 9340
 			$tmparray = explode(',', $user->conf->$tmpvar);
@@ -9377,19 +9377,19 @@  discard block
 block discarded – undo
9377 9377
 				}
9378 9378
 
9379 9379
 				// Note: $val['checked'] <> 0 means we must show the field into the combo list  @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
9380
-				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
9381
-				$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
9380
+				$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox'.$key.'" value="'.$key.'"'.((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"').'/><label for="checkbox'.$key.'">'.dol_escape_htmltag($langs->trans($val['label'])).'</label></li>';
9381
+				$listcheckedstring .= (empty($val['checked']) ? '' : $key.',');
9382 9382
 			}
9383 9383
 		}
9384 9384
 
9385
-		$out = '<!-- Component multiSelectArrayWithCheckbox ' . $htmlname . ' -->
9385
+		$out = '<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
9386 9386
 
9387 9387
         <dl class="dropdown">
9388 9388
             <dt>
9389
-            <a href="#' . $htmlname . '">
9390
-              ' . img_picto('', 'list') . '
9389
+            <a href="#' . $htmlname.'">
9390
+              ' . img_picto('', 'list').'
9391 9391
             </a>
9392
-            <input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
9392
+            <input type="hidden" class="' . $htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
9393 9393
             </dt>
9394 9394
             <dd class="dropdowndd">
9395 9395
                 <div class="multiselectcheckbox'.$htmlname.'">
@@ -9401,19 +9401,19 @@  discard block
 block discarded – undo
9401 9401
             </dd>
9402 9402
         </dl>
9403 9403
 
9404
-        <script nonce="' . getNonce() . '" type="text/javascript">
9404
+        <script nonce="' . getNonce().'" type="text/javascript">
9405 9405
           jQuery(document).ready(function () {
9406
-              $(\'.multiselectcheckbox' . $htmlname . ' input[type="checkbox"]\').on(\'click\', function () {
9406
+              $(\'.multiselectcheckbox' . $htmlname.' input[type="checkbox"]\').on(\'click\', function () {
9407 9407
                   console.log("A new field was added/removed, we edit field input[name=formfilteraction]");
9408 9408
 
9409 9409
                   $("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\');	// Update field so we know we changed something on selected fields after POST
9410 9410
 
9411 9411
                   var title = $(this).val() + ",";
9412 9412
                   if ($(this).is(\':checked\')) {
9413
-                      $(\'.' . $htmlname . '\').val(title + $(\'.' . $htmlname . '\').val());
9413
+                      $(\'.' . $htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
9414 9414
                   }
9415 9415
                   else {
9416
-                      $(\'.' . $htmlname . '\').val( $(\'.' . $htmlname . '\').val().replace(title, \'\') )
9416
+                      $(\'.' . $htmlname.'\').val( $(\'.'.$htmlname.'\').val().replace(title, \'\') )
9417 9417
                   }
9418 9418
                   // Now, we submit page
9419 9419
                   //$(this).parents(\'form:first\').submit();
@@ -9444,7 +9444,7 @@  discard block
 block discarded – undo
9444 9444
 	 */
9445 9445
 	public function showCategories($id, $type, $rendermode = 0, $nolink = 0)
9446 9446
 	{
9447
-		include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
9447
+		include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
9448 9448
 
9449 9449
 		$cat = new Categorie($this->db);
9450 9450
 		$categories = $cat->containing($id, $type);
@@ -9454,13 +9454,13 @@  discard block
 block discarded – undo
9454 9454
 			foreach ($categories as $c) {
9455 9455
 				$ways = $c->print_all_ways(' &gt;&gt; ', ($nolink ? 'none' : ''), 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
9456 9456
 				foreach ($ways as $way) {
9457
-					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
9457
+					$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
9458 9458
 				}
9459 9459
 			}
9460 9460
 			if (empty($toprint)) {
9461 9461
 				return '';
9462 9462
 			} else {
9463
-				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
9463
+				return '<div class="select2-container-multi-dolibarr"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
9464 9464
 			}
9465 9465
 		}
9466 9466
 
@@ -9509,15 +9509,15 @@  discard block
 block discarded – undo
9509 9509
 
9510 9510
 
9511 9511
 			print '<div class="div-table-responsive-no-min">';
9512
-			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="' . $object->element . '"  data-elementid="' . $object->id . '"   >';
9512
+			print '<table class="noborder allwidth" data-block="showLinkedObject" data-element="'.$object->element.'"  data-elementid="'.$object->id.'"   >';
9513 9513
 
9514 9514
 			print '<tr class="liste_titre">';
9515
-			print '<td>' . $langs->trans("Type") . '</td>';
9516
-			print '<td>' . $langs->trans("Ref") . '</td>';
9515
+			print '<td>'.$langs->trans("Type").'</td>';
9516
+			print '<td>'.$langs->trans("Ref").'</td>';
9517 9517
 			print '<td class="center"></td>';
9518
-			print '<td class="center">' . $langs->trans("Date") . '</td>';
9519
-			print '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9520
-			print '<td class="right">' . $langs->trans("Status") . '</td>';
9518
+			print '<td class="center">'.$langs->trans("Date").'</td>';
9519
+			print '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9520
+			print '<td class="right">'.$langs->trans("Status").'</td>';
9521 9521
 			print '<td></td>';
9522 9522
 			print '</tr>';
9523 9523
 
@@ -9536,13 +9536,13 @@  discard block
 block discarded – undo
9536 9536
 				if ($objecttype != 'supplier_proposal' && preg_match('/^([^_]+)_([^_]+)/i', $objecttype, $regs)) {
9537 9537
 					$element = $regs[1];
9538 9538
 					$subelement = $regs[2];
9539
-					$tplpath = $element . '/' . $subelement;
9539
+					$tplpath = $element.'/'.$subelement;
9540 9540
 				}
9541 9541
 				$tplname = 'linkedobjectblock';
9542 9542
 
9543 9543
 				// To work with non standard path
9544 9544
 				if ($objecttype == 'facture') {
9545
-					$tplpath = 'compta/' . $element;
9545
+					$tplpath = 'compta/'.$element;
9546 9546
 					if (!isModEnabled('invoice')) {
9547 9547
 						continue; // Do not show if module disabled
9548 9548
 					}
@@ -9553,7 +9553,7 @@  discard block
 block discarded – undo
9553 9553
 						continue; // Do not show if module disabled
9554 9554
 					}
9555 9555
 				} elseif ($objecttype == 'propal') {
9556
-					$tplpath = 'comm/' . $element;
9556
+					$tplpath = 'comm/'.$element;
9557 9557
 					if (!isModEnabled('propal')) {
9558 9558
 						continue; // Do not show if module disabled
9559 9559
 					}
@@ -9606,7 +9606,7 @@  discard block
 block discarded – undo
9606 9606
 				$linkedObjectBlock = $objects;
9607 9607
 
9608 9608
 				// Output template part (modules that overwrite templates must declare this into descriptor)
9609
-				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/' . $tplpath . '/tpl'));
9609
+				$dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl'));
9610 9610
 				foreach ($dirtpls as $reldir) {
9611 9611
 					$reldir = rtrim($reldir, '/');
9612 9612
 					if ($nboftypesoutput == ($nbofdifferenttypes - 1)) {    // No more type to show after
@@ -9614,7 +9614,7 @@  discard block
 block discarded – undo
9614 9614
 						$noMoreLinkedObjectBlockAfter = 1;
9615 9615
 					}
9616 9616
 
9617
-					$res = @include dol_buildpath($reldir . '/' . $tplname . '.tpl.php');
9617
+					$res = @include dol_buildpath($reldir.'/'.$tplname.'.tpl.php');
9618 9618
 					if ($res) {
9619 9619
 						$nboftypesoutput++;
9620 9620
 						break;
@@ -9623,7 +9623,7 @@  discard block
 block discarded – undo
9623 9623
 			}
9624 9624
 
9625 9625
 			if (!$nboftypesoutput) {
9626
-				print '<tr><td colspan="7"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
9626
+				print '<tr><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
9627 9627
 			}
9628 9628
 
9629 9629
 			print '</table>';
@@ -9669,14 +9669,14 @@  discard block
 block discarded – undo
9669 9669
 		if (is_object($object->thirdparty) && !empty($object->thirdparty->id) && $object->thirdparty->id > 0) {
9670 9670
 			$listofidcompanytoscan = $object->thirdparty->id;
9671 9671
 			if (($object->thirdparty->parent > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PARENT_IN_LINKTO')) {
9672
-				$listofidcompanytoscan .= ',' . $object->thirdparty->parent;
9672
+				$listofidcompanytoscan .= ','.$object->thirdparty->parent;
9673 9673
 			}
9674 9674
 			if (($object->fk_project > 0) && getDolGlobalString('THIRDPARTY_INCLUDE_PROJECT_THIRDPARY_IN_LINKTO')) {
9675
-				include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
9675
+				include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
9676 9676
 				$tmpproject = new Project($this->db);
9677 9677
 				$tmpproject->fetch($object->fk_project);
9678 9678
 				if ($tmpproject->socid > 0 && ($tmpproject->socid != $object->thirdparty->id)) {
9679
-					$listofidcompanytoscan .= ',' . $tmpproject->socid;
9679
+					$listofidcompanytoscan .= ','.$tmpproject->socid;
9680 9680
 				}
9681 9681
 				unset($tmpproject);
9682 9682
 			}
@@ -9686,63 +9686,63 @@  discard block
 block discarded – undo
9686 9686
 					'enabled' => isModEnabled('propal'),
9687 9687
 					'perms' => 1,
9688 9688
 					'label' => 'LinkToProposal',
9689
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')),
9689
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')),
9690 9690
 				'shipping' => array(
9691 9691
 					'enabled' => isModEnabled('shipping'),
9692 9692
 					'perms' => 1,
9693 9693
 					'label' => 'LinkToExpedition',
9694
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : '')),
9694
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 2' : '')),
9695 9695
 				'order' => array(
9696 9696
 					'enabled' => isModEnabled('order'),
9697 9697
 					'perms' => 1,
9698 9698
 					'label' => 'LinkToOrder',
9699
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : '')),
9699
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.facture < 1' : '')),
9700 9700
 				'invoice' => array(
9701 9701
 					'enabled' => isModEnabled('invoice'),
9702 9702
 					'perms' => 1,
9703 9703
 					'label' => 'LinkToInvoice',
9704
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')),
9704
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')),
9705 9705
 				'invoice_template' => array(
9706 9706
 					'enabled' => isModEnabled('invoice'),
9707 9707
 					'perms' => 1,
9708 9708
 					'label' => 'LinkToTemplateInvoice',
9709
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')),
9709
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')),
9710 9710
 				'contrat' => array(
9711 9711
 					'enabled' => isModEnabled('contract'),
9712 9712
 					'perms' => 1,
9713 9713
 					'label' => 'LinkToContract',
9714 9714
 					'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
9715
-							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'
9715
+							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'
9716 9716
 				),
9717 9717
 				'fichinter' => array(
9718 9718
 					'enabled' => isModEnabled('intervention'),
9719 9719
 					'perms' => 1,
9720 9720
 					'label' => 'LinkToIntervention',
9721
-					'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') . ')'),
9721
+					'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').')'),
9722 9722
 				'supplier_proposal' => array(
9723 9723
 					'enabled' => isModEnabled('supplier_proposal'),
9724 9724
 					'perms' => 1,
9725 9725
 					'label' => 'LinkToSupplierProposal',
9726
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')),
9726
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 4' : '')),
9727 9727
 				'order_supplier' => array(
9728 9728
 					'enabled' => isModEnabled("supplier_order"),
9729 9729
 					'perms' => 1,
9730 9730
 					'label' => 'LinkToSupplierOrder',
9731
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : '')),
9731
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.billed < 1' : '')),
9732 9732
 				'invoice_supplier' => array(
9733 9733
 					'enabled' => isModEnabled("supplier_invoice"),
9734 9734
 					'perms' => 1, 'label' => 'LinkToSupplierInvoice',
9735
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')),
9735
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.paye < 1' : '')),
9736 9736
 				'ticket' => array(
9737 9737
 					'enabled' => isModEnabled('ticket'),
9738 9738
 					'perms' => 1,
9739 9739
 					'label' => 'LinkToTicket',
9740
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : '')),
9740
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.fk_statut < 8' : '')),
9741 9741
 				'mo' => array(
9742 9742
 					'enabled' => isModEnabled('mrp'),
9743 9743
 					'perms' => 1,
9744 9744
 					'label' => 'LinkToMo',
9745
-					'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') . ')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''))
9745
+					'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').')'.($dontIncludeCompletedItems ? ' AND t.status < 3' : ''))
9746 9746
 			);
9747 9747
 		}
9748 9748
 
@@ -9780,23 +9780,23 @@  discard block
 block discarded – undo
9780 9780
 			}
9781 9781
 
9782 9782
 			if (!empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || !in_array($key, $excludelinksto))) {
9783
-				$htmltoenteralink .= '<div id="' . $key . 'list"' . (empty($conf->use_javascript_ajax) ? '' : ' style="display:none"') . '>';
9783
+				$htmltoenteralink .= '<div id="'.$key.'list"'.(empty($conf->use_javascript_ajax) ? '' : ' style="display:none"').'>';
9784 9784
 
9785 9785
 				// Section for free ref input
9786 9786
 				if (!getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9787 9787
 					$htmltoenteralink .= '<br>'."\n";
9788 9788
 					$htmltoenteralink .= '<!-- form to add a link from anywhere -->'."\n";
9789
-					$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
9790
-					$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9789
+					$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinkedbyref'.$key.'">';
9790
+					$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9791 9791
 					$htmltoenteralink .= '<input type="hidden" name="action" value="addlinkbyref">';
9792
-					$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9793
-					$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9792
+					$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9793
+					$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9794 9794
 					$htmltoenteralink .= '<table class="noborder">';
9795 9795
 					$htmltoenteralink .= '<tr class="liste_titre">';
9796 9796
 					//print '<td>' . $langs->trans("Ref") . '</td>';
9797
-					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="' . dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')) . '">&nbsp;';
9798
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans('ToLink') . '">&nbsp;';
9799
-					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="' . $langs->trans('Cancel') . '"></td>';
9797
+					$htmltoenteralink .= '<td class="center"><input type="text" placeholder="'.dol_escape_htmltag($langs->trans("Ref")).'" name="reftolinkto" value="'.dol_escape_htmltag(GETPOST('reftolinkto', 'alpha')).'">&nbsp;';
9798
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans('ToLink').'">&nbsp;';
9799
+					$htmltoenteralink .= '<input type="submit" class="button smallpaddingimp" name="cancel" value="'.$langs->trans('Cancel').'"></td>';
9800 9800
 					$htmltoenteralink .= '</tr>';
9801 9801
 					$htmltoenteralink .= '</table>';
9802 9802
 					$htmltoenteralink .= '</form>';
@@ -9815,47 +9815,47 @@  discard block
 block discarded – undo
9815 9815
 							$htmltoenteralink .= '<br>';
9816 9816
 						}
9817 9817
 						$htmltoenteralink .= '<!-- form to add a link from object to same thirdparty -->'."\n";
9818
-						$htmltoenteralink .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinked' . $key . '">';
9819
-						$htmltoenteralink .= '<input type="hidden" name="token" value="' . newToken() . '">';
9818
+						$htmltoenteralink .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="formlinked'.$key.'">';
9819
+						$htmltoenteralink .= '<input type="hidden" name="token" value="'.newToken().'">';
9820 9820
 						$htmltoenteralink .= '<input type="hidden" name="action" value="addlink">';
9821
-						$htmltoenteralink .= '<input type="hidden" name="id" value="' . $object->id . '">';
9822
-						$htmltoenteralink .= '<input type="hidden" name="addlink" value="' . $key . '">';
9821
+						$htmltoenteralink .= '<input type="hidden" name="id" value="'.$object->id.'">';
9822
+						$htmltoenteralink .= '<input type="hidden" name="addlink" value="'.$key.'">';
9823 9823
 						$htmltoenteralink .= '<table class="noborder">';
9824 9824
 						$htmltoenteralink .= '<tr class="liste_titre">';
9825 9825
 						$htmltoenteralink .= '<td class="nowrap"></td>';
9826
-						$htmltoenteralink .= '<td>' . $langs->trans("Ref") . '</td>';
9827
-						$htmltoenteralink .= '<td>' . $langs->trans("RefCustomer") . '</td>';
9828
-						$htmltoenteralink .= '<td class="right">' . $langs->trans("AmountHTShort") . '</td>';
9829
-						$htmltoenteralink .= '<td>' . $langs->trans("Company") . '</td>';
9826
+						$htmltoenteralink .= '<td>'.$langs->trans("Ref").'</td>';
9827
+						$htmltoenteralink .= '<td>'.$langs->trans("RefCustomer").'</td>';
9828
+						$htmltoenteralink .= '<td class="right">'.$langs->trans("AmountHTShort").'</td>';
9829
+						$htmltoenteralink .= '<td>'.$langs->trans("Company").'</td>';
9830 9830
 						$htmltoenteralink .= '</tr>';
9831 9831
 						while ($i < $num) {
9832 9832
 							$objp = $this->db->fetch_object($resqllist);
9833 9833
 
9834 9834
 							$htmltoenteralink .= '<tr class="oddeven">';
9835 9835
 							$htmltoenteralink .= '<td>';
9836
-							$htmltoenteralink .= '<input type="checkbox" name="idtolinkto[' . $key . '_' . $objp->rowid . ']" id="' . $key . '_' . $objp->rowid . '" value="' . $objp->rowid . '">';
9836
+							$htmltoenteralink .= '<input type="checkbox" name="idtolinkto['.$key.'_'.$objp->rowid.']" id="'.$key.'_'.$objp->rowid.'" value="'.$objp->rowid.'">';
9837 9837
 							$htmltoenteralink .= '</td>';
9838
-							$htmltoenteralink .= '<td><label for="' . $key . '_' . $objp->rowid . '">' . $objp->ref . '</label></td>';
9839
-							$htmltoenteralink .= '<td>' . (!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')) . '</td>';
9838
+							$htmltoenteralink .= '<td><label for="'.$key.'_'.$objp->rowid.'">'.$objp->ref.'</label></td>';
9839
+							$htmltoenteralink .= '<td>'.(!empty($objp->ref_client) ? $objp->ref_client : (!empty($objp->ref_supplier) ? $objp->ref_supplier : '')).'</td>';
9840 9840
 							$htmltoenteralink .= '<td class="right">';
9841 9841
 							if ($possiblelink['label'] == 'LinkToContract') {
9842
-								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")) . ' ';
9842
+								$htmltoenteralink .= $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
9843 9843
 							}
9844
-							$htmltoenteralink .= '<span class="amount">' . (isset($objp->total_ht) ? price($objp->total_ht) : '') . '</span>';
9844
+							$htmltoenteralink .= '<span class="amount">'.(isset($objp->total_ht) ? price($objp->total_ht) : '').'</span>';
9845 9845
 							$htmltoenteralink .= '</td>';
9846
-							$htmltoenteralink .= '<td>' . $objp->name . '</td>';
9846
+							$htmltoenteralink .= '<td>'.$objp->name.'</td>';
9847 9847
 							$htmltoenteralink .= '</tr>';
9848 9848
 							$i++;
9849 9849
 						}
9850 9850
 						$htmltoenteralink .= '</table>';
9851 9851
 						$htmltoenteralink .= '<div class="center">';
9852 9852
 						if ($num) {
9853
-							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="' . $langs->trans('ToLink') . '">';
9853
+							$htmltoenteralink .= '<input type="submit" class="button valignmiddle marginleftonly marginrightonly smallpaddingimp" value="'.$langs->trans('ToLink').'">';
9854 9854
 						}
9855 9855
 						if (empty($conf->use_javascript_ajax)) {
9856
-							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9856
+							$htmltoenteralink .= '<input type="submit" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9857 9857
 						} else {
9858
-							$htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#' . $key . 'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
9858
+							$htmltoenteralink .= '<input type="submit" onclick="jQuery(\'#'.$key.'list\').toggle(); return false;" class="button button-cancel marginleftonly marginrightonly smallpaddingimp" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
9859 9859
 						}
9860 9860
 						$htmltoenteralink .= '</form>';
9861 9861
 					}
@@ -9869,10 +9869,10 @@  discard block
 block discarded – undo
9869 9869
 
9870 9870
 				// Complete the list for the combo box
9871 9871
 				if ($num > 0 || !getDolGlobalString('MAIN_HIDE_LINK_BY_REF_IN_LINKTO')) {
9872
-					$linktoelemlist .= '<li><a href="#linkto' . $key . '" class="linkto dropdowncloseonclick" rel="' . $key . '">' . $langs->trans($possiblelink['label']) . ' (' . $num . ')</a></li>';
9872
+					$linktoelemlist .= '<li><a href="#linkto'.$key.'" class="linkto dropdowncloseonclick" rel="'.$key.'">'.$langs->trans($possiblelink['label']).' ('.$num.')</a></li>';
9873 9873
 					// } else $linktoelem.=$langs->trans($possiblelink['label']);
9874 9874
 				} else {
9875
-					$linktoelemlist .= '<li><span class="linktodisabled">' . $langs->trans($possiblelink['label']) . ' (0)</span></li>';
9875
+					$linktoelemlist .= '<li><span class="linktodisabled">'.$langs->trans($possiblelink['label']).' (0)</span></li>';
9876 9876
 				}
9877 9877
 			}
9878 9878
 		}
@@ -9882,11 +9882,11 @@  discard block
 block discarded – undo
9882 9882
 			<dl class="dropdown" id="linktoobjectname">
9883 9883
 			';
9884 9884
 			if (!empty($conf->use_javascript_ajax)) {
9885
-				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>' . $langs->trans("LinkTo") . '...</a></dt>';
9885
+				$linktoelem .= '<dt><a href="#linktoobjectname"><span class="fas fa-link paddingrightonly"></span>'.$langs->trans("LinkTo").'...</a></dt>';
9886 9886
 			}
9887 9887
 			$linktoelem .= '<dd>
9888 9888
 			<div class="multiselectlinkto">
9889
-			<ul class="ulselectedfields">' . $linktoelemlist . '
9889
+			<ul class="ulselectedfields">' . $linktoelemlist.'
9890 9890
 			</ul>
9891 9891
 			</div>
9892 9892
 			</dd>
@@ -9897,7 +9897,7 @@  discard block
 block discarded – undo
9897 9897
 
9898 9898
 		if (!empty($conf->use_javascript_ajax)) {
9899 9899
 			print '<!-- Add js to show linkto box -->
9900
-				<script nonce="' . getNonce() . '">
9900
+				<script nonce="' . getNonce().'">
9901 9901
 				jQuery(document).ready(function() {
9902 9902
 					jQuery(".linkto").click(function() {
9903 9903
 						console.log("We choose to show/hide links for rel="+jQuery(this).attr(\'rel\')+" so #"+jQuery(this).attr(\'rel\')+"list");
@@ -9944,19 +9944,19 @@  discard block
 block discarded – undo
9944 9944
 
9945 9945
 		$disabled = ($disabled ? ' disabled' : '');
9946 9946
 
9947
-		$resultyesno = '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"' . $disabled . '>' . "\n";
9947
+		$resultyesno = '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"'.$disabled.'>'."\n";
9948 9948
 		if ($useempty) {
9949
-			$resultyesno .= '<option value="-1"' . (($value < 0) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
9949
+			$resultyesno .= '<option value="-1"'.(($value < 0) ? ' selected' : '').'>&nbsp;</option>'."\n";
9950 9950
 		}
9951 9951
 		if (("$value" == 'yes') || ($value == 1)) {
9952
-			$resultyesno .= '<option value="' . $yes . '" selected>' . $langs->trans($labelyes) . '</option>' . "\n";
9953
-			$resultyesno .= '<option value="' . $no . '">' . $langs->trans($labelno) . '</option>' . "\n";
9952
+			$resultyesno .= '<option value="'.$yes.'" selected>'.$langs->trans($labelyes).'</option>'."\n";
9953
+			$resultyesno .= '<option value="'.$no.'">'.$langs->trans($labelno).'</option>'."\n";
9954 9954
 		} else {
9955 9955
 			$selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected');
9956
-			$resultyesno .= '<option value="' . $yes . '">' . $langs->trans($labelyes) . '</option>' . "\n";
9957
-			$resultyesno .= '<option value="' . $no . '"' . $selected . '>' . $langs->trans($labelno) . '</option>' . "\n";
9956
+			$resultyesno .= '<option value="'.$yes.'">'.$langs->trans($labelyes).'</option>'."\n";
9957
+			$resultyesno .= '<option value="'.$no.'"'.$selected.'>'.$langs->trans($labelno).'</option>'."\n";
9958 9958
 		}
9959
-		$resultyesno .= '</select>' . "\n";
9959
+		$resultyesno .= '</select>'."\n";
9960 9960
 
9961 9961
 		if ($addjscombo) {
9962 9962
 			$resultyesno .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($useempty < 0 ? (string) $useempty : '-1'), $morecss);
@@ -9980,12 +9980,12 @@  discard block
 block discarded – undo
9980 9980
 	{
9981 9981
 		// phpcs:enable
9982 9982
 		$sql = "SELECT rowid, label";
9983
-		$sql .= " FROM " . $this->db->prefix() . "export_model";
9984
-		$sql .= " WHERE type = '" . $this->db->escape($type) . "'";
9983
+		$sql .= " FROM ".$this->db->prefix()."export_model";
9984
+		$sql .= " WHERE type = '".$this->db->escape($type)."'";
9985 9985
 		$sql .= " ORDER BY rowid";
9986 9986
 		$result = $this->db->query($sql);
9987 9987
 		if ($result) {
9988
-			print '<select class="flat" id="select_' . $htmlname . '" name="' . $htmlname . '">';
9988
+			print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
9989 9989
 			if ($useempty) {
9990 9990
 				print '<option value="-1">&nbsp;</option>';
9991 9991
 			}
@@ -9995,9 +9995,9 @@  discard block
 block discarded – undo
9995 9995
 			while ($i < $num) {
9996 9996
 				$obj = $this->db->fetch_object($result);
9997 9997
 				if ($selected == $obj->rowid) {
9998
-					print '<option value="' . $obj->rowid . '" selected>';
9998
+					print '<option value="'.$obj->rowid.'" selected>';
9999 9999
 				} else {
10000
-					print '<option value="' . $obj->rowid . '">';
10000
+					print '<option value="'.$obj->rowid.'">';
10001 10001
 				}
10002 10002
 				print $obj->label;
10003 10003
 				print '</option>';
@@ -10088,8 +10088,8 @@  discard block
 block discarded – undo
10088 10088
 				$stringforfirstkey .= ' CTL +';
10089 10089
 			}
10090 10090
 
10091
-			$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>';
10092
-			$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>';
10091
+			$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>';
10092
+			$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>';
10093 10093
 		}
10094 10094
 
10095 10095
 		//print "xx".$previous_ref."x".$next_ref;
@@ -10097,18 +10097,18 @@  discard block
 block discarded – undo
10097 10097
 
10098 10098
 		// Right part of banner
10099 10099
 		if ($morehtmlright) {
10100
-			$ret .= '<div class="inline-block floatleft">' . $morehtmlright . '</div>';
10100
+			$ret .= '<div class="inline-block floatleft">'.$morehtmlright.'</div>';
10101 10101
 		}
10102 10102
 
10103 10103
 		if ($previous_ref || $next_ref || $morehtml) {
10104 10104
 			$ret .= '<div class="pagination paginationref"><ul class="right">';
10105 10105
 		}
10106 10106
 		if ($morehtml && getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') < 2) {
10107
-			$ret .= '<!-- morehtml --><li class="noborder litext' . (($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '') . '">' . $morehtml . '</li>';
10107
+			$ret .= '<!-- morehtml --><li class="noborder litext'.(($shownav && $previous_ref && $next_ref) ? ' clearbothonsmartphone' : '').'">'.$morehtml.'</li>';
10108 10108
 		}
10109 10109
 		if ($shownav && ($previous_ref || $next_ref)) {
10110
-			$ret .= '<li class="pagination">' . $previous_ref . '</li>';
10111
-			$ret .= '<li class="pagination">' . $next_ref . '</li>';
10110
+			$ret .= '<li class="pagination">'.$previous_ref.'</li>';
10111
+			$ret .= '<li class="pagination">'.$next_ref.'</li>';
10112 10112
 		}
10113 10113
 		if ($previous_ref || $next_ref || $morehtml) {
10114 10114
 			$ret .= '</ul></div>';
@@ -10123,7 +10123,7 @@  discard block
 block discarded – undo
10123 10123
 			$morehtmlstatus = $hookmanager->resPrint;
10124 10124
 		}
10125 10125
 		if ($morehtmlstatus) {
10126
-			$ret .= '<div class="statusref">' . $morehtmlstatus . '</div>';
10126
+			$ret .= '<div class="statusref">'.$morehtmlstatus.'</div>';
10127 10127
 		}
10128 10128
 
10129 10129
 		$parameters = array();
@@ -10137,14 +10137,14 @@  discard block
 block discarded – undo
10137 10137
 		// Left part of banner
10138 10138
 		if ($morehtmlleft) {
10139 10139
 			if ($conf->browser->layout == 'phone') {
10140
-				$ret .= '<!-- morehtmlleft --><div class="floatleft">' . $morehtmlleft . '</div>';
10140
+				$ret .= '<!-- morehtmlleft --><div class="floatleft">'.$morehtmlleft.'</div>';
10141 10141
 			} else {
10142
-				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">' . $morehtmlleft . '</div>';
10142
+				$ret .= '<!-- morehtmlleft --><div class="inline-block floatleft">'.$morehtmlleft.'</div>';
10143 10143
 			}
10144 10144
 		}
10145 10145
 
10146 10146
 		//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
10147
-		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid' . (($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '') . '">';
10147
+		$ret .= '<div class="inline-block floatleft valignmiddle maxwidth750 marginbottomonly refid'.(($shownav && ($previous_ref || $next_ref)) ? ' refidpadding' : '').'">';
10148 10148
 
10149 10149
 		// For thirdparty, contact, user, member, the ref is the id, so we show something else
10150 10150
 		if ($object->element == 'societe') {
@@ -10158,7 +10158,7 @@  discard block
 block discarded – undo
10158 10158
 
10159 10159
 			if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
10160 10160
 				if (!is_object($extralanguages)) {
10161
-					include_once DOL_DOCUMENT_ROOT . '/core/class/extralanguages.class.php';
10161
+					include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
10162 10162
 					$extralanguages = new ExtraLanguages($this->db);
10163 10163
 				}
10164 10164
 				$extralanguages->fetch_name_extralanguages('societe');
@@ -10173,21 +10173,21 @@  discard block
 block discarded – undo
10173 10173
 						if ($object->array_languages['name'][$extralangcode]) {
10174 10174
 							$htmltext .= $object->array_languages['name'][$extralangcode];
10175 10175
 						} else {
10176
-							$htmltext .= '<span class="opacitymedium">' . $langs->trans("SwitchInEditModeToAddTranslation") . '</span>';
10176
+							$htmltext .= '<span class="opacitymedium">'.$langs->trans("SwitchInEditModeToAddTranslation").'</span>';
10177 10177
 						}
10178 10178
 					}
10179
-					$ret .= '<!-- Show translations of name -->' . "\n";
10179
+					$ret .= '<!-- Show translations of name -->'."\n";
10180 10180
 					$ret .= $this->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
10181 10181
 				}
10182 10182
 			}
10183 10183
 		} elseif ($object->element == 'member') {
10184 10184
 			'@phan-var-force Adherent $object';
10185
-			$ret .= $object->ref . '<br>';
10185
+			$ret .= $object->ref.'<br>';
10186 10186
 			$fullname = $object->getFullName($langs);
10187 10187
 			if ($object->morphy == 'mor' && $object->societe) {
10188
-				$ret .= dol_htmlentities($object->societe) . ((!empty($fullname) && $object->societe != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '');
10188
+				$ret .= dol_htmlentities($object->societe).((!empty($fullname) && $object->societe != $fullname) ? ' ('.dol_htmlentities($fullname).$addgendertxt.')' : '');
10189 10189
 			} else {
10190
-				$ret .= dol_htmlentities($fullname) . $addgendertxt . ((!empty($object->societe) && $object->societe != $fullname) ? ' (' . dol_htmlentities($object->societe) . ')' : '');
10190
+				$ret .= dol_htmlentities($fullname).$addgendertxt.((!empty($object->societe) && $object->societe != $fullname) ? ' ('.dol_htmlentities($object->societe).')' : '');
10191 10191
 			}
10192 10192
 		} elseif (in_array($object->element, array('contact', 'user'))) {
10193 10193
 			$ret .= '<span class="valignmiddle">'.dol_htmlentities($object->getFullName($langs)).'</span>'.$addgendertxt;
@@ -10195,7 +10195,7 @@  discard block
 block discarded – undo
10195 10195
 			$ret .= dol_htmlentities($object->name);
10196 10196
 		} elseif (in_array($object->element, array('action', 'agenda'))) {
10197 10197
 			'@phan-var-force ActionComm $object';
10198
-			$ret .= $object->ref . '<br>' . $object->label;
10198
+			$ret .= $object->ref.'<br>'.$object->label;
10199 10199
 		} elseif (in_array($object->element, array('adherent_type'))) {
10200 10200
 			$ret .= $object->label;
10201 10201
 		} elseif ($object->element == 'ecm_directories') {
@@ -10248,9 +10248,9 @@  discard block
 block discarded – undo
10248 10248
 		}
10249 10249
 
10250 10250
 		// Barcode image  @phan-suppress-next-line PhanUndeclaredProperty
10251
-		$url = DOL_URL_ROOT . '/viewimage.php?modulepart=barcode&generator=' . urlencode($object->barcode_type_coder) . '&code=' . urlencode($object->barcode) . '&encoding=' . urlencode($object->barcode_type_code);
10252
-		$out = '<!-- url barcode = ' . $url . ' -->';
10253
-		$out .= '<img src="' . $url . '"' . ($morecss ? ' class="' . $morecss . '"' : '') . '>';
10251
+		$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&generator='.urlencode($object->barcode_type_coder).'&code='.urlencode($object->barcode).'&encoding='.urlencode($object->barcode_type_code);
10252
+		$out = '<!-- url barcode = '.$url.' -->';
10253
+		$out .= '<img src="'.$url.'"'.($morecss ? ' class="'.$morecss.'"' : '').'>';
10254 10254
 
10255 10255
 		return $out;
10256 10256
 	}
@@ -10277,7 +10277,7 @@  discard block
 block discarded – undo
10277 10277
 		global $conf, $langs;
10278 10278
 
10279 10279
 		$entity = (empty($object->entity) ? $conf->entity : $object->entity);
10280
-		$id = (empty($object->id) ? $object->rowid : $object->id);  // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10280
+		$id = (empty($object->id) ? $object->rowid : $object->id); // @phan-suppress-current-line PhanUndeclaredProperty (->rowid)
10281 10281
 
10282 10282
 		$dir = '';
10283 10283
 		$file = '';
@@ -10290,28 +10290,28 @@  discard block
 block discarded – undo
10290 10290
 			if (!empty($object->logo)) {
10291 10291
 				if (dolIsAllowedForPreview($object->logo)) {
10292 10292
 					if ((string) $imagesize == 'mini') {
10293
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10293
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs
10294 10294
 					} elseif ((string) $imagesize == 'small') {
10295
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . getImageFileNameForSize($object->logo, '_small');
10295
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.getImageFileNameForSize($object->logo, '_small');
10296 10296
 					} else {
10297
-						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10297
+						$file = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10298 10298
 					}
10299
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty') . 'logos/' . $object->logo;
10299
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'thirdparty').'logos/'.$object->logo;
10300 10300
 				}
10301 10301
 			}
10302 10302
 			$email = $object->email;
10303 10303
 		} elseif ($modulepart == 'contact') {
10304
-			$dir = $conf->societe->multidir_output[$entity] . '/contact';
10304
+			$dir = $conf->societe->multidir_output[$entity].'/contact';
10305 10305
 			if (!empty($object->photo)) {
10306 10306
 				if (dolIsAllowedForPreview($object->photo)) {
10307 10307
 					if ((string) $imagesize == 'mini') {
10308
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10308
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10309 10309
 					} elseif ((string) $imagesize == 'small') {
10310
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10310
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.getImageFileNameForSize($object->photo, '_small');
10311 10311
 					} else {
10312
-						$file = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10312
+						$file = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10313 10313
 					}
10314
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact') . 'photos/' . $object->photo;
10314
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'contact').'photos/'.$object->photo;
10315 10315
 				}
10316 10316
 			}
10317 10317
 			$email = $object->email;
@@ -10321,17 +10321,17 @@  discard block
 block discarded – undo
10321 10321
 			if (!empty($object->photo)) {
10322 10322
 				if (dolIsAllowedForPreview($object->photo)) {
10323 10323
 					if ((string) $imagesize == 'mini') {
10324
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10324
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10325 10325
 					} elseif ((string) $imagesize == 'small') {
10326
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10326
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.getImageFileNameForSize($object->photo, '_small');
10327 10327
 					} else {
10328
-						$file = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10328
+						$file = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10329 10329
 					}
10330
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user') . 'photos/' . $object->photo;
10330
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'user').'photos/'.$object->photo;
10331 10331
 				}
10332 10332
 			}
10333 10333
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10334
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10334
+				$altfile = $object->id.".jpg"; // For backward compatibility
10335 10335
 			}
10336 10336
 			$email = $object->email;
10337 10337
 			$capture = 'user';
@@ -10340,17 +10340,17 @@  discard block
 block discarded – undo
10340 10340
 			if (!empty($object->photo)) {
10341 10341
 				if (dolIsAllowedForPreview($object->photo)) {
10342 10342
 					if ((string) $imagesize == 'mini') {
10343
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_mini');
10343
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini');
10344 10344
 					} elseif ((string) $imagesize == 'small') {
10345
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . getImageFileNameForSize($object->photo, '_small');
10345
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small');
10346 10346
 					} else {
10347
-						$file = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10347
+						$file = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10348 10348
 					}
10349
-					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member') . 'photos/' . $object->photo;
10349
+					$originalfile = get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo;
10350 10350
 				}
10351 10351
 			}
10352 10352
 			if (getDolGlobalString('MAIN_OLD_IMAGE_LINKS')) {
10353
-				$altfile = $object->id . ".jpg"; // For backward compatibility
10353
+				$altfile = $object->id.".jpg"; // For backward compatibility
10354 10354
 			}
10355 10355
 			$email = $object->email;
10356 10356
 			$capture = 'user';
@@ -10376,35 +10376,35 @@  discard block
 block discarded – undo
10376 10376
 		$ret = '';
10377 10377
 
10378 10378
 		if ($dir) {
10379
-			if ($file && file_exists($dir . "/" . $file)) {
10379
+			if ($file && file_exists($dir."/".$file)) {
10380 10380
 				if ($addlinktofullsize) {
10381
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10381
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10382 10382
 					if ($urladvanced) {
10383
-						$ret .= '<a href="' . $urladvanced . '">';
10383
+						$ret .= '<a href="'.$urladvanced.'">';
10384 10384
 					} else {
10385
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10385
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10386 10386
 					}
10387 10387
 				}
10388
-				$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 . '">';
10388
+				$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.'">';
10389 10389
 				if ($addlinktofullsize) {
10390 10390
 					$ret .= '</a>';
10391 10391
 				}
10392
-			} elseif ($altfile && file_exists($dir . "/" . $altfile)) {
10392
+			} elseif ($altfile && file_exists($dir."/".$altfile)) {
10393 10393
 				if ($addlinktofullsize) {
10394
-					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity=' . $entity);
10394
+					$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
10395 10395
 					if ($urladvanced) {
10396
-						$ret .= '<a href="' . $urladvanced . '">';
10396
+						$ret .= '<a href="'.$urladvanced.'">';
10397 10397
 					} else {
10398
-						$ret .= '<a href="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $entity . '&file=' . urlencode($originalfile) . '&cache=' . $cache . '">';
10398
+						$ret .= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($originalfile).'&cache='.$cache.'">';
10399 10399
 					}
10400 10400
 				}
10401
-				$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 . '">';
10401
+				$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.'">';
10402 10402
 				if ($addlinktofullsize) {
10403 10403
 					$ret .= '</a>';
10404 10404
 				}
10405 10405
 			} else {
10406 10406
 				$nophoto = '/public/theme/common/nophoto.png';
10407
-				$defaultimg = 'identicon';        // For gravatar
10407
+				$defaultimg = 'identicon'; // For gravatar
10408 10408
 				if (in_array($modulepart, array('societe', 'userphoto', 'contact', 'memberphoto'))) {    // For modules that need a special image when photo not found
10409 10409
 					if ($modulepart == 'societe' || ($modulepart == 'memberphoto' && !empty($object->morphy) && strpos($object->morphy, 'mor') !== false)) {
10410 10410
 						$nophoto = 'company';
@@ -10422,13 +10422,13 @@  discard block
 block discarded – undo
10422 10422
 				if (isModEnabled('gravatar') && $email && empty($noexternsourceoverwrite)) {
10423 10423
 					// see https://gravatar.com/site/implement/images/php/
10424 10424
 					$ret .= '<!-- Put link to gravatar -->';
10425
-					$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
10425
+					$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
10426 10426
 				} else {
10427 10427
 					if ($nophoto == 'company') {
10428
-						$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
10428
+						$ret .= '<div class="divforspanimg valignmiddle center photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').'>'.img_picto('', 'company').'</div>';
10429 10429
 						//$ret .= '<div class="difforspanimgright"></div>';
10430 10430
 					} else {
10431
-						$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
10431
+						$ret .= '<img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="" '.($width ? ' width="'.$width.'"' : '').($height ? ' height="'.$height.'"' : '').' src="'.DOL_URL_ROOT.$nophoto.'">';
10432 10432
 					}
10433 10433
 				}
10434 10434
 			}
@@ -10439,15 +10439,15 @@  discard block
 block discarded – undo
10439 10439
 				}
10440 10440
 				$ret .= '<table class="nobordernopadding centpercent">';
10441 10441
 				if ($object->photo) {
10442
-					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">' . $langs->trans("Delete") . '</label><br><br></td></tr>';
10442
+					$ret .= '<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> <label for="photodelete">'.$langs->trans("Delete").'</label><br><br></td></tr>';
10443 10443
 				}
10444 10444
 				$ret .= '<tr><td class="tdoverflow">';
10445 10445
 				$maxfilesizearray = getMaxFileSizeArray();
10446 10446
 				$maxmin = $maxfilesizearray['maxmin'];
10447 10447
 				if ($maxmin > 0) {
10448
-					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="' . ($maxmin * 1024) . '">';    // MAX_FILE_SIZE must precede the field type=file
10448
+					$ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
10449 10449
 				}
10450
-				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"' . ($capture ? ' capture="' . $capture . '"' : '') . '>';
10450
+				$ret .= '<input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput" accept="image/*"'.($capture ? ' capture="'.$capture.'"' : '').'>';
10451 10451
 				$ret .= '</td></tr>';
10452 10452
 				$ret .= '</table>';
10453 10453
 			}
@@ -10501,38 +10501,38 @@  discard block
 block discarded – undo
10501 10501
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10502 10502
 			$sql .= ", e.label";
10503 10503
 		}
10504
-		$sql .= " FROM " . $this->db->prefix() . "usergroup as ug ";
10504
+		$sql .= " FROM ".$this->db->prefix()."usergroup as ug ";
10505 10505
 		if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
10506
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid=ug.entity";
10506
+			$sql .= " LEFT JOIN ".$this->db->prefix()."entity as e ON e.rowid=ug.entity";
10507 10507
 			if ($force_entity) {
10508
-				$sql .= " WHERE ug.entity IN (0, " . $force_entity . ")";
10508
+				$sql .= " WHERE ug.entity IN (0, ".$force_entity.")";
10509 10509
 			} else {
10510 10510
 				$sql .= " WHERE ug.entity IS NOT NULL";
10511 10511
 			}
10512 10512
 		} else {
10513
-			$sql .= " WHERE ug.entity IN (0, " . $conf->entity . ")";
10513
+			$sql .= " WHERE ug.entity IN (0, ".$conf->entity.")";
10514 10514
 		}
10515 10515
 		if (is_array($exclude) && $excludeGroups) {
10516
-			$sql .= " AND ug.rowid NOT IN (" . $this->db->sanitize($excludeGroups) . ")";
10516
+			$sql .= " AND ug.rowid NOT IN (".$this->db->sanitize($excludeGroups).")";
10517 10517
 		}
10518 10518
 		if (is_array($include) && $includeGroups) {
10519
-			$sql .= " AND ug.rowid IN (" . $this->db->sanitize($includeGroups) . ")";
10519
+			$sql .= " AND ug.rowid IN (".$this->db->sanitize($includeGroups).")";
10520 10520
 		}
10521 10521
 		$sql .= " ORDER BY ug.nom ASC";
10522 10522
 
10523
-		dol_syslog(get_class($this) . "::select_dolgroups", LOG_DEBUG);
10523
+		dol_syslog(get_class($this)."::select_dolgroups", LOG_DEBUG);
10524 10524
 		$resql = $this->db->query($sql);
10525 10525
 		if ($resql) {
10526 10526
 			// Enhance with select2
10527
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10527
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10528 10528
 
10529
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . ' ' . ($disabled ? ' disabled' : '') . '>';
10529
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
10530 10530
 
10531 10531
 			$num = $this->db->num_rows($resql);
10532 10532
 			$i = 0;
10533 10533
 			if ($num) {
10534 10534
 				if ($show_empty && !$multiple) {
10535
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '>&nbsp;</option>' . "\n";
10535
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'>&nbsp;</option>'."\n";
10536 10536
 				}
10537 10537
 
10538 10538
 				while ($i < $num) {
@@ -10545,11 +10545,11 @@  discard block
 block discarded – undo
10545 10545
 					$label = $obj->name;
10546 10546
 					$labelhtml = $obj->name;
10547 10547
 					if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1) {
10548
-						$label .= " (" . $obj->label . ")";
10549
-						$labelhtml .= ' <span class="opacitymedium">(' . $obj->label . ')</span>';
10548
+						$label .= " (".$obj->label.")";
10549
+						$labelhtml .= ' <span class="opacitymedium">('.$obj->label.')</span>';
10550 10550
 					}
10551 10551
 
10552
-					$out .= '<option value="' . $obj->rowid . '"';
10552
+					$out .= '<option value="'.$obj->rowid.'"';
10553 10553
 					if ($disableline) {
10554 10554
 						$out .= ' disabled';
10555 10555
 					}
@@ -10565,9 +10565,9 @@  discard block
 block discarded – undo
10565 10565
 				}
10566 10566
 			} else {
10567 10567
 				if ($show_empty) {
10568
-					$out .= '<option value="-1"' . (in_array(-1, $selected) ? ' selected' : '') . '></option>' . "\n";
10568
+					$out .= '<option value="-1"'.(in_array(-1, $selected) ? ' selected' : '').'></option>'."\n";
10569 10569
 				}
10570
-				$out .= '<option value="" disabled>' . $langs->trans("NoUserGroupDefined") . '</option>';
10570
+				$out .= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
10571 10571
 			}
10572 10572
 			$out .= '</select>';
10573 10573
 
@@ -10611,25 +10611,25 @@  discard block
 block discarded – undo
10611 10611
 		$out = '';
10612 10612
 
10613 10613
 		if (!empty($conf->use_javascript_ajax)) {
10614
-			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="' . $cssclass . 's" name="' . $cssclass . 's" class="checkallactions"></div>';
10614
+			$out .= '<div class="inline-block checkallactions"><input type="checkbox" id="'.$cssclass.'s" name="'.$cssclass.'s" class="checkallactions"></div>';
10615 10615
 		}
10616
-		$out .= '<script nonce="' . getNonce() . '">
10616
+		$out .= '<script nonce="'.getNonce().'">
10617 10617
             $(document).ready(function() {
10618
-                $("#' . $cssclass . 's").click(function() {
10618
+                $("#' . $cssclass.'s").click(function() {
10619 10619
                     if($(this).is(\':checked\')){
10620
-                        console.log("We check all ' . $cssclass . ' and trigger the change method");
10621
-                		$(".' . $cssclass . '").prop(\'checked\', true).trigger(\'change\');
10620
+                        console.log("We check all ' . $cssclass.' and trigger the change method");
10621
+                		$(".' . $cssclass.'").prop(\'checked\', true).trigger(\'change\');
10622 10622
                     }
10623 10623
                     else
10624 10624
                     {
10625 10625
                         console.log("We uncheck all");
10626
-                		$(".' . $cssclass . '").prop(\'checked\', false).trigger(\'change\');
10626
+                		$(".' . $cssclass.'").prop(\'checked\', false).trigger(\'change\');
10627 10627
                     }' . "\n";
10628 10628
 		if ($calljsfunction) {
10629
-			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "' . $massactionname . '", "' . $cssclass . '"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10629
+			$out .= 'if (typeof initCheckForSelect == \'function\') { initCheckForSelect(0, "'.$massactionname.'", "'.$cssclass.'"); } else { console.log("No function initCheckForSelect found. Call won\'t be done."); }';
10630 10630
 		}
10631 10631
 		$out .= '         });
10632
-        	        $(".' . $cssclass . '").change(function() {
10632
+        	        $(".' . $cssclass.'").change(function() {
10633 10633
 					$(this).closest("tr").toggleClass("highlight", this.checked);
10634 10634
 				});
10635 10635
 		 	});
@@ -10674,67 +10674,67 @@  discard block
 block discarded – undo
10674 10674
 		global $langs, $user;
10675 10675
 
10676 10676
 		$out = '';
10677
-		$sql = "SELECT rowid, label FROM " . $this->db->prefix() . "c_exp_tax_cat WHERE active = 1";
10678
-		$sql .= " AND entity IN (0," . getEntity('exp_tax_cat') . ")";
10677
+		$sql = "SELECT rowid, label FROM ".$this->db->prefix()."c_exp_tax_cat WHERE active = 1";
10678
+		$sql .= " AND entity IN (0,".getEntity('exp_tax_cat').")";
10679 10679
 		if (!empty($excludeid)) {
10680
-			$sql .= " AND rowid NOT IN (" . $this->db->sanitize(implode(',', $excludeid)) . ")";
10680
+			$sql .= " AND rowid NOT IN (".$this->db->sanitize(implode(',', $excludeid)).")";
10681 10681
 		}
10682 10682
 		$sql .= " ORDER BY label";
10683 10683
 
10684 10684
 		$resql = $this->db->query($sql);
10685 10685
 		if ($resql) {
10686
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp maxwidth200">';
10686
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp maxwidth200">';
10687 10687
 			if ($useempty) {
10688 10688
 				$out .= '<option value="0">&nbsp;</option>';
10689 10689
 			}
10690 10690
 
10691 10691
 			while ($obj = $this->db->fetch_object($resql)) {
10692
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . $langs->trans($obj->label) . '</option>';
10692
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.$langs->trans($obj->label).'</option>';
10693 10693
 			}
10694 10694
 			$out .= '</select>';
10695
-			$out .= ajax_combobox('select_' . $htmlname);
10695
+			$out .= ajax_combobox('select_'.$htmlname);
10696 10696
 
10697 10697
 			if (!empty($htmlname) && $user->admin && $info_admin) {
10698
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10698
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
10699 10699
 			}
10700 10700
 
10701 10701
 			if (!empty($target)) {
10702
-				$sql = "SELECT c.id FROM " . $this->db->prefix() . "c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10702
+				$sql = "SELECT c.id FROM ".$this->db->prefix()."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1";
10703 10703
 				$resql = $this->db->query($sql);
10704 10704
 				if ($resql) {
10705 10705
 					if ($this->db->num_rows($resql) > 0) {
10706 10706
 						$obj = $this->db->fetch_object($resql);
10707
-						$out .= '<script nonce="' . getNonce() . '">
10707
+						$out .= '<script nonce="'.getNonce().'">
10708 10708
 							$(function() {
10709
-								$("select[name=' . $target . ']").on("change", function() {
10709
+								$("select[name=' . $target.']").on("change", function() {
10710 10710
 									var current_val = $(this).val();
10711
-									if (current_val == ' . $obj->id . ') {';
10711
+									if (current_val == ' . $obj->id.') {';
10712 10712
 						if (!empty($default_selected) || !empty($selected)) {
10713
-							$out .= '$("select[name=' . $htmlname . ']").val("' . ($default_selected > 0 ? $default_selected : $selected) . '");';
10713
+							$out .= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");';
10714 10714
 						}
10715 10715
 
10716 10716
 						$out .= '
10717
-										$("select[name=' . $htmlname . ']").change();
10717
+										$("select[name=' . $htmlname.']").change();
10718 10718
 									}
10719 10719
 								});
10720 10720
 
10721
-								$("select[name=' . $htmlname . ']").change(function() {
10721
+								$("select[name=' . $htmlname.']").change(function() {
10722 10722
 
10723
-									if ($("select[name=' . $target . ']").val() == ' . $obj->id . ') {
10723
+									if ($("select[name=' . $target.']").val() == '.$obj->id.') {
10724 10724
 										// get price of kilometer to fill the unit price
10725 10725
 										$.ajax({
10726 10726
 											method: "POST",
10727 10727
 											dataType: "json",
10728
-											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken() . '\' },
10729
-											url: "' . (DOL_URL_ROOT . '/expensereport/ajax/ajaxik.php?' . implode('&', $params)) . '",
10728
+											data: { fk_c_exp_tax_cat: $(this).val(), token: \'' . currentToken().'\' },
10729
+											url: "' . (DOL_URL_ROOT.'/expensereport/ajax/ajaxik.php?'.implode('&', $params)).'",
10730 10730
 										}).done(function( data, textStatus, jqXHR ) {
10731 10731
 											console.log(data);
10732 10732
 											if (typeof data.up != "undefined") {
10733 10733
 												$("input[name=value_unit]").val(data.up);
10734
-												$("select[name=' . $htmlname . ']").attr("title", data.title);
10734
+												$("select[name=' . $htmlname.']").attr("title", data.title);
10735 10735
 											} else {
10736 10736
 												$("input[name=value_unit]").val("");
10737
-												$("select[name=' . $htmlname . ']").attr("title", "");
10737
+												$("select[name=' . $htmlname.']").attr("title", "");
10738 10738
 											}
10739 10739
 										});
10740 10740
 									}
@@ -10764,18 +10764,18 @@  discard block
 block discarded – undo
10764 10764
 		global $conf, $langs;
10765 10765
 
10766 10766
 		$out = '';
10767
-		$sql = "SELECT rowid, range_ik FROM " . $this->db->prefix() . "c_exp_tax_range";
10768
-		$sql .= " WHERE entity = " . $conf->entity . " AND active = 1";
10767
+		$sql = "SELECT rowid, range_ik FROM ".$this->db->prefix()."c_exp_tax_range";
10768
+		$sql .= " WHERE entity = ".$conf->entity." AND active = 1";
10769 10769
 
10770 10770
 		$resql = $this->db->query($sql);
10771 10771
 		if ($resql) {
10772
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10772
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10773 10773
 			if ($useempty) {
10774 10774
 				$out .= '<option value="0"></option>';
10775 10775
 			}
10776 10776
 
10777 10777
 			while ($obj = $this->db->fetch_object($resql)) {
10778
-				$out .= '<option ' . ($selected == $obj->rowid ? 'selected="selected"' : '') . ' value="' . $obj->rowid . '">' . price($obj->range_ik, 0, $langs, 1, 0) . '</option>';
10778
+				$out .= '<option '.($selected == $obj->rowid ? 'selected="selected"' : '').' value="'.$obj->rowid.'">'.price($obj->range_ik, 0, $langs, 1, 0).'</option>';
10779 10779
 			}
10780 10780
 			$out .= '</select>';
10781 10781
 		} else {
@@ -10806,12 +10806,12 @@  discard block
 block discarded – undo
10806 10806
 
10807 10807
 		$resql = $this->db->query($sql);
10808 10808
 		if ($resql) {
10809
-			$out = '<select id="select_' . $htmlname . '" name="' . $htmlname . '" class="' . $htmlname . ' flat minwidth75imp">';
10809
+			$out = '<select id="select_'.$htmlname.'" name="'.$htmlname.'" class="'.$htmlname.' flat minwidth75imp">';
10810 10810
 			if ($useempty) {
10811 10811
 				$out .= '<option value="0"></option>';
10812 10812
 			}
10813 10813
 			if ($allchoice) {
10814
-				$out .= '<option value="-1">' . $langs->trans('AllExpenseReport') . '</option>';
10814
+				$out .= '<option value="-1">'.$langs->trans('AllExpenseReport').'</option>';
10815 10815
 			}
10816 10816
 
10817 10817
 			$field = 'code';
@@ -10821,7 +10821,7 @@  discard block
 block discarded – undo
10821 10821
 
10822 10822
 			while ($obj = $this->db->fetch_object($resql)) {
10823 10823
 				$key = $langs->trans($obj->code);
10824
-				$out .= '<option ' . ($selected == $obj->{$field} ? 'selected="selected"' : '') . ' value="' . $obj->{$field} . '">' . ($key != $obj->code ? $key : $obj->label) . '</option>';
10824
+				$out .= '<option '.($selected == $obj->{$field} ? 'selected="selected"' : '').' value="'.$obj->{$field}.'">'.($key != $obj->code ? $key : $obj->label).'</option>';
10825 10825
 			}
10826 10826
 			$out .= '</select>';
10827 10827
 
@@ -10855,7 +10855,7 @@  discard block
 block discarded – undo
10855 10855
 	{
10856 10856
 		global $user, $conf, $langs;
10857 10857
 
10858
-		require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
10858
+		require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
10859 10859
 
10860 10860
 		if (is_null($usertofilter)) {
10861 10861
 			$usertofilter = $user;
@@ -10879,10 +10879,10 @@  discard block
 block discarded – undo
10879 10879
 		$sql = "SELECT f.rowid, f.ref as fref, 'nolabel' as flabel, p.rowid as pid, f.ref,
10880 10880
             p.title, p.fk_soc, p.fk_statut, p.public,";
10881 10881
 		$sql .= ' s.nom as name';
10882
-		$sql .= ' FROM ' . $this->db->prefix() . 'projet as p';
10883
-		$sql .= ' LEFT JOIN ' . $this->db->prefix() . 'societe as s ON s.rowid = p.fk_soc,';
10884
-		$sql .= ' ' . $this->db->prefix() . 'facture as f';
10885
-		$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
10882
+		$sql .= ' FROM '.$this->db->prefix().'projet as p';
10883
+		$sql .= ' LEFT JOIN '.$this->db->prefix().'societe as s ON s.rowid = p.fk_soc,';
10884
+		$sql .= ' '.$this->db->prefix().'facture as f';
10885
+		$sql .= " WHERE p.entity IN (".getEntity('project').")";
10886 10886
 		$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
10887 10887
 		//if ($projectsListId) $sql.= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
10888 10888
 		//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
@@ -10893,14 +10893,14 @@  discard block
 block discarded – undo
10893 10893
 		if ($resql) {
10894 10894
 			// Use select2 selector
10895 10895
 			if (!empty($conf->use_javascript_ajax)) {
10896
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
10896
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
10897 10897
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
10898 10898
 				$out .= $comboenhancement;
10899 10899
 				$morecss = 'minwidth200imp maxwidth500';
10900 10900
 			}
10901 10901
 
10902 10902
 			if (empty($option_only)) {
10903
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
10903
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
10904 10904
 			}
10905 10905
 			if (!empty($show_empty)) {
10906 10906
 				$out .= '<option value="0" class="optiongrey">';
@@ -10930,33 +10930,33 @@  discard block
 block discarded – undo
10930 10930
 						if ($showproject == 'all') {
10931 10931
 							$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
10932 10932
 							if ($obj->name) {
10933
-								$labeltoshow .= ' - ' . $obj->name; // Soc name
10933
+								$labeltoshow .= ' - '.$obj->name; // Soc name
10934 10934
 							}
10935 10935
 
10936 10936
 							$disabled = 0;
10937 10937
 							if ($obj->fk_statut == Project::STATUS_DRAFT) {
10938 10938
 								$disabled = 1;
10939
-								$labeltoshow .= ' - ' . $langs->trans("Draft");
10939
+								$labeltoshow .= ' - '.$langs->trans("Draft");
10940 10940
 							} elseif ($obj->fk_statut == Project::STATUS_CLOSED) {
10941 10941
 								if ($discard_closed == 2) {
10942 10942
 									$disabled = 1;
10943 10943
 								}
10944
-								$labeltoshow .= ' - ' . $langs->trans("Closed");
10944
+								$labeltoshow .= ' - '.$langs->trans("Closed");
10945 10945
 							} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) {
10946 10946
 								$disabled = 1;
10947
-								$labeltoshow .= ' - ' . $langs->trans("LinkedToAnotherCompany");
10947
+								$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
10948 10948
 							}
10949 10949
 						}
10950 10950
 
10951 10951
 						if (!empty($selected) && $selected == $obj->rowid) {
10952
-							$out .= '<option value="' . $obj->rowid . '" selected';
10952
+							$out .= '<option value="'.$obj->rowid.'" selected';
10953 10953
 							//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
10954
-							$out .= '>' . $labeltoshow . '</option>';
10954
+							$out .= '>'.$labeltoshow.'</option>';
10955 10955
 						} else {
10956 10956
 							if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
10957 10957
 								$resultat = '';
10958 10958
 							} else {
10959
-								$resultat = '<option value="' . $obj->rowid . '"';
10959
+								$resultat = '<option value="'.$obj->rowid.'"';
10960 10960
 								if ($disabled) {
10961 10961
 									$resultat .= ' disabled';
10962 10962
 								}
@@ -11008,22 +11008,22 @@  discard block
 block discarded – undo
11008 11008
 
11009 11009
 		$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc';
11010 11010
 		//$sql.= ', el.fk_source';
11011
-		$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as f';
11012
-		$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
11011
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_rec as f';
11012
+		$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
11013 11013
 		$sql .= " ORDER BY f.titre ASC";
11014 11014
 
11015 11015
 		$resql = $this->db->query($sql);
11016 11016
 		if ($resql) {
11017 11017
 			// Use select2 selector
11018 11018
 			if (!empty($conf->use_javascript_ajax)) {
11019
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
11019
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
11020 11020
 				$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
11021 11021
 				$out .= $comboenhancement;
11022 11022
 				$morecss = 'minwidth200imp maxwidth500';
11023 11023
 			}
11024 11024
 
11025 11025
 			if (empty($option_only)) {
11026
-				$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
11026
+				$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
11027 11027
 			}
11028 11028
 			if (!empty($show_empty)) {
11029 11029
 				$out .= '<option value="0" class="optiongrey">';
@@ -11042,19 +11042,19 @@  discard block
 block discarded – undo
11042 11042
 					$disabled = 0;
11043 11043
 					if (!empty($obj->suspended)) {
11044 11044
 						$disabled = 1;
11045
-						$labeltoshow .= ' - ' . $langs->trans("Closed");
11045
+						$labeltoshow .= ' - '.$langs->trans("Closed");
11046 11046
 					}
11047 11047
 
11048 11048
 
11049 11049
 					if (!empty($selected) && $selected == $obj->rowid) {
11050
-						$out .= '<option value="' . $obj->rowid . '" selected';
11050
+						$out .= '<option value="'.$obj->rowid.'" selected';
11051 11051
 						//if ($disabled) $out.=' disabled';						// with select2, field can't be preselected if disabled
11052
-						$out .= '>' . $labeltoshow . '</option>';
11052
+						$out .= '>'.$labeltoshow.'</option>';
11053 11053
 					} else {
11054 11054
 						if ($disabled && ($selected != $obj->rowid)) {
11055 11055
 							$resultat = '';
11056 11056
 						} else {
11057
-							$resultat = '<option value="' . $obj->rowid . '"';
11057
+							$resultat = '<option value="'.$obj->rowid.'"';
11058 11058
 							if ($disabled) {
11059 11059
 								$resultat .= ' disabled';
11060 11060
 							}
@@ -11099,14 +11099,14 @@  discard block
 block discarded – undo
11099 11099
 		$formother = new FormOther($this->db);
11100 11100
 
11101 11101
 		if ($search_component_params_hidden != '' && !preg_match('/^\(.*\)$/', $search_component_params_hidden)) {    // If $search_component_params_hidden does not start and end with ()
11102
-			$search_component_params_hidden = '(' . $search_component_params_hidden . ')';
11102
+			$search_component_params_hidden = '('.$search_component_params_hidden.')';
11103 11103
 		}
11104 11104
 
11105 11105
 		$ret = '';
11106 11106
 
11107 11107
 		$ret .= '<div class="divadvancedsearchfieldcomp centpercent inline-block">';
11108 11108
 		$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor">';
11109
-		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="' . dol_escape_htmltag($langs->trans("Filters")) . '" id="idsubimgproductdistribution"></span>';
11109
+		$ret .= '<span class="fas fa-filter linkobject boxfilter paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Filters")).'" id="idsubimgproductdistribution"></span>';
11110 11110
 		$ret .= '</a>';
11111 11111
 
11112 11112
 		$ret .= '<div class="divadvancedsearchfieldcompinput inline-block minwidth500 maxwidth300onsmartphone">';
@@ -11150,30 +11150,30 @@  discard block
 block discarded – undo
11150 11150
 			$ret .= '<input type="hidden" name="show_search_component_params_hidden" value="1">';
11151 11151
 		}
11152 11152
 		$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%')) -->";
11153
-		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="' . dol_escape_htmltag($search_component_params_hidden) . '">';
11153
+		$ret .= '<input type="hidden" id="search_component_params_hidden" name="search_component_params_hidden" value="'.dol_escape_htmltag($search_component_params_hidden).'">';
11154 11154
 		// $ret .= "<!-- sql= ".forgeSQLFromUniversalSearchCriteria($search_component_params_hidden, $errormessage)." -->";
11155 11155
 
11156 11156
 		// TODO : Use $arrayoffiltercriterias instead of $arrayofcriterias
11157 11157
 		// For compatibility with forms that show themself the search criteria in addition of this component, we output these fields
11158 11158
 		foreach ($arrayofcriterias as $criteria) {
11159 11159
 			foreach ($criteria as $criteriafamilykey => $criteriafamilyval) {
11160
-				if (in_array('search_' . $criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11160
+				if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) {
11161 11161
 					continue;
11162 11162
 				}
11163 11163
 				if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) {
11164 11164
 					continue;
11165 11165
 				}
11166 11166
 				if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
11167
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_start">';
11168
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startyear">';
11169
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startmonth">';
11170
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_startday">';
11171
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_end">';
11172
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endyear">';
11173
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endmonth">';
11174
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '_endday">';
11167
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
11168
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
11169
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
11170
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
11171
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
11172
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
11173
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
11174
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
11175 11175
 				} else {
11176
-					$ret .= '<input type="hidden" name="search_' . $criteriafamilykey . '">';
11176
+					$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
11177 11177
 				}
11178 11178
 			}
11179 11179
 		}
@@ -11181,7 +11181,7 @@  discard block
 block discarded – undo
11181 11181
 		$ret .= '</div>';
11182 11182
 
11183 11183
 		$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";
11184
-		$ret .= '<input type="text" placeholder="' . $langs->trans("Filters") . '" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11184
+		$ret .= '<input type="text" placeholder="'.$langs->trans("Filters").'" id="search_component_params_input" name="search_component_params_input" class="noborderbottom search_component_input" value="">';
11185 11185
 
11186 11186
 		$ret .= '</div>';
11187 11187
 		$ret .= '</div>';
@@ -11246,9 +11246,9 @@  discard block
 block discarded – undo
11246 11246
 
11247 11247
 		$ret .= '<table><tbody>';
11248 11248
 
11249
-		$ret .= '<p class="assistance-title">' . img_picto('', 'help') . ' ' . $langs->trans('FilterAssistance') . ' </p>';
11249
+		$ret .= '<p class="assistance-title">'.img_picto('', 'help').' '.$langs->trans('FilterAssistance').' </p>';
11250 11250
 
11251
-		$ret .= '<p class="assistance-errors error" style="display:none">' . $langs->trans('AllFieldsRequired') . ' </p>';
11251
+		$ret .= '<p class="assistance-errors error" style="display:none">'.$langs->trans('AllFieldsRequired').' </p>';
11252 11252
 
11253 11253
 		$ret .= '<tr><td>';
11254 11254
 		$ret .= $form->selectarray('search_filter_field', $arrayoffilterfieldslabel, '', $langs->trans("Fields"), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
@@ -11260,25 +11260,25 @@  discard block
 block discarded – undo
11260 11260
 		$ret .= '</select>';
11261 11261
 		$ret .= '<script>$(document).ready(function() {';
11262 11262
 		$ret .= '   $(".operator-selector").select2({';
11263
-		$ret .= '       placeholder: "' . $langs->trans('Operator') . '"';
11263
+		$ret .= '       placeholder: "'.$langs->trans('Operator').'"';
11264 11264
 		$ret .= '   });';
11265 11265
 		$ret .= '});</script>';
11266 11266
 		$ret .= '</td>';
11267 11267
 
11268 11268
 		$ret .= '<td><span class="separator"></span>';
11269 11269
 		// Input field for entering values
11270
-		$ret .= '<input type="text" class="flat width100 value-input" placeholder="' . $langs->trans('Value') . '">';
11270
+		$ret .= '<input type="text" class="flat width100 value-input" placeholder="'.$langs->trans('Value').'">';
11271 11271
 
11272 11272
 		// Date selector
11273 11273
 		$dateOne = '';
11274 11274
 		$ret .= '<span class="date-one" style="display:none">';
11275
-		$ret .=  $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11275
+		$ret .= $form->selectDate(($dateOne ? $dateOne : -1), 'dateone', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '');
11276 11276
 		$ret .= '</span>';
11277 11277
 
11278 11278
 		$ret .= '<span class="end-separator"></span> </td>';
11279 11279
 
11280 11280
 		$ret .= '<td>';
11281
-		$ret .= '<button class="button buttongen button-save small add-filter-btn" type="button">' . $langs->trans("addToFilter") . '</button>';
11281
+		$ret .= '<button class="button buttongen button-save small add-filter-btn" type="button">'.$langs->trans("addToFilter").'</button>';
11282 11282
 		$ret .= '</td>';
11283 11283
 
11284 11284
 		$ret .= '</tr>';
@@ -11389,7 +11389,7 @@  discard block
 block discarded – undo
11389 11389
 
11390 11390
 		$TModels = array();
11391 11391
 
11392
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
11392
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
11393 11393
 		$formmail = new FormMail($this->db);
11394 11394
 		$result = $formmail->fetchAllEMailTemplate($modelType, $user, $langs);
11395 11395
 
@@ -11402,20 +11402,20 @@  discard block
 block discarded – undo
11402 11402
 			}
11403 11403
 		}
11404 11404
 
11405
-		$retstring .= '<select class="flat" id="select_' . $prefix . 'model_mail" name="' . $prefix . 'model_mail">';
11405
+		$retstring .= '<select class="flat" id="select_'.$prefix.'model_mail" name="'.$prefix.'model_mail">';
11406 11406
 
11407 11407
 		foreach ($TModels as $id_model => $label_model) {
11408
-			$retstring .= '<option value="' . $id_model . '"';
11408
+			$retstring .= '<option value="'.$id_model.'"';
11409 11409
 			if (!empty($selected) && $selected == $id_model) {
11410 11410
 				$retstring .= "selected";
11411 11411
 			}
11412
-			$retstring .= ">" . $label_model . "</option>";
11412
+			$retstring .= ">".$label_model."</option>";
11413 11413
 		}
11414 11414
 
11415 11415
 		$retstring .= "</select>";
11416 11416
 
11417 11417
 		if ($addjscombo) {
11418
-			$retstring .= ajax_combobox('select_' . $prefix . 'model_mail');
11418
+			$retstring .= ajax_combobox('select_'.$prefix.'model_mail');
11419 11419
 		}
11420 11420
 
11421 11421
 		return $retstring;
@@ -11466,16 +11466,16 @@  discard block
 block discarded – undo
11466 11466
 
11467 11467
 		foreach ($buttons as $button) {
11468 11468
 			$addclass = empty($button['addclass']) ? '' : $button['addclass'];
11469
-			$retstring .= '<input type="submit" class="button button-' . $button['name'] . ($morecss ? ' ' . $morecss : '') . ' ' . $addclass . '" name="' . $button['name'] . '" value="' . dol_escape_htmltag($langs->trans($button['label_key'])) . '">';
11469
+			$retstring .= '<input type="submit" class="button button-'.$button['name'].($morecss ? ' '.$morecss : '').' '.$addclass.'" name="'.$button['name'].'" value="'.dol_escape_htmltag($langs->trans($button['label_key'])).'">';
11470 11470
 		}
11471 11471
 		$retstring .= $withoutdiv ? '' : '</div>';
11472 11472
 
11473 11473
 		if ($dol_openinpopup) {
11474
-			$retstring .= '<!-- buttons are shown into a $dol_openinpopup=' . dol_escape_htmltag($dol_openinpopup) . ' context, so we enable the close of dialog on cancel -->' . "\n";
11475
-			$retstring .= '<script nonce="' . getNonce() . '">';
11474
+			$retstring .= '<!-- buttons are shown into a $dol_openinpopup='.dol_escape_htmltag($dol_openinpopup).' context, so we enable the close of dialog on cancel -->'."\n";
11475
+			$retstring .= '<script nonce="'.getNonce().'">';
11476 11476
 			$retstring .= 'jQuery(".button-cancel").click(function(e) {
11477
-				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup) . '\');
11478
-				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup) . '\').dialog(\'close\');
11477
+				e.preventDefault(); console.log(\'We click on cancel in iframe popup ' . dol_escape_js($dol_openinpopup).'\');
11478
+				window.parent.jQuery(\'#idfordialog' . dol_escape_js($dol_openinpopup).'\').dialog(\'close\');
11479 11479
 				 });';
11480 11480
 			$retstring .= '</script>';
11481 11481
 		}
@@ -11504,7 +11504,7 @@  discard block
 block discarded – undo
11504 11504
 		dol_syslog(__METHOD__, LOG_DEBUG);
11505 11505
 
11506 11506
 		$sql = "SELECT rowid, code, label as label";
11507
-		$sql .= " FROM " . MAIN_DB_PREFIX . 'c_invoice_subtype';
11507
+		$sql .= " FROM ".MAIN_DB_PREFIX.'c_invoice_subtype';
11508 11508
 		$sql .= " WHERE active = 1";
11509 11509
 
11510 11510
 		$resql = $this->db->query($sql);
@@ -11515,7 +11515,7 @@  discard block
 block discarded – undo
11515 11515
 				$obj = $this->db->fetch_object($resql);
11516 11516
 
11517 11517
 				// If translation exists, we use it, otherwise we take the default wording
11518
-				$label = ($langs->trans("InvoiceSubtype" . $obj->rowid) != "InvoiceSubtype" . $obj->rowid) ? $langs->trans("InvoiceSubtype" . $obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11518
+				$label = ($langs->trans("InvoiceSubtype".$obj->rowid) != "InvoiceSubtype".$obj->rowid) ? $langs->trans("InvoiceSubtype".$obj->rowid) : (($obj->label != '-') ? $obj->label : '');
11519 11519
 				$this->cache_invoice_subtype[$obj->rowid]['rowid'] = $obj->rowid;
11520 11520
 				$this->cache_invoice_subtype[$obj->rowid]['code'] = $obj->code;
11521 11521
 				$this->cache_invoice_subtype[$obj->rowid]['label'] = $label;
@@ -11547,18 +11547,18 @@  discard block
 block discarded – undo
11547 11547
 		global $langs, $user;
11548 11548
 
11549 11549
 		$out = '';
11550
-		dol_syslog(__METHOD__ . " selected=" . $selected . ", htmlname=" . $htmlname, LOG_DEBUG);
11550
+		dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG);
11551 11551
 
11552 11552
 		$this->load_cache_invoice_subtype();
11553 11553
 
11554
-		$out .= '<select id="' . $htmlname . '" class="flat selectsubtype' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
11554
+		$out .= '<select id="'.$htmlname.'" class="flat selectsubtype'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
11555 11555
 		if ($addempty) {
11556 11556
 			$out .= '<option value="0">&nbsp;</option>';
11557 11557
 		}
11558 11558
 
11559 11559
 		foreach ($this->cache_invoice_subtype as $rowid => $subtype) {
11560 11560
 			$label = $subtype['label'];
11561
-			$out .= '<option value="' . $subtype['rowid'] . '"';
11561
+			$out .= '<option value="'.$subtype['rowid'].'"';
11562 11562
 			if ($selected == $subtype['rowid']) {
11563 11563
 				$out .= ' selected="selected"';
11564 11564
 			}
Please login to merge, or discard this patch.
htdocs/core/tpl/extrafields_list_print_fields.tpl.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,11 +36,10 @@  discard block
 block discarded – undo
36 36
 					}
37 37
 					$value = $datenotinstring;
38 38
 				} elseif (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('int'))) {
39
-					$value = (!empty($obj->$tmpkey) || $obj->$tmpkey === '0'  ? $obj->$tmpkey : '');
39
+					$value = (!empty($obj->$tmpkey) || $obj->$tmpkey === '0' ? $obj->$tmpkey : '');
40 40
 				} else {
41 41
 					// The key may be in $obj->array_options if not in $obj
42
-					$value = (isset($obj->$tmpkey) ? $obj->$tmpkey :
43
-						(isset($obj->array_options[$tmpkey]) ? $obj->array_options[$tmpkey] : '') );
42
+					$value = (isset($obj->$tmpkey) ? $obj->$tmpkey : (isset($obj->array_options[$tmpkey]) ? $obj->array_options[$tmpkey] : ''));
44 43
 				}
45 44
 				// If field is a computed field, we make computation to get value
46 45
 				if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) {
@@ -54,7 +53,7 @@  discard block
 block discarded – undo
54 53
 				$valuetoshow = $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey, null, $object);
55 54
 				$title = dol_string_nohtmltag($valuetoshow);
56 55
 
57
-				print '<td'.($cssclass ? ' class="'.$cssclass.'"' : '');	// TODO Add 'css' and 'cssview' and 'csslist' for extrafields and use here 'csslist'
56
+				print '<td'.($cssclass ? ' class="'.$cssclass.'"' : ''); // TODO Add 'css' and 'cssview' and 'csslist' for extrafields and use here 'csslist'
58 57
 				print ' data-key="'.$extrafieldsobjectkey.'.'.$key.'"';
59 58
 				print($title ? ' title="'.dol_escape_htmltag($title).'"' : '');
60 59
 				print '>';
Please login to merge, or discard this patch.