Completed
Branch develop (447d8b)
by
unknown
25:30
created
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +69 added lines, -69 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
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
828 828
 			$flags .= '';
829 829
 		} else {
830
-			$flags .= '/' . $this->imap_encryption;
830
+			$flags .= '/'.$this->imap_encryption;
831 831
 		}
832 832
 
833 833
 		$flags .= '/novalidate-cert';
@@ -857,9 +857,9 @@  discard block
 block discarded – undo
857 857
 	{
858 858
 		if (function_exists('mb_convert_encoding')) {
859 859
 			// change spaces by entropy because mb_convert fail with spaces
860
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
860
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
861 861
 			$str = preg_replace("/_/", "xxxUNDERSCORExxx", $str); // encode underscore to avoid encoding issues with mb_convert
862
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
862
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
863 863
 			// if mb_convert work
864 864
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
865 865
 				// change characters
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 				}
1484 1484
 				if ($fromdate > 0) {
1485 1485
 					// $search .= ($search ? ' ' : '').'SINCE '.date('j-M-Y', $fromdate - 1); // SENTSINCE not supported. Date must be X-Abc-9999 (X on 1 digit if < 10)
1486
-					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1)));	// -1 is to add a security to no forgot some email
1486
+					array_push($criteria, array("SINCE" => date('j-M-Y', $fromdate - 1))); // -1 is to add a security to no forgot some email
1487 1487
 				}
1488 1488
 				//$search.=($search?' ':'').'SINCE 8-Apr-2022';
1489 1489
 			}
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 				}
1511 1511
 
1512 1512
 				if ($rule['type'] == 'from') {
1513
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1513
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1514 1514
 					if (count($tmprulevaluearray) >= 2) {
1515 1515
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1516 1516
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1520,7 +1520,7 @@  discard block
 block discarded – undo
1520 1520
 					}
1521 1521
 				}
1522 1522
 				if ($rule['type'] == 'to') {
1523
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1523
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1524 1524
 					if (count($tmprulevaluearray) >= 2) {
1525 1525
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1526 1526
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 					$tmpsourcedir = $this->getEncodedUtf7($sourcedir);
1649 1649
 				}
1650 1650
 
1651
-				$f = $client->getFolders(false, $tmpsourcedir);	// Note the search of directory do a search on sourcedir*
1651
+				$f = $client->getFolders(false, $tmpsourcedir); // Note the search of directory do a search on sourcedir*
1652 1652
 				if ($f) {
1653 1653
 					$folder = $f[0];
1654 1654
 					if ($folder instanceof Webklex\PHPIMAP\Folder) {
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 					$Query->leaveUnread();
1686 1686
 				}
1687 1687
 				$arrayofemail = $Query->limit($this->maxemailpercollect)->setFetchOrder("asc")->get();
1688
-				dol_syslog("EmailCollector::doCollectOneCollector nb arrayofemail ".(is_array($arrayofemail) ? count($arrayofemail) : 'Not array'));	// @phpstan-ignore-line
1688
+				dol_syslog("EmailCollector::doCollectOneCollector nb arrayofemail ".(is_array($arrayofemail) ? count($arrayofemail) : 'Not array')); // @phpstan-ignore-line
1689 1689
 			} catch (Exception $e) {
1690 1690
 				$this->error = $e->getMessage();
1691 1691
 				$this->errors[] = $this->error;
@@ -1707,7 +1707,7 @@  discard block
 block discarded – undo
1707 1707
 			}
1708 1708
 		}
1709 1709
 
1710
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1710
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1711 1711
 
1712 1712
 		// Loop on each email found
1713 1713
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0 && $connection !== false) {
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 				// GET header and overview datas
1740 1740
 				if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
1741 1741
 					'@phan-var-force Webklex\PHPIMAP\Message $imapemail';
1742
-					$header = $imapemail->getHeader()->raw;  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1742
+					$header = $imapemail->getHeader()->raw; // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
1743 1743
 					$overview = $imapemail->getAttributes();
1744 1744
 				} else {
1745 1745
 					$header = imap_fetchheader($connection, $imapemail, FT_UID);
@@ -1934,7 +1934,7 @@  discard block
 block discarded – undo
1934 1934
 
1935 1935
 
1936 1936
 				if (getDolGlobalString('MAIN_IMAP_USE_PHPIMAP')) {
1937
-					$dateformated = dol_print_date($overview['date'], 'dayrfc', 'gmt');		// May generate a warning "dol_print_date($overview['date'], 'dayrfc', 'gmt')" in log
1937
+					$dateformated = dol_print_date($overview['date'], 'dayrfc', 'gmt'); // May generate a warning "dol_print_date($overview['date'], 'dayrfc', 'gmt')" in log
1938 1938
 					dol_syslog("msgid=".$overview['message_id']." date=".$dateformated." from=".$overview['from']." to=".$overview['to']." subject=".$overview['subject']);
1939 1939
 
1940 1940
 					// Removed emojis
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 						$attachments = [];
1968 1968
 					}
1969 1969
 				} else {
1970
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1970
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1971 1971
 				}
1972 1972
 				'@phan-var-force Webklex\PHPIMAP\Attachment[] $attachments';
1973 1973
 				/** @var Webklex\PHPIMAP\Attachment[] $attachments */
@@ -2042,10 +2042,10 @@  discard block
 block discarded – undo
2042 2042
 					$sendtocc = empty($overview['cc']) ? '' : $overview['cc'];
2043 2043
 					$sendtobcc = empty($overview['bcc']) ? '' : $overview['bcc'];
2044 2044
 
2045
-					$tmpdate = $overview['date']->toDate();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2046
-					$tmptimezone = $tmpdate->getTimezone()->getName();  // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2045
+					$tmpdate = $overview['date']->toDate(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2046
+					$tmptimezone = $tmpdate->getTimezone()->getName(); // @phan-suppress-current-line PhanPluginUnknownObjectMethodCall
2047 2047
 
2048
-					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt');    // if $overview['timezone'] is "+00:00"
2048
+					$dateemail = dol_stringtotime((string) $overview['date'], 'gmt'); // if $overview['timezone'] is "+00:00"
2049 2049
 					if (preg_match('/^([+\-])(\d\d):(\d\d)/', $tmptimezone, $reg)) {
2050 2050
 						if ($reg[1] == '+' && ($reg[2] != '00' || $reg[3] != '00')) {
2051 2051
 							$dateemail -= (3600 * (int) $reg[2]);
@@ -2059,7 +2059,7 @@  discard block
 block discarded – undo
2059 2059
 					$subject = $overview['subject'];
2060 2060
 				} else {
2061 2061
 					$fromstring = $overview[0]->from;
2062
-					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : "")) ;
2062
+					$replytostring = (!empty($overview['in_reply-to']) ? $overview['in_reply-to'] : (!empty($headers['Reply-To']) ? $headers['Reply-To'] : ""));
2063 2063
 
2064 2064
 					$sender = !empty($overview[0]->sender) ? $overview[0]->sender : '';
2065 2065
 					$to = $overview[0]->to;
@@ -2129,17 +2129,17 @@  discard block
 block discarded – undo
2129 2129
 				foreach ($arrayofreferences as $reference) {
2130 2130
 					//print "Process mail ".$iforemailloop." email_msgid ".$msgid.", date ".dol_print_date($dateemail, 'dayhour', 'gmt').", subject ".$subject.", reference ".dol_escape_htmltag($reference)."<br>\n";
2131 2131
 					if (!empty($trackidfoundintorecipienttype)) {
2132
-						$resultsearchtrackid = -1;		// trackid found
2132
+						$resultsearchtrackid = -1; // trackid found
2133 2133
 						$reg[1] = $trackidfoundintorecipienttype;
2134 2134
 						$reg[2] = $trackidfoundintorecipientid;
2135 2135
 					} elseif (!empty($trackidfoundintomsgidtype)) {
2136
-						$resultsearchtrackid = -1;		// trackid found
2136
+						$resultsearchtrackid = -1; // trackid found
2137 2137
 						$reg[1] = $trackidfoundintomsgidtype;
2138 2138
 						$reg[2] = $trackidfoundintomsgidid;
2139 2139
 					} else {
2140
-						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg);	// trackid found or not
2140
+						$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote($host, '/').'/', $reference, $reg); // trackid found or not
2141 2141
 						if (empty($resultsearchtrackid) && getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE')) {
2142
-							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg);	// trackid found
2142
+							$resultsearchtrackid = preg_match('/dolibarr-([a-z]+)([0-9]+)@'.preg_quote(getDolGlobalString('EMAIL_ALTERNATIVE_HOST_SIGNATURE'), '/').'/', $reference, $reg); // trackid found
2143 2143
 						}
2144 2144
 					}
2145 2145
 
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
 								}
2308 2308
 								if ($changeonticket_references) {
2309 2309
 									$operationslog .= '<br>We complete ticket ID='.$ticketid.' with property origin_references='.$objectemail->origin_references;
2310
-									$objectemail->update($user, 1);		// We complete the references field with all references mentioned into this email. This field is for technical tracking purpose, not a user field, so no need to execute triggers
2310
+									$objectemail->update($user, 1); // We complete the references field with all references mentioned into this email. This field is for technical tracking purpose, not a user field, so no need to execute triggers
2311 2311
 								}
2312 2312
 							}
2313 2313
 						}
@@ -2437,7 +2437,7 @@  discard block
 block discarded – undo
2437 2437
 
2438 2438
 						// Make Operation
2439 2439
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2440
-						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
2440
+						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
2441 2441
 
2442 2442
 						// Try to guess if this is an email in or out.
2443 2443
 						$actioncode = 'EMAIL_IN';
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 									$operationslog .= '<br>Ticket not found using trackid='.$trackid.' or msgid='.$msgid;
2496 2496
 									$ticketalreadyexists = 0;
2497 2497
 								} else {
2498
-									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid.", we replace operation 'ticket' with 'recordevent' to add a new message";	// We change the operation type to do
2498
+									$operationslog .= '<br>Ticket already found using trackid='.$trackid.' or msgid='.$msgid.", we replace operation 'ticket' with 'recordevent' to add a new message"; // We change the operation type to do
2499 2499
 									$ticketalreadyexists = 1;
2500 2500
 									$operation['type'] = 'recordevent';
2501 2501
 								}
@@ -2738,11 +2738,11 @@  discard block
 block discarded – undo
2738 2738
 									$result = $contactstatic->fetch(0, null, '', $from);
2739 2739
 									if ($result < 0) {
2740 2740
 										$errorforactions++;
2741
-										$this->error = 'Error when getting contact with email ' . $from;
2741
+										$this->error = 'Error when getting contact with email '.$from;
2742 2742
 										$this->errors[] = $this->error;
2743 2743
 										break;
2744 2744
 									} elseif ($result == 0) {
2745
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2745
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2746 2746
 										$contactstatic = new Contact($this->db);
2747 2747
 
2748 2748
 										// Create contact
@@ -2757,28 +2757,28 @@  discard block
 block discarded – undo
2757 2757
 										} else {
2758 2758
 											// Search country by name or code
2759 2759
 											if (!empty($contactstatic->country)) {
2760
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2760
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2761 2761
 												$result = getCountry('', '3', $this->db, null, 1, $contactstatic->country);
2762 2762
 												if ($result == 'NotDefined') {
2763 2763
 													$errorforactions++;
2764
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2764
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2765 2765
 												} elseif (!($result > 0)) {
2766 2766
 													$errorforactions++;
2767
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2767
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2768 2768
 													$this->errors[] = $this->db->lasterror();
2769 2769
 												} else {
2770 2770
 													$contactstatic->country_id = $result;
2771 2771
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2772 2772
 												}
2773 2773
 											} elseif (!empty($contactstatic->country_code)) {
2774
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2774
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2775 2775
 												$result = getCountry($contactstatic->country_code, '3', $this->db);
2776 2776
 												if ($result == 'NotDefined') {
2777 2777
 													$errorforactions++;
2778
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2778
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2779 2779
 												} elseif (!($result > 0)) {
2780 2780
 													$errorforactions++;
2781
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2781
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2782 2782
 													$this->errors[] = $this->db->lasterror();
2783 2783
 												} else {
2784 2784
 													$contactstatic->country_id = $result;
@@ -2789,28 +2789,28 @@  discard block
 block discarded – undo
2789 2789
 											if (!$errorforactions) {
2790 2790
 												// Search state by name or code (for country if defined)
2791 2791
 												if (!empty($contactstatic->state)) {
2792
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2792
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2793 2793
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2794 2794
 													if (empty($result)) {
2795 2795
 														$errorforactions++;
2796
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2796
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2797 2797
 													} elseif (!($result > 0)) {
2798 2798
 														$errorforactions++;
2799
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2799
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2800 2800
 														$this->errors[] = $this->db->lasterror();
2801 2801
 													} else {
2802 2802
 														$contactstatic->state_id = $result;
2803 2803
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2804 2804
 													}
2805 2805
 												} elseif (!empty($contactstatic->state_code)) {
2806
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2806
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2807 2807
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2808 2808
 													if (empty($result)) {
2809 2809
 														$errorforactions++;
2810
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2810
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2811 2811
 													} elseif (!($result > 0)) {
2812 2812
 														$errorforactions++;
2813
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2813
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2814 2814
 														$this->errors[] = $this->db->lasterror();
2815 2815
 													} else {
2816 2816
 														$contactstatic->state_id = $result;
@@ -2875,8 +2875,8 @@  discard block
 block discarded – undo
2875 2875
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2876 2876
 								$actioncomm->note_private = $descriptionfull;
2877 2877
 								$actioncomm->fk_project  = $projectstatic->id;
2878
-								$actioncomm->datep       = $dateemail;	// date of email
2879
-								$actioncomm->datef       = $dateemail;	// date of email
2878
+								$actioncomm->datep       = $dateemail; // date of email
2879
+								$actioncomm->datef       = $dateemail; // date of email
2880 2880
 								$actioncomm->percentage  = -1; // Not applicable
2881 2881
 								$actioncomm->socid       = $thirdpartystatic->id;
2882 2882
 								$actioncomm->contact_id = $contactstatic->id;
@@ -3077,7 +3077,7 @@  discard block
 block discarded – undo
3077 3077
 								}
3078 3078
 								$hookmanager->initHooks(array('emailcolector'));
3079 3079
 								$parameters = array('arrayobject' => $arrayobject);
3080
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
3080
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
3081 3081
 								if ($reshook > 0) {
3082 3082
 									$arrayobject = $hookmanager->resArray;
3083 3083
 								}
@@ -3086,10 +3086,10 @@  discard block
 block discarded – undo
3086 3086
 
3087 3087
 								foreach ($arrayobject as $key => $objectdesc) {
3088 3088
 									$sql = 'SELECT DISTINCT t.rowid ';
3089
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->db->sanitize($objectdesc['table']) . ' AS t';
3089
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$this->db->sanitize($objectdesc['table']).' AS t';
3090 3090
 									$sql .= ' WHERE ';
3091 3091
 									foreach ($objectdesc['fields'] as $field) {
3092
-										$sql .= "('" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $this->db->sanitize($field) . ", '%') AND t." . $this->db->sanitize($field) . " <> '') OR ";
3092
+										$sql .= "('".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$this->db->sanitize($field).", '%') AND t.".$this->db->sanitize($field)." <> '') OR ";
3093 3093
 									}
3094 3094
 									$sql = substr($sql, 0, -4);
3095 3095
 
@@ -3110,8 +3110,8 @@  discard block
 block discarded – undo
3110 3110
 									foreach ($ids as $val) {
3111 3111
 										$res = $objectmanaged->fetch($val);
3112 3112
 										if ($res) {
3113
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
3114
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
3113
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
3114
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
3115 3115
 										} else {
3116 3116
 											$this->errors[] = 'object not found';
3117 3117
 										}
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
 								foreach ($dirs as $target) {
3121 3121
 									$prefix = $this->actions[$this->id]['actionparam'];
3122 3122
 									foreach ($data as $filename => $content) {
3123
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
3123
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
3124 3124
 										if ($resr == -1) {
3125 3125
 											$this->errors[] = 'Doc not saved';
3126 3126
 										}
@@ -3167,7 +3167,7 @@  discard block
 block discarded – undo
3167 3167
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
3168 3168
 
3169 3169
 								$projecttocreate->title = $subject;
3170
-								$projecttocreate->date_start = $dateemail;	// date of email
3170
+								$projecttocreate->date_start = $dateemail; // date of email
3171 3171
 								$projecttocreate->date_end = 0;
3172 3172
 								$projecttocreate->opp_status = $id_opp_status;
3173 3173
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3467,7 +3467,7 @@  discard block
 block discarded – undo
3467 3467
 								$candidaturetocreate->note_private = $descriptionfull;
3468 3468
 								$candidaturetocreate->entity = $conf->entity;
3469 3469
 								$candidaturetocreate->email_msgid = $msgid;
3470
-								$candidaturetocreate->email_date = $dateemail;		// date of email
3470
+								$candidaturetocreate->email_date = $dateemail; // date of email
3471 3471
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3472 3472
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3473 3473
 
@@ -3877,8 +3877,8 @@  discard block
 block discarded – undo
3877 3877
 				 * append increment number to the original filename
3878 3878
 				 */
3879 3879
 				while (file_exists($destdir.$file_name.".".$extension)) {
3880
-					$file_name = $file_name_original . ' (' . $num . ')';
3881
-					$file_name_complete = $file_name . "." . $extension;
3880
+					$file_name = $file_name_original.' ('.$num.')';
3881
+					$file_name_complete = $file_name.".".$extension;
3882 3882
 					$destination = $destdir.$file_name_complete;
3883 3883
 					$num++;
3884 3884
 				}
@@ -3992,7 +3992,7 @@  discard block
 block discarded – undo
3992 3992
 	 */
3993 3993
 	private function saveAttachment($destdir, $filename, $content)
3994 3994
 	{
3995
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
3995
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
3996 3996
 
3997 3997
 		$tmparraysize = getDefaultImageSizes();
3998 3998
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/contact/class/contact.class.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	/**
214 214
 	 * @var int Thirdparty ID
215 215
 	 */
216
-	public $socid;		// both socid and fk_soc are used
216
+	public $socid; // both socid and fk_soc are used
217 217
 	/**
218 218
 	 * @var int
219 219
 	 */
220
-	public $fk_soc;		// both socid and fk_soc are used
220
+	public $fk_soc; // both socid and fk_soc are used
221 221
 
222 222
 	/**
223 223
 	 * @var string Thirdparty name
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 		global $conf;
804 804
 		$dn = '';
805 805
 		if ($mode == 0) {
806
-			$dn = getDolGlobalString('LDAP_KEY_CONTACTS') . "=".$info[getDolGlobalString('LDAP_KEY_CONTACTS')]."," . getDolGlobalString('LDAP_CONTACT_DN');
806
+			$dn = getDolGlobalString('LDAP_KEY_CONTACTS')."=".$info[getDolGlobalString('LDAP_KEY_CONTACTS')].",".getDolGlobalString('LDAP_CONTACT_DN');
807 807
 		} elseif ($mode == 1) {
808 808
 			$dn = getDolGlobalString('LDAP_CONTACT_DN');
809 809
 		} elseif ($mode == 2) {
810
-			$dn = getDolGlobalString('LDAP_KEY_CONTACTS') . "=".$info[getDolGlobalString('LDAP_KEY_CONTACTS')];
810
+			$dn = getDolGlobalString('LDAP_KEY_CONTACTS')."=".$info[getDolGlobalString('LDAP_KEY_CONTACTS')];
811 811
 		}
812 812
 		return $dn;
813 813
 	}
@@ -956,12 +956,12 @@  discard block
 block discarded – undo
956 956
 			// Update birthday alert
957 957
 			if (!empty($this->birthday_alert)) {
958 958
 				//check existing
959
-				$sql_check = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user_alert WHERE type = 1 AND fk_contact = " . ((int) $id) . " AND fk_user = " . ((int) $user->id);
959
+				$sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type = 1 AND fk_contact = ".((int) $id)." AND fk_user = ".((int) $user->id);
960 960
 				$result_check = $this->db->query($sql_check);
961 961
 				if (!$result_check || ($this->db->num_rows($result_check) < 1)) {
962 962
 					//insert
963
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_alert(type, fk_contact, fk_user) ";
964
-					$sql .= "VALUES (1," . ((int) $id) . "," . ((int) $user->id) . ")";
963
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type, fk_contact, fk_user) ";
964
+					$sql .= "VALUES (1,".((int) $id).",".((int) $user->id).")";
965 965
 					$result = $this->db->query($sql);
966 966
 					if (!$result) {
967 967
 						$error++;
@@ -971,8 +971,8 @@  discard block
 block discarded – undo
971 971
 					$result = true;
972 972
 				}
973 973
 			} else {
974
-				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_alert ";
975
-				$sql .= "WHERE type=1 AND fk_contact=" . ((int) $id) . " AND fk_user=" . ((int) $user->id);
974
+				$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert ";
975
+				$sql .= "WHERE type=1 AND fk_contact=".((int) $id)." AND fk_user=".((int) $user->id);
976 976
 				$result = $this->db->query($sql);
977 977
 				if (!$result) {
978 978
 					$error++;
@@ -1082,29 +1082,29 @@  discard block
 block discarded – undo
1082 1082
 				$this->civility_code = $obj->civility_code;
1083 1083
 				$this->civility = $obj->civility_code ? ($langs->trans("Civility".$obj->civility_code) != "Civility".$obj->civility_code ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code) : '';
1084 1084
 
1085
-				$this->name_alias	= $obj->name_alias;
1085
+				$this->name_alias = $obj->name_alias;
1086 1086
 				$this->lastname		= $obj->lastname;
1087 1087
 				$this->firstname	= $obj->firstname;
1088
-				$this->address		= $obj->address;
1089
-				$this->zip			= $obj->zip;
1090
-				$this->town			= $obj->town;
1088
+				$this->address = $obj->address;
1089
+				$this->zip = $obj->zip;
1090
+				$this->town = $obj->town;
1091 1091
 
1092 1092
 				$this->date_creation = $this->db->jdate($obj->date_creation);
1093 1093
 				$this->date_modification = $this->db->jdate($obj->date_modification);
1094 1094
 				$this->user_creation_id = $obj->fk_user_creat;
1095 1095
 				$this->user_modification_id = $obj->fk_user_modif;
1096 1096
 
1097
-				$this->state_id		= $obj->state_id;
1097
+				$this->state_id = $obj->state_id;
1098 1098
 				$this->state_code	= $obj->state_code;
1099
-				$this->state		= $obj->state;
1099
+				$this->state = $obj->state;
1100 1100
 
1101 1101
 				$this->country_id	= $obj->country_id;
1102
-				$this->country_code	= $obj->country_id ? $obj->country_code : '';
1103
-				$this->country		= $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
1102
+				$this->country_code = $obj->country_id ? $obj->country_code : '';
1103
+				$this->country = $obj->country_id ? ($langs->trans('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : '';
1104 1104
 
1105
-				$this->fk_soc		= $obj->fk_soc;		// Both fk_soc and socid are used
1106
-				$this->socid		= $obj->fk_soc;		// Both fk_soc and socid are used
1107
-				$this->socname		= $obj->socname;
1105
+				$this->fk_soc = $obj->fk_soc; // Both fk_soc and socid are used
1106
+				$this->socid		= $obj->fk_soc; // Both fk_soc and socid are used
1107
+				$this->socname = $obj->socname;
1108 1108
 				$this->poste		= $obj->poste;
1109 1109
 				$this->status		= $obj->status;
1110 1110
 				$this->statut		= $obj->status; // deprecated
@@ -1123,19 +1123,19 @@  discard block
 block discarded – undo
1123 1123
 				$this->phone_mobile = trim($obj->phone_mobile);
1124 1124
 
1125 1125
 				$this->email			= $obj->email;
1126
-				$this->socialnetworks	= ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array());
1126
+				$this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : array());
1127 1127
 				$this->photo			= $obj->photo;
1128 1128
 				$this->priv				= $obj->priv;
1129 1129
 				$this->mail				= $obj->email;
1130 1130
 
1131
-				$this->birthday		= $this->db->jdate($obj->birthday);
1132
-				$this->note			= $obj->note_private; // deprecated
1131
+				$this->birthday = $this->db->jdate($obj->birthday);
1132
+				$this->note = $obj->note_private; // deprecated
1133 1133
 				$this->note_private	= $obj->note_private;
1134
-				$this->note_public	= $obj->note_public;
1134
+				$this->note_public = $obj->note_public;
1135 1135
 				$this->default_lang	= $obj->default_lang;
1136
-				$this->user_id		= $obj->user_id;
1136
+				$this->user_id = $obj->user_id;
1137 1137
 				$this->user_login	= $obj->user_login;
1138
-				$this->canvas		= $obj->canvas;
1138
+				$this->canvas = $obj->canvas;
1139 1139
 
1140 1140
 				$this->import_key = $obj->import_key;
1141 1141
 
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 			$datas['photo'] = $photo;
1504 1504
 		}
1505 1505
 
1506
-		$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Contact").'</u> ' . $this->getLibStatut(4);
1506
+		$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Contact").'</u> '.$this->getLibStatut(4);
1507 1507
 		$datas['name'] = '<br><b>'.$langs->trans("Name").':</b> '.$this->getFullName($langs);
1508 1508
 		// if ($this->civility_id) $datas['civility'] = '<br><b>' . $langs->trans("Civility") . ':</b> '.$this->civility_id;		// TODO Translate civilty_id code
1509 1509
 		if (!empty($this->poste)) {
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
 			$label = implode($this->getTooltipContentArray($params));
1565 1565
 		}
1566 1566
 
1567
-		$baseurl = DOL_URL_ROOT . '/contact/card.php';
1567
+		$baseurl = DOL_URL_ROOT.'/contact/card.php';
1568 1568
 		$query = ['id' => $this->id];
1569 1569
 		if ($option !== 'nolink') {
1570 1570
 			// Add param to save lastsearch_values or not
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 		$error = 0;
1962 1962
 
1963 1963
 		if (!isset($this->roles)) {
1964
-			return 0;	// Avoid to loose roles when property not set
1964
+			return 0; // Avoid to loose roles when property not set
1965 1965
 		}
1966 1966
 
1967 1967
 		$this->db->begin();
@@ -2274,7 +2274,7 @@  discard block
 block discarded – undo
2274 2274
 		}
2275 2275
 		$return .= '</span>';
2276 2276
 		$return .= '<div class="info-box-content">';
2277
-		$return .= '<div class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl(0) . '</div>';
2277
+		$return .= '<div class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.$this->getNomUrl(0).'</div>';
2278 2278
 		if ($selected >= 0) {
2279 2279
 			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2280 2280
 		}
Please login to merge, or discard this patch.
htdocs/commande/note.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 $result = restrictedArea($user, 'commande', $id, '');
64 64
 
65
-$usercancreate  =  $user->hasRight("commande", "creer");
65
+$usercancreate  = $user->hasRight("commande", "creer");
66 66
 
67 67
 $permissionnote = $user->hasRight('commande', 'creer'); // Used by the include of actions_setnotes.inc.php
68 68
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
 	// Order card
108 108
 
109
-	$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT . '/commande/list.php', ['restore_lastsearch_values' => 1, 'socid' => (!empty($socid) ? $socid : '')]).'">'.$langs->trans("BackToList").'</a>';
109
+	$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/commande/list.php', ['restore_lastsearch_values' => 1, 'socid' => (!empty($socid) ? $socid : '')]).'">'.$langs->trans("BackToList").'</a>';
110 110
 
111 111
 
112 112
 	$morehtmlref = '<div class="refidno">';
Please login to merge, or discard this patch.
htdocs/commande/card.php 1 patch
Spacing   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -40,30 +40,30 @@  discard block
 block discarded – undo
40 40
 
41 41
 // Load Dolibarr environment
42 42
 require '../main.inc.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
44
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
45
-require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
46
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
47
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formorder.class.php';
48
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmargin.class.php';
49
-require_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php';
50
-require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
51
-require_once DOL_DOCUMENT_ROOT . '/core/lib/order.lib.php';
52
-
53
-require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
54
-require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
45
+require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
46
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
47
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
48
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
49
+require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
50
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
51
+require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
52
+
53
+require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
54
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
55 55
 
56 56
 if (isModEnabled("propal")) {
57
-	require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
57
+	require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
58 58
 }
59 59
 
60 60
 if (isModEnabled('project')) {
61
-	require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
62
-	require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
61
+	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
62
+	require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
63 63
 }
64 64
 
65 65
 if (isModEnabled('variants')) {
66
-	require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination.class.php';
66
+	require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
67 67
 }
68 68
 
69 69
 
@@ -91,18 +91,18 @@  discard block
 block discarded – undo
91 91
 
92 92
 
93 93
 $id        = (GETPOSTINT('id') ? GETPOSTINT('id') : GETPOSTINT('orderid'));
94
-$ref       =  GETPOST('ref', 'alpha');
95
-$socid     =  GETPOSTINT('socid');
96
-$action    =  GETPOST('action', 'aZ09');
97
-$cancel    =  GETPOST('cancel', 'alpha');
98
-$confirm   =  GETPOST('confirm', 'alpha');
94
+$ref       = GETPOST('ref', 'alpha');
95
+$socid     = GETPOSTINT('socid');
96
+$action    = GETPOST('action', 'aZ09');
97
+$cancel    = GETPOST('cancel', 'alpha');
98
+$confirm   = GETPOST('confirm', 'alpha');
99 99
 $backtopage = GETPOST('backtopage', 'alpha');
100 100
 
101
-$lineid    =  GETPOSTINT('lineid');
102
-$contactid =  GETPOSTINT('contactid');
103
-$projectid =  GETPOSTINT('projectid');
104
-$origin    =  GETPOST('origin', 'alpha');
105
-$originid  = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id'));    // For backward compatibility
101
+$lineid    = GETPOSTINT('lineid');
102
+$contactid = GETPOSTINT('contactid');
103
+$projectid = GETPOSTINT('projectid');
104
+$origin    = GETPOST('origin', 'alpha');
105
+$originid  = (GETPOSTINT('originid') ? GETPOSTINT('originid') : GETPOSTINT('origin_id')); // For backward compatibility
106 106
 $rank      = (GETPOSTINT('rank') > 0) ? GETPOSTINT('rank') : -1;
107 107
 
108 108
 // Type Contact default
@@ -147,26 +147,26 @@  discard block
 block discarded – undo
147 147
 $extrafields->fetch_name_optionals_label($object->table_element);
148 148
 
149 149
 // Load object
150
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php';     // Must be 'include', not 'include_once'
150
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'
151 151
 
152 152
 // Permissions / Rights
153
-$usercanread    =  $user->hasRight("commande", "lire");
154
-$usercancreate  =  $user->hasRight("commande", "creer");
155
-$usercandelete  =  $user->hasRight("commande", "supprimer");
153
+$usercanread    = $user->hasRight("commande", "lire");
154
+$usercancreate  = $user->hasRight("commande", "creer");
155
+$usercandelete  = $user->hasRight("commande", "supprimer");
156 156
 
157 157
 // Advanced permissions
158
-$usercanclose       =  ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'close')));
159
-$usercanvalidate    =  ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'validate')));
160
-$usercancancel      =  ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'annuler')));
161
-$usercansend        =   (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'send'));
162
-$usercangeneretedoc =   (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'generetedoc'));
158
+$usercanclose       = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($usercancreate)) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'close')));
159
+$usercanvalidate    = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'validate')));
160
+$usercancancel      = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('commande', 'order_advance', 'annuler')));
161
+$usercansend        = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'send'));
162
+$usercangeneretedoc = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('commande', 'order_advance', 'generetedoc'));
163 163
 
164 164
 $usermustrespectpricemin    = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS'));
165 165
 $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer'));
166 166
 
167
-$permissionnote    = $usercancreate;     //  Used by the include of actions_setnotes.inc.php
168
-$permissiondellink = $usercancreate;     //  Used by the include of actions_dellink.inc.php
169
-$permissiontoadd   = $usercancreate;     //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
167
+$permissionnote    = $usercancreate; //  Used by the include of actions_setnotes.inc.php
168
+$permissiondellink = $usercancreate; //  Used by the include of actions_dellink.inc.php
169
+$permissiontoadd   = $usercancreate; //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
170 170
 $permissiontoeditextra = $usercancreate;
171 171
 if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
172 172
 	// For action 'update_extras', is there a specific permission set for the attribute to update
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 }
193 193
 
194 194
 if (empty($reshook)) {
195
-	$backurlforlist = DOL_URL_ROOT . '/commande/list.php';
195
+	$backurlforlist = DOL_URL_ROOT.'/commande/list.php';
196 196
 
197 197
 	if (empty($backtopage) || ($cancel && empty($id))) {
198 198
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
199 199
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
200 200
 				$backtopage = $backurlforlist;
201 201
 			} else {
202
-				$backtopage = DOL_URL_ROOT . '/commande/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__');
202
+				$backtopage = DOL_URL_ROOT.'/commande/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
203 203
 			}
204 204
 		}
205 205
 	}
@@ -208,20 +208,20 @@  discard block
 block discarded – undo
208 208
 
209 209
 	if ($cancel) {
210 210
 		if (!empty($backtopageforcancel)) {
211
-			header("Location: " . $backtopageforcancel);
211
+			header("Location: ".$backtopageforcancel);
212 212
 			exit;
213 213
 		} elseif (!empty($backtopage)) {
214
-			header("Location: " . $backtopage);
214
+			header("Location: ".$backtopage);
215 215
 			exit;
216 216
 		}
217 217
 		$action = '';
218 218
 	}
219 219
 
220
-	include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php';    // Must be 'include', not 'include_once'
220
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be 'include', not 'include_once'
221 221
 
222
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';     // Must be 'include', not 'include_once'
222
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
223 223
 
224
-	include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php';  // Must be 'include', not 'include_once'
224
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
225 225
 
226 226
 	// Action clone object
227 227
 	if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 						setEventMessages('', $warningMsgLineList, 'warnings');
251 251
 					}
252 252
 
253
-					header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
253
+					header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
254 254
 					exit;
255 255
 				} else {
256 256
 					setEventMessages($object->error, $object->errors, 'errors');
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				$object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
310 310
 			}
311 311
 
312
-			header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
312
+			header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
313 313
 			exit;
314 314
 		} else {
315 315
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 				$object->generateDocument($object->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
338 338
 			}
339 339
 
340
-			header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
340
+			header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
341 341
 			exit;
342 342
 		} else {
343 343
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -433,14 +433,14 @@  discard block
 block discarded – undo
433 433
 					$object_id = $object->create($user);
434 434
 
435 435
 					if ($object_id > 0) {
436
-						dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
436
+						dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
437 437
 
438 438
 						$classname = ucfirst($subelement);
439 439
 						$srcobject = new $classname($db);
440 440
 						'@phan-var-force Commande|Propal|Contrat $srcobject';
441 441
 						/** @var Commande|Propal|Contrat $srcobject */
442 442
 
443
-						dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
443
+						dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
444 444
 						$result = $srcobject->fetch($object->origin_id);
445 445
 						if ($result > 0) {
446 446
 							$lines = $srcobject->lines;
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 
492 492
 								$tva_tx = $lines[$i]->tva_tx;
493 493
 								if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) {
494
-									$tva_tx .= ' (' . $lines[$i]->vat_src_code . ')';
494
+									$tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
495 495
 								}
496 496
 
497 497
 								$result = $object->addline(
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 			// End of object creation, we show it
620 620
 			if ($object_id > 0 && !$error) {
621 621
 				$db->commit();
622
-				header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object_id);
622
+				header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object_id);
623 623
 				exit();
624 624
 			} else {
625 625
 				$db->rollback();
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 			}
796 796
 			$tvatx = $line->tva_tx;
797 797
 			if (!empty($line->vat_src_code)) {
798
-				$tvatx .= ' (' . $line->vat_src_code . ')';
798
+				$tvatx .= ' ('.$line->vat_src_code.')';
799 799
 			}
800 800
 			$result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, (float) $remise_percent, $tvatx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice);
801 801
 		}
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 				if ($prod->price_min > $line->subprice) {
826 826
 					$price_subprice = price($line->subprice, 0, $outlangs, 1, -1, -1, 'auto');
827 827
 					$price_price_min = price($prod->price_min, 0, $outlangs, 1, -1, -1, 'auto');
828
-					setEventMessages($prod->ref . ' - ' . $prod->label . ' (' . $price_subprice . ' < ' . $price_price_min . ' ' . strtolower($langs->trans("MinPrice")) . ')' . "\n", null, 'warnings');
828
+					setEventMessages($prod->ref.' - '.$prod->label.' ('.$price_subprice.' < '.$price_price_min.' '.strtolower($langs->trans("MinPrice")).')'."\n", null, 'warnings');
829 829
 				} else {
830 830
 					setEventMessages($prod->error, $prod->errors, 'errors');
831 831
 				}
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 		} else {
901 901
 			setEventMessages($object->error, $object->errors, 'errors');
902 902
 		}
903
-		header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
903
+		header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
904 904
 		exit();
905 905
 	} elseif ($action == 'confirm_addsubtotalline' && $usercancreate) {
906 906
 		// Handling adding a new subtotal line for subtotals module
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 		} else {
953 953
 			setEventMessages($object->error, $object->errors, 'errors');
954 954
 		}
955
-		header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
955
+		header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
956 956
 		exit();
957 957
 	} elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && $usercancreate) {		// Add a new line
958 958
 		$langs->load('errors');
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 		$pu_ht = '';
970 970
 		$pu_ttc = '';
971 971
 		$pu_ht_devise = '';
972
-		$pu_ttc_devise  = '';
972
+		$pu_ttc_devise = '';
973 973
 
974 974
 		if (GETPOST('price_ht') !== '') {
975 975
 			$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
@@ -998,9 +998,9 @@  discard block
 block discarded – undo
998 998
 
999 999
 		$tva_tx = GETPOST('tva_tx', 'alpha');
1000 1000
 
1001
-		$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
1001
+		$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
1002 1002
 
1003
-		$remise_percent = (GETPOSTISSET('remise_percent' . $predef) ? price2num(GETPOST('remise_percent' . $predef, 'alpha'), '', 2) : 0);
1003
+		$remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha'), '', 2) : 0);
1004 1004
 		if (empty($remise_percent)) {
1005 1005
 			$remise_percent = 0;
1006 1006
 		}
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 		if (is_array($extralabelsline)) {
1013 1013
 			// Get extra fields
1014 1014
 			foreach ($extralabelsline as $key => $value) {
1015
-				unset($_POST["options_" . $key]);
1015
+				unset($_POST["options_".$key]);
1016 1016
 			}
1017 1017
 		}
1018 1018
 
@@ -1057,8 +1057,8 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
 		if (!$error && ($qty >= 0) && (!empty($line_desc) || (!empty($idprod) && $idprod > 0))) {
1059 1059
 			// Clean parameters
1060
-			$date_start = dol_mktime(GETPOSTINT('date_start' . $predef . 'hour'), GETPOSTINT('date_start' . $predef . 'min'), GETPOSTINT('date_start' . $predef . 'sec'), GETPOSTINT('date_start' . $predef . 'month'), GETPOSTINT('date_start' . $predef . 'day'), GETPOSTINT('date_start' . $predef . 'year'));
1061
-			$date_end = dol_mktime(GETPOSTINT('date_end' . $predef . 'hour'), GETPOSTINT('date_end' . $predef . 'min'), GETPOSTINT('date_end' . $predef . 'sec'), GETPOSTINT('date_end' . $predef . 'month'), GETPOSTINT('date_end' . $predef . 'day'), GETPOSTINT('date_end' . $predef . 'year'));
1060
+			$date_start = dol_mktime(GETPOSTINT('date_start'.$predef.'hour'), GETPOSTINT('date_start'.$predef.'min'), GETPOSTINT('date_start'.$predef.'sec'), GETPOSTINT('date_start'.$predef.'month'), GETPOSTINT('date_start'.$predef.'day'), GETPOSTINT('date_start'.$predef.'year'));
1061
+			$date_end = dol_mktime(GETPOSTINT('date_end'.$predef.'hour'), GETPOSTINT('date_end'.$predef.'min'), GETPOSTINT('date_end'.$predef.'sec'), GETPOSTINT('date_end'.$predef.'month'), GETPOSTINT('date_end'.$predef.'day'), GETPOSTINT('date_end'.$predef.'year'));
1062 1062
 			$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
1063 1063
 
1064 1064
 			$price_min = $price_min_ttc = 0;
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 
1089 1089
 				if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) {
1090 1090
 					// If price per customer
1091
-					require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
1091
+					require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
1092 1092
 
1093 1093
 					$prodcustprice = new ProductCustomerPrice($db);
1094 1094
 
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 									$price_base_type = $custprice_line->price_base_type;
1111 1111
 									$tva_tx = $custprice_line->tva_tx;
1112 1112
 									if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', (string) $tva_tx)) {
1113
-										$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
1113
+										$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
1114 1114
 									}
1115 1115
 									$tva_npr = $custprice_line->recuperableonly;
1116 1116
 									if (empty($tva_tx)) {
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 					}
1158 1158
 				} elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
1159 1159
 					// If price per customer
1160
-					require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
1160
+					require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
1161 1161
 
1162 1162
 					$prodcustprice = new ProductCustomerPrice($db);
1163 1163
 
@@ -1176,7 +1176,7 @@  discard block
 block discarded – undo
1176 1176
 									$price_base_type = $custprice_line->price_base_type;
1177 1177
 									$tva_tx = $custprice_line->tva_tx;
1178 1178
 									if ($custprice_line->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
1179
-										$tva_tx .= ' (' . $custprice_line->default_vat_code . ')';
1179
+										$tva_tx .= ' ('.$custprice_line->default_vat_code.')';
1180 1180
 									}
1181 1181
 									$tva_npr = $custprice_line->recuperableonly;
1182 1182
 									if (empty($tva_tx)) {
@@ -1300,23 +1300,23 @@  discard block
 block discarded – undo
1300 1300
 							$outputlangs->load('products');
1301 1301
 						}
1302 1302
 						if (!empty($prod->customcode)) {
1303
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomsCode") . ': ' . $prod->customcode;
1303
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomsCode").': '.$prod->customcode;
1304 1304
 						}
1305 1305
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
1306 1306
 							$tmptxt .= ' - ';
1307 1307
 						}
1308 1308
 						if (!empty($prod->country_code)) {
1309
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $outputlangs, 0);
1309
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $outputlangs, 0);
1310 1310
 						}
1311 1311
 					} else {
1312 1312
 						if (!empty($prod->customcode)) {
1313
-							$tmptxt .= $langs->transnoentitiesnoconv("CustomsCode") . ': ' . $prod->customcode;
1313
+							$tmptxt .= $langs->transnoentitiesnoconv("CustomsCode").': '.$prod->customcode;
1314 1314
 						}
1315 1315
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
1316 1316
 							$tmptxt .= ' - ';
1317 1317
 						}
1318 1318
 						if (!empty($prod->country_code)) {
1319
-							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, '', $db, $langs, 0);
1319
+							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, '', $db, $langs, 0);
1320 1320
 						}
1321 1321
 					}
1322 1322
 					$tmptxt .= ')';
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
 			$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
1356 1356
 
1357 1357
 			// Margin
1358
-			$fournprice = (int) (GETPOST('fournprice' . $predef) ? GETPOSTINT('fournprice' . $predef) : 0);	// This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
1359
-			$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
1358
+			$fournprice = (int) (GETPOST('fournprice'.$predef) ? GETPOSTINT('fournprice'.$predef) : 0); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
1359
+			$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
1360 1360
 
1361 1361
 			// Prepare a price equivalent for minimum price check
1362 1362
 			$pu_equivalent = $pu_ht;
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
 		 */
1601 1601
 
1602 1602
 		// Add buying price
1603
-		$fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : '');				// This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
1603
+		$fournprice = (int) (GETPOST('fournprice') ? GETPOST('fournprice') : ''); // This can be id of supplier price, or 'pmpprice' or 'costprice', or 'inputprice', we force to keep ID only
1604 1604
 		$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we must keep this value
1605 1605
 
1606 1606
 		// Extrafields Lines
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
 		// Unset extrafield POST Data
1610 1610
 		if (is_array($extralabelsline)) {
1611 1611
 			foreach ($extralabelsline as $key => $value) {
1612
-				unset($_POST["options_" . $key]);
1612
+				unset($_POST["options_".$key]);
1613 1613
 			}
1614 1614
 		}
1615 1615
 
@@ -1752,7 +1752,7 @@  discard block
 block discarded – undo
1752 1752
 			}
1753 1753
 		}
1754 1754
 	} elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha')) {
1755
-		header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); //  To re-display card in edit mode
1755
+		header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); //  To re-display card in edit mode
1756 1756
 		exit();
1757 1757
 	} elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) {
1758 1758
 		$idwarehouse = GETPOSTINT('idwarehouse');
@@ -1789,7 +1789,7 @@  discard block
 block discarded – undo
1789 1789
 					GETPOST('generate_deposit', 'alpha') == 'on' && !empty($deposit_percent_from_payment_terms)
1790 1790
 					&& isModEnabled('invoice') && $user->hasRight('facture', 'creer')
1791 1791
 				) {
1792
-					require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
1792
+					require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1793 1793
 
1794 1794
 					$date = dol_mktime(0, 0, 0, GETPOSTINT('datefmonth'), GETPOSTINT('datefday'), GETPOSTINT('datefyear'));
1795 1795
 					$forceFields = array();
@@ -1802,7 +1802,7 @@  discard block
 block discarded – undo
1802 1802
 
1803 1803
 					if ($deposit) {
1804 1804
 						setEventMessage('DepositGenerated');
1805
-						$locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id;
1805
+						$locationTarget = DOL_URL_ROOT.'/compta/facture/card.php?id='.$deposit->id;
1806 1806
 					} else {
1807 1807
 						$error++;
1808 1808
 						setEventMessages($object->error, $object->errors, 'errors');
@@ -1810,7 +1810,7 @@  discard block
 block discarded – undo
1810 1810
 				}
1811 1811
 
1812 1812
 				// Define output language
1813
-				if (! $error) {
1813
+				if (!$error) {
1814 1814
 					$db->commit();
1815 1815
 
1816 1816
 					if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) {
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 					}
1839 1839
 
1840 1840
 					if ($locationTarget) {
1841
-						header('Location: ' . $locationTarget);
1841
+						header('Location: '.$locationTarget);
1842 1842
 						exit;
1843 1843
 					}
1844 1844
 				} else {
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 	}
1930 1930
 
1931 1931
 	if ($action == 'update_extras' && $permissiontoeditextra) {
1932
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
1932
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
1933 1933
 
1934 1934
 		$attribute_name = GETPOST('attribute', 'aZ09');
1935 1935
 
@@ -1961,13 +1961,13 @@  discard block
 block discarded – undo
1961 1961
 
1962 1962
 		if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) {
1963 1963
 			if ($fromElement == 'commande') {
1964
-				dol_include_once('/' . $fromElement . '/class/' . $fromElement . '.class.php');
1964
+				dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
1965 1965
 				$lineClassName = 'OrderLine';
1966 1966
 			} elseif ($fromElement == 'propal') {
1967
-				dol_include_once('/comm/' . $fromElement . '/class/' . $fromElement . '.class.php');
1967
+				dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
1968 1968
 				$lineClassName = 'PropaleLigne';
1969 1969
 			} elseif ($fromElement == 'facture') {
1970
-				dol_include_once('/compta/' . $fromElement . '/class/' . $fromElement . '.class.php');
1970
+				dol_include_once('/compta/'.$fromElement.'/class/'.$fromElement.'.class.php');
1971 1971
 				$lineClassName = 'FactureLigne';
1972 1972
 			}
1973 1973
 			$nextRang = count($object->lines) + 1;
@@ -2027,19 +2027,19 @@  discard block
 block discarded – undo
2027 2027
 	}
2028 2028
 
2029 2029
 	// Actions when printing a doc from card
2030
-	include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
2030
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
2031 2031
 
2032 2032
 	// Actions to build doc
2033 2033
 	$upload_dir = !empty($conf->commande->multidir_output[$object->entity ?? $conf->entity]) ? $conf->commande->multidir_output[$object->entity ?? $conf->entity] : $conf->commande->dir_output;
2034 2034
 	$permissiontoadd = $usercancreate;
2035
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
2035
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
2036 2036
 
2037 2037
 	// Actions to send emails
2038 2038
 	$triggersendname = 'ORDER_SENTBYMAIL';
2039 2039
 	$paramname = 'id';
2040 2040
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
2041
-	$trackid = 'ord' . $object->id;
2042
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
2041
+	$trackid = 'ord'.$object->id;
2042
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
2043 2043
 
2044 2044
 
2045 2045
 	if (!$error && getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) {
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 			}
2052 2052
 
2053 2053
 			if ($result >= 0) {
2054
-				header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
2054
+				header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
2055 2055
 				exit();
2056 2056
 			} else {
2057 2057
 				if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
 			$result = $object->delete_contact($lineid);
2074 2074
 
2075 2075
 			if ($result >= 0) {
2076
-				header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
2076
+				header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
2077 2077
 				exit();
2078 2078
 			} else {
2079 2079
 				dol_print_error($db);
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
  *	View
2088 2088
  */
2089 2089
 
2090
-$title = $object->ref . " - " . $langs->trans('Card');
2090
+$title = $object->ref." - ".$langs->trans('Card');
2091 2091
 if ($action == 'create') {
2092 2092
 	$title = $langs->trans("NewOrder");
2093 2093
 }
@@ -2160,11 +2160,11 @@  discard block
 block discarded – undo
2160 2160
 				$element = $subelement = 'contrat';
2161 2161
 			}
2162 2162
 
2163
-			dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
2163
+			dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
2164 2164
 
2165 2165
 			$classname = ucfirst($subelement);
2166 2166
 			$objectsrc = new $classname($db);
2167
-			'@phan-var-force Commande|Propal|Contrat $objectsrc';  // Can possibly be other class but CommonObject is too general
2167
+			'@phan-var-force Commande|Propal|Contrat $objectsrc'; // Can possibly be other class but CommonObject is too general
2168 2168
 			$objectsrc->fetch($originid);
2169 2169
 			if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
2170 2170
 				$objectsrc->fetch_lines();
@@ -2258,16 +2258,16 @@  discard block
 block discarded – undo
2258 2258
 		}
2259 2259
 	}
2260 2260
 
2261
-	print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
2262
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
2261
+	print '<form name="crea_commande" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
2262
+	print '<input type="hidden" name="token" value="'.newToken().'">';
2263 2263
 	print '<input type="hidden" name="action" value="add">';
2264
-	print '<input type="hidden" name="changecompany" value="0">';	// will be set to 1 by javascript so we know post is done after a company change
2265
-	print '<input type="hidden" name="remise_percent" value="' . $soc->remise_percent . '">';
2266
-	print '<input type="hidden" name="origin" value="' . $origin . '">';
2267
-	print '<input type="hidden" name="originid" value="' . $originid . '">';
2268
-	print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
2264
+	print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change
2265
+	print '<input type="hidden" name="remise_percent" value="'.$soc->remise_percent.'">';
2266
+	print '<input type="hidden" name="origin" value="'.$origin.'">';
2267
+	print '<input type="hidden" name="originid" value="'.$originid.'">';
2268
+	print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
2269 2269
 	if (!empty($currency_tx)) {
2270
-		print '<input type="hidden" name="originmulticurrency_tx" value="' . $currency_tx . '">';
2270
+		print '<input type="hidden" name="originmulticurrency_tx" value="'.$currency_tx.'">';
2271 2271
 	}
2272 2272
 
2273 2273
 	print dol_get_fiche_head([]);
@@ -2280,29 +2280,29 @@  discard block
 block discarded – undo
2280 2280
 		print '<table class="border centpercent">';
2281 2281
 
2282 2282
 		// Reference
2283
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td>' . $langs->trans("Draft") . '</td></tr>';
2283
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
2284 2284
 
2285 2285
 		// Reference client
2286
-		print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td>';
2286
+		print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
2287 2287
 		if (getDolGlobalString('MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER') && !empty($origin) && !empty($originid)) {
2288
-			print '<input type="text" name="ref_client" value="' . $ref_client . '"></td>';
2288
+			print '<input type="text" name="ref_client" value="'.$ref_client.'"></td>';
2289 2289
 		} else {
2290
-			print '<input type="text" name="ref_client" value="' . GETPOST('ref_client') . '"></td>';
2290
+			print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
2291 2291
 		}
2292 2292
 		print '</tr>';
2293 2293
 
2294 2294
 		// Thirdparty
2295 2295
 		print '<tr>';
2296
-		print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
2296
+		print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
2297 2297
 		if ($socid > 0) {
2298 2298
 			print '<td>';
2299 2299
 			print $soc->getNomUrl(1, 'customer');
2300
-			print '<input type="hidden" name="socid" value="' . $soc->id . '">';
2300
+			print '<input type="hidden" name="socid" value="'.$soc->id.'">';
2301 2301
 			print '</td>';
2302 2302
 		} else {
2303 2303
 			print '<td class="valuefieldcreate">';
2304 2304
 			$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
2305
-			print img_picto('', 'company', 'class="pictofixedwidth"') . $form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
2305
+			print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
2306 2306
 			// reload page to retrieve customer information
2307 2307
 			if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
2308 2308
 				print '<script>
@@ -2318,17 +2318,17 @@  discard block
 block discarded – undo
2318 2318
 				});
2319 2319
 				</script>';
2320 2320
 			}
2321
-			print ' <a href="' . DOL_URL_ROOT . '/societe/card.php?action=create&customer=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '"><span class="fa fa-plus-circle valignmiddle paddingleft" title="' . $langs->trans("AddThirdParty") . '"></span></a>';
2321
+			print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
2322 2322
 			print '</td>';
2323 2323
 		}
2324
-		print '</tr>' . "\n";
2324
+		print '</tr>'."\n";
2325 2325
 
2326 2326
 		// Contact of order
2327 2327
 		if ($socid > 0) {
2328 2328
 			// Contacts (ask contact only if thirdparty already defined).
2329 2329
 			// print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
2330 2330
 			print "<tr><td>";
2331
-			print $form->textwithpicto($langs->trans("DefaultContact"), $langs->trans("TypeContact_commande_external_" . $type_contact_code));
2331
+			print $form->textwithpicto($langs->trans("DefaultContact"), $langs->trans("TypeContact_commande_external_".$type_contact_code));
2332 2332
 			print '</td><td>';
2333 2333
 			print img_picto('', 'contact', 'class="pictofixedwidth"');
2334 2334
 			//print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, empty($srccontactslist) ? "" : $srccontactslist, '', 1, 'maxwidth300 widthcentpercentminusx');
@@ -2336,26 +2336,26 @@  discard block
 block discarded – undo
2336 2336
 			print '</td></tr>';
2337 2337
 
2338 2338
 			// Ligne info remises tiers
2339
-			print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
2339
+			print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
2340 2340
 
2341 2341
 			$absolute_discount = $soc->getAvailableDiscounts();
2342 2342
 
2343 2343
 			$thirdparty = $soc;
2344 2344
 			$discount_type = 0;
2345
-			$backtopage = $_SERVER["PHP_SELF"] . '?socid=' . $thirdparty->id . '&action=' . $action . '&origin=' . urlencode((string) (GETPOST('origin'))) . '&originid=' . urlencode((string) (GETPOSTINT('originid')));
2346
-			include DOL_DOCUMENT_ROOT . '/core/tpl/object_discounts.tpl.php';
2345
+			$backtopage = $_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.urlencode((string) (GETPOST('origin'))).'&originid='.urlencode((string) (GETPOSTINT('originid')));
2346
+			include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
2347 2347
 
2348 2348
 			print '</td></tr>';
2349 2349
 		}
2350 2350
 
2351 2351
 		// Date
2352
-		print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
2352
+		print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
2353 2353
 		print img_picto('', 'action', 'class="pictofixedwidth"');
2354 2354
 		print $form->selectDate('', 're', 0, 0, 0, "crea_commande", 1, 1); // Always autofill date with current date
2355 2355
 		print '</td></tr>';
2356 2356
 
2357 2357
 		// Date delivery planned
2358
-		print '<tr><td>' . $langs->trans("DateDeliveryPlanned") . '</td>';
2358
+		print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
2359 2359
 		print '<td colspan="3">';
2360 2360
 		$date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date);
2361 2361
 		print img_picto('', 'action', 'class="pictofixedwidth"');
@@ -2364,33 +2364,33 @@  discard block
 block discarded – undo
2364 2364
 		print '</tr>';
2365 2365
 
2366 2366
 		// Delivery delay
2367
-		print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td>';
2367
+		print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
2368 2368
 		print img_picto('', 'clock', 'class="pictofixedwidth"');
2369 2369
 		$form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id') : $availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
2370 2370
 		print '</td></tr>';
2371 2371
 
2372 2372
 		// Terms of payment
2373
-		print '<tr><td class="nowrap">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
2373
+		print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
2374 2374
 		print img_picto('', 'payment', 'class="pictofixedwidth"');
2375 2375
 		print $form->getSelectConditionsPaiements((int) $cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', (float) $deposit_percent);
2376 2376
 		print '</td></tr>';
2377 2377
 
2378 2378
 		// Payment mode
2379
-		print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td>';
2379
+		print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
2380 2380
 		print img_picto('', 'bank', 'class="pictofixedwidth"');
2381 2381
 		print $form->select_types_paiements((string) $mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
2382 2382
 		print '</td></tr>';
2383 2383
 
2384 2384
 		// Bank Account
2385 2385
 		if (getDolGlobalString('BANK_ASK_PAYMENT_BANK_DURING_ORDER') && isModEnabled("bank")) {
2386
-			print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
2387
-			print img_picto('', 'bank_account', 'class="pictofixedwidth"') . $form->select_comptes((int) $fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
2386
+			print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
2387
+			print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((int) $fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
2388 2388
 			print '</td></tr>';
2389 2389
 		}
2390 2390
 
2391 2391
 		// Shipping Method
2392 2392
 		if (isModEnabled('shipping')) {
2393
-			print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
2393
+			print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
2394 2394
 			print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
2395 2395
 			$form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOSTINT('shipping_method_id') != 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
2396 2396
 			print '</td></tr>';
@@ -2398,15 +2398,15 @@  discard block
 block discarded – undo
2398 2398
 
2399 2399
 		// Warehouse
2400 2400
 		if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
2401
-			require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
2401
+			require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
2402 2402
 			$formproduct = new FormProduct($db);
2403
-			print '<tr><td>' . $langs->trans('Warehouse') . '</td><td>';
2404
-			print img_picto('', 'stock', 'class="pictofixedwidth"') . $formproduct->selectWarehouses((GETPOSTISSET('warehouse_id') ? GETPOST('warehouse_id') : $warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx');
2403
+			print '<tr><td>'.$langs->trans('Warehouse').'</td><td>';
2404
+			print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id') ? GETPOST('warehouse_id') : $warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx');
2405 2405
 			print '</td></tr>';
2406 2406
 		}
2407 2407
 
2408 2408
 		// Source / Channel - What trigger creation
2409
-		print '<tr><td>' . $langs->trans('Source') . '</td><td>';
2409
+		print '<tr><td>'.$langs->trans('Source').'</td><td>';
2410 2410
 		print img_picto('', 'question', 'class="pictofixedwidth"');
2411 2411
 		$form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id') : $demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
2412 2412
 		print '</td></tr>';
@@ -2417,9 +2417,9 @@  discard block
 block discarded – undo
2417 2417
 		if (isModEnabled('project')) {
2418 2418
 			$langs->load("projects");
2419 2419
 			print '<tr>';
2420
-			print '<td>' . $langs->trans("Project") . '</td><td>';
2421
-			print img_picto('', 'project', 'class="pictofixedwidth"') . $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid') ? GETPOST('projectid') : $projectid), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
2422
-			print ' <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $soc->id) . '"><span class="fa fa-plus-circle valignmiddle" title="' . $langs->trans("AddProject") . '"></span></a>';
2420
+			print '<td>'.$langs->trans("Project").'</td><td>';
2421
+			print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid') ? GETPOST('projectid') : $projectid), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
2422
+			print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
2423 2423
 			print '</td>';
2424 2424
 			print '</tr>';
2425 2425
 		}
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 		// Incoterms
2428 2428
 		if (isModEnabled('incoterm')) {
2429 2429
 			print '<tr>';
2430
-			print '<td><label for="incoterm_id">' . $form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->fk_incoterms) ? (string) $objectsrc->fk_incoterms : (string) $soc->fk_incoterms, 1) . '</label></td>';
2430
+			print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->fk_incoterms) ? (string) $objectsrc->fk_incoterms : (string) $soc->fk_incoterms, 1).'</label></td>';
2431 2431
 			print '<td class="maxwidthonsmartphone">';
2432 2432
 			$incoterm_id = GETPOST('incoterm_id');
2433 2433
 			$location_incoterms = GETPOST('location_incoterms');
@@ -2443,7 +2443,7 @@  discard block
 block discarded – undo
2443 2443
 		// Other attributes
2444 2444
 		$parameters = array();
2445 2445
 		if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
2446
-			$parameters['objectsrc'] =  $objectsrc;
2446
+			$parameters['objectsrc'] = $objectsrc;
2447 2447
 		}
2448 2448
 		$parameters['socid'] = $socid;
2449 2449
 
@@ -2464,9 +2464,9 @@  discard block
 block discarded – undo
2464 2464
 		}
2465 2465
 
2466 2466
 		// Template to use by default
2467
-		print '<tr><td>' . $langs->trans('DefaultModel') . '</td>';
2467
+		print '<tr><td>'.$langs->trans('DefaultModel').'</td>';
2468 2468
 		print '<td>';
2469
-		include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php';
2469
+		include_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php';
2470 2470
 		$liste = ModelePDFCommandes::liste_modeles($db);
2471 2471
 		$preselected = getDolGlobalString('COMMANDE_ADDON_PDF');
2472 2472
 		print img_picto('', 'pdf', 'class="pictofixedwidth"');
@@ -2476,22 +2476,22 @@  discard block
 block discarded – undo
2476 2476
 		// Multicurrency
2477 2477
 		if (isModEnabled("multicurrency")) {
2478 2478
 			print '<tr>';
2479
-			print '<td>' . $form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0) . '</td>';
2479
+			print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
2480 2480
 			print '<td class="maxwidthonsmartphone">';
2481
-			print img_picto('', 'currency', 'class="pictofixedwidth"') . $form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
2481
+			print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency(((GETPOSTISSET('multicurrency_code') && !GETPOST('changecompany')) ? GETPOST('multicurrency_code') : $currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
2482 2482
 			print '</td></tr>';
2483 2483
 		}
2484 2484
 
2485 2485
 		// Categories
2486 2486
 		if (isModEnabled('category')) {
2487
-			print '<tr><td>' . $langs->trans("Categories") . '</td><td colspan="3">';
2487
+			print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
2488 2488
 			print $form->selectCategories(Categorie::TYPE_ORDER, 'categories', $object);
2489 2489
 			print "</td></tr>";
2490 2490
 		}
2491 2491
 
2492 2492
 		// Note public
2493 2493
 		print '<tr>';
2494
-		print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
2494
+		print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
2495 2495
 		print '<td>';
2496 2496
 
2497 2497
 		$doleditor = new DolEditor('note_public', (string) $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
@@ -2502,7 +2502,7 @@  discard block
 block discarded – undo
2502 2502
 		// Note private
2503 2503
 		if (empty($user->socid)) {
2504 2504
 			print '<tr>';
2505
-			print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
2505
+			print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
2506 2506
 			print '<td>';
2507 2507
 
2508 2508
 			$doleditor = new DolEditor('note_private', (string) $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
@@ -2520,12 +2520,12 @@  discard block
 block discarded – undo
2520 2520
 				$objectsrc->update_price(1);
2521 2521
 			}
2522 2522
 
2523
-			print "\n<!-- " . $classname . " info -->\n";
2524
-			print '<input type="hidden" name="amount"   value="' . $objectsrc->total_ht . '">' . "\n";
2525
-			print '<input type="hidden" name="total"    value="' . $objectsrc->total_ttc . '">' . "\n";
2526
-			print '<input type="hidden" name="tva"      value="' . $objectsrc->total_tva . '">' . "\n";
2527
-			print '<input type="hidden" name="origin"   value="' . $objectsrc->element . '">';
2528
-			print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
2523
+			print "\n<!-- ".$classname." info -->\n";
2524
+			print '<input type="hidden" name="amount"   value="'.$objectsrc->total_ht.'">'."\n";
2525
+			print '<input type="hidden" name="total"    value="'.$objectsrc->total_ttc.'">'."\n";
2526
+			print '<input type="hidden" name="tva"      value="'.$objectsrc->total_tva.'">'."\n";
2527
+			print '<input type="hidden" name="origin"   value="'.$objectsrc->element.'">';
2528
+			print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
2529 2529
 
2530 2530
 			switch ($classname) {
2531 2531
 				case 'Propal':
@@ -2544,25 +2544,25 @@  discard block
 block discarded – undo
2544 2544
 					$newclassname = $classname;
2545 2545
 			}
2546 2546
 
2547
-			print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
2547
+			print '<tr><td>'.$langs->trans($newclassname).'</td><td>'.$objectsrc->getNomUrl(1).'</td></tr>';
2548 2548
 
2549 2549
 			// Amount
2550
-			print '<tr><td>' . $langs->trans('AmountHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
2551
-			print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
2550
+			print '<tr><td>'.$langs->trans('AmountHT').'</td><td>'.price($objectsrc->total_ht).'</td></tr>';
2551
+			print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($objectsrc->total_tva)."</td></tr>";
2552 2552
 			if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) { 		// Localtax1 RE
2553
-				print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax1) . "</td></tr>";
2553
+				print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax1)."</td></tr>";
2554 2554
 			}
2555 2555
 
2556 2556
 			if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) { 		// Localtax2 IRPF
2557
-				print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax2) . "</td></tr>";
2557
+				print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax2)."</td></tr>";
2558 2558
 			}
2559 2559
 
2560
-			print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td>' . price($objectsrc->total_ttc) . "</td></tr>";
2560
+			print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($objectsrc->total_ttc)."</td></tr>";
2561 2561
 
2562 2562
 			if (isModEnabled("multicurrency")) {
2563
-				print '<tr><td>' . $langs->trans('MulticurrencyAmountHT') . '</td><td>' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
2564
-				print '<tr><td>' . $langs->trans('MulticurrencyAmountVAT') . '</td><td>' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
2565
-				print '<tr><td>' . $langs->trans('MulticurrencyAmountTTC') . '</td><td>' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
2563
+				print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td>'.price($objectsrc->multicurrency_total_ht).'</td></tr>';
2564
+				print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td>'.price($objectsrc->multicurrency_total_tva)."</td></tr>";
2565
+				print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td>'.price($objectsrc->multicurrency_total_ttc)."</td></tr>";
2566 2566
 			}
2567 2567
 		}
2568 2568
 
@@ -2613,7 +2613,7 @@  discard block
 block discarded – undo
2613 2613
 
2614 2614
 		// Confirmation to delete
2615 2615
 		if ($action == 'delete') {
2616
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
2616
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
2617 2617
 		}
2618 2618
 
2619 2619
 		// Confirmation of validation
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
 
2633 2633
 			$text = $langs->trans('ConfirmValidateOrder', $numref);
2634 2634
 			if (isModEnabled('notification')) {
2635
-				require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
2635
+				require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
2636 2636
 				$notify = new Notify($db);
2637 2637
 				$text .= '<br>';
2638 2638
 				$text .= $notify->confirmMessage('ORDER_VALIDATE', $object->socid, $object);
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
 			$formquestion = array();
2649 2649
 			if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER') && $qualified_for_stock_change) {
2650 2650
 				$langs->load("stocks");
2651
-				require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
2651
+				require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
2652 2652
 				$formproduct = new FormProduct($db);
2653 2653
 				$forcecombo = 0;
2654 2654
 				if ($conf->browser->name == 'ie') {
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
 			$nbMandated = 0;
2667 2667
 			foreach ($object->lines as $line) {
2668 2668
 				$res = $line->fetch_product();
2669
-				if ($res  > 0) {
2669
+				if ($res > 0) {
2670 2670
 					if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end))) {
2671 2671
 						$nbMandated++;
2672 2672
 						break;
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
 					setEventMessages($langs->trans("mandatoryPeriodNeedTobeSetMsgValidate"), null, 'errors');
2679 2679
 					$error++;
2680 2680
 				} else {
2681
-					$text .= '<div><span class="clearboth nowraponall warning">' . img_warning() . $langs->trans("mandatoryPeriodNeedTobeSetMsgValidate") . '</span></div>';
2681
+					$text .= '<div><span class="clearboth nowraponall warning">'.img_warning().$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'</span></div>';
2682 2682
 				}
2683 2683
 			}
2684 2684
 
@@ -2690,7 +2690,7 @@  discard block
 block discarded – undo
2690 2690
 				$deposit_percent_from_payment_terms = (float) getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
2691 2691
 
2692 2692
 				if (!empty($deposit_percent_from_payment_terms) && isModEnabled('invoice') && $user->hasRight('facture', 'creer')) {
2693
-					require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
2693
+					require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
2694 2694
 
2695 2695
 					$object->fetchObjectLinked();
2696 2696
 
@@ -2793,7 +2793,7 @@  discard block
 block discarded – undo
2793 2793
 			}
2794 2794
 
2795 2795
 			if (!$error) {
2796
-				$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 240);
2796
+				$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 240);
2797 2797
 			}
2798 2798
 		}
2799 2799
 
@@ -2810,7 +2810,7 @@  discard block
 block discarded – undo
2810 2810
 			$formquestion = array();
2811 2811
 			if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER') && $qualified_for_stock_change) {
2812 2812
 				$langs->load("stocks");
2813
-				require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
2813
+				require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
2814 2814
 				$formproduct = new FormProduct($db);
2815 2815
 				$forcecombo = 0;
2816 2816
 				if ($conf->browser->name == 'ie') {
@@ -2829,12 +2829,12 @@  discard block
 block discarded – undo
2829 2829
 				];
2830 2830
 			}
2831 2831
 
2832
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
2832
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
2833 2833
 		}
2834 2834
 
2835 2835
 		// Confirmation of closing
2836 2836
 		if ($action == 'shipped') {
2837
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_shipped', '', 0, 1);
2837
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('CloseOrder'), $langs->trans('ConfirmCloseOrder'), 'confirm_shipped', '', 0, 1);
2838 2838
 		}
2839 2839
 
2840 2840
 		// Confirmation of cancellation
@@ -2850,7 +2850,7 @@  discard block
 block discarded – undo
2850 2850
 			$formquestion = array();
2851 2851
 			if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER') && $qualified_for_stock_change) {
2852 2852
 				$langs->load("stocks");
2853
-				require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
2853
+				require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
2854 2854
 				$formproduct = new FormProduct($db);
2855 2855
 				$forcecombo = 0;
2856 2856
 				if ($conf->browser->name == 'ie') {
@@ -2864,12 +2864,12 @@  discard block
 block discarded – undo
2864 2864
 				);
2865 2865
 			}
2866 2866
 
2867
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans("Cancel"), $text, 'confirm_cancel', $formquestion, 0, 1);
2867
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("Cancel"), $text, 'confirm_cancel', $formquestion, 0, 1);
2868 2868
 		}
2869 2869
 
2870 2870
 		// Confirmation to delete line
2871 2871
 		if ($action == 'ask_deleteline') {
2872
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
2872
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
2873 2873
 		}
2874 2874
 
2875 2875
 		// Confirmation de la suppression d'une ligne subtotal
@@ -2882,7 +2882,7 @@  discard block
 block discarded – undo
2882 2882
 				$title = "DeleteTitleLine";
2883 2883
 				$question = "ConfirmDeleteTitleLine";
2884 2884
 			}
2885
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans($title), $langs->trans($question), 'confirm_delete_subtotalline', $formconfirm, 'no', 1);
2885
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans($title), $langs->trans($question), 'confirm_delete_subtotalline', $formconfirm, 'no', 1);
2886 2886
 		}
2887 2887
 
2888 2888
 		// Clone confirmation
@@ -2892,7 +2892,7 @@  discard block
 block discarded – undo
2892 2892
 			$formquestion = array(
2893 2893
 				array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid'), 'socid', $filter, '', 0, 0, array(), 0, 'maxwidth300'))
2894 2894
 			);
2895
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
2895
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
2896 2896
 		}
2897 2897
 
2898 2898
 		// Subtotal line form
@@ -2900,12 +2900,12 @@  discard block
 block discarded – undo
2900 2900
 			$langs->load('subtotals');
2901 2901
 			$type = 'title';
2902 2902
 			$depth_array = $object->getPossibleLevels($langs);
2903
-			include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_create.tpl.php';
2903
+			include DOL_DOCUMENT_ROOT.'/core/tpl/subtotal_create.tpl.php';
2904 2904
 		} elseif ($action == 'add_subtotal_line') {
2905 2905
 			$langs->load('subtotals');
2906 2906
 			$type = 'subtotal';
2907 2907
 			$titles = $object->getPossibleTitles();
2908
-			include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_create.tpl.php';
2908
+			include DOL_DOCUMENT_ROOT.'/core/tpl/subtotal_create.tpl.php';
2909 2909
 		}
2910 2910
 
2911 2911
 		// Call Hook formConfirm
@@ -2924,16 +2924,16 @@  discard block
 block discarded – undo
2924 2924
 
2925 2925
 		// Order card
2926 2926
 
2927
-		$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
2927
+		$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
2928 2928
 
2929 2929
 		$morehtmlref = '<div class="refidno">';
2930 2930
 		// Ref customer
2931 2931
 		$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, (int) $usercancreate, 'string', '', 0, 1);
2932
-		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, (int) $usercancreate, 'string' . (isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
2932
+		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, (int) $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
2933 2933
 		// Thirdparty
2934
-		$morehtmlref .= '<br>' . $soc->getNomUrl(1, 'customer');
2934
+		$morehtmlref .= '<br>'.$soc->getNomUrl(1, 'customer');
2935 2935
 		if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
2936
-			$morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/commande/list.php?socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherOrders") . '</a>)';
2936
+			$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
2937 2937
 		}
2938 2938
 		// Project
2939 2939
 		if (isModEnabled('project')) {
@@ -2942,16 +2942,16 @@  discard block
 block discarded – undo
2942 2942
 			if ($usercancreate) {
2943 2943
 				$morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
2944 2944
 				if ($action != 'classify') {
2945
-					$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
2945
+					$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
2946 2946
 				}
2947
-				$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
2947
+				$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
2948 2948
 			} else {
2949 2949
 				if (!empty($object->fk_project)) {
2950 2950
 					$proj = new Project($db);
2951 2951
 					$proj->fetch($object->fk_project);
2952 2952
 					$morehtmlref .= $proj->getNomUrl(1);
2953 2953
 					if ($proj->title) {
2954
-						$morehtmlref .= '<span class="opacitymedium"> - ' . dol_escape_htmltag($proj->title) . '</span>';
2954
+						$morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
2955 2955
 					}
2956 2956
 				}
2957 2957
 			}
@@ -2979,20 +2979,20 @@  discard block
 block discarded – undo
2979 2979
 				print $form->textwithpicto($langs->trans('PointOfSale'), $langs->trans('POSInfo'));
2980 2980
 				print '</td>';
2981 2981
 				if ($action != 'editposinfo' && $usercancreate) {
2982
-					print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editposinfo&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetPOSInfo'), 1) . '</a></td>';
2982
+					print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editposinfo&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetPOSInfo'), 1).'</a></td>';
2983 2983
 				}
2984 2984
 				print '</tr></table>';
2985 2985
 				print '</td><td class="valuefield fieldname_type">';
2986
-				print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" name="formposinfo">';
2986
+				print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" name="formposinfo">';
2987 2987
 				print '<input type="hidden" name="action" value="setposinfo">';
2988
-				print '<input type="hidden" name="token" value="' . newToken() . '">';
2988
+				print '<input type="hidden" name="token" value="'.newToken().'">';
2989 2989
 				if ($action == 'editposinfo') {
2990
-					print '<input type="text" class="maxwidth150" name="posmodule" placeholder="' . $langs->trans("POSModule") . '" value="' . $object->module_source . '"> ';
2991
-					print '<input type="text" class="maxwidth100" name="posterminal" placeholder="' . $langs->trans("Terminal") . '" value="' . $object->pos_source . '">';
2992
-					print '<input type="submit" class="button" name="submitposinfo" value="' . $langs->trans("Submit") . '">';
2990
+					print '<input type="text" class="maxwidth150" name="posmodule" placeholder="'.$langs->trans("POSModule").'" value="'.$object->module_source.'"> ';
2991
+					print '<input type="text" class="maxwidth100" name="posterminal" placeholder="'.$langs->trans("Terminal").'" value="'.$object->pos_source.'">';
2992
+					print '<input type="submit" class="button" name="submitposinfo" value="'.$langs->trans("Submit").'">';
2993 2993
 				} else {
2994 2994
 					if ($object->module_source) {
2995
-						print '<span class="opacitymediumbycolor paddingleft">' . dolPrintHTML(ucfirst($object->module_source) . ' - ' . $langs->transnoentitiesnoconv("Terminal") . ' ' . $object->pos_source) . '</span>';
2995
+						print '<span class="opacitymediumbycolor paddingleft">'.dolPrintHTML(ucfirst($object->module_source).' - '.$langs->transnoentitiesnoconv("Terminal").' '.$object->pos_source).'</span>';
2996 2996
 					}
2997 2997
 				}
2998 2998
 				print '</form>';
@@ -3005,7 +3005,7 @@  discard block
 block discarded – undo
3005 3005
 				print $langs->trans('OutstandingBill');
3006 3006
 				print '</td><td class="valuefield">';
3007 3007
 				$arrayoutstandingbills = $soc->getOutstandingBills();
3008
-				print price($arrayoutstandingbills['opened']) . ' / ';
3008
+				print price($arrayoutstandingbills['opened']).' / ';
3009 3009
 				print price($soc->outstanding_limit, 0, '', 1, -1, -1, $conf->currency);
3010 3010
 				print '</td>';
3011 3011
 				print '</tr>';
@@ -3020,11 +3020,11 @@  discard block
 block discarded – undo
3020 3020
 				$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
3021 3021
 			}
3022 3022
 
3023
-			$addrelativediscount = '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditRelativeDiscounts") . '</a>';
3024
-			$addabsolutediscount = '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $soc->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("EditGlobalDiscounts") . '</a>';
3025
-			$addcreditnote = '<a href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $soc->id . '&type=2&backtopage=' . urlencode($_SERVER["PHP_SELF"]) . '?facid=' . $object->id . '">' . $langs->trans("AddCreditNote") . '</a>';
3023
+			$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("EditRelativeDiscounts").'</a>';
3024
+			$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$soc->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("EditGlobalDiscounts").'</a>';
3025
+			$addcreditnote = '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$soc->id.'&type=2&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?facid='.$object->id.'">'.$langs->trans("AddCreditNote").'</a>';
3026 3026
 
3027
-			print '<tr><td class="titlefield">' . $langs->trans('Discounts') . '</td><td class="valuefield">';
3027
+			print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td class="valuefield">';
3028 3028
 
3029 3029
 			$absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount);
3030 3030
 			$absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote);
@@ -3033,8 +3033,8 @@  discard block
 block discarded – undo
3033 3033
 
3034 3034
 			$thirdparty = $soc;
3035 3035
 			$discount_type = 0;
3036
-			$backtopage = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
3037
-			include DOL_DOCUMENT_ROOT . '/core/tpl/object_discounts.tpl.php';
3036
+			$backtopage = $_SERVER["PHP_SELF"].'?id='.$object->id;
3037
+			include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
3038 3038
 
3039 3039
 			print '</td></tr>';
3040 3040
 
@@ -3044,17 +3044,17 @@  discard block
 block discarded – undo
3044 3044
 			print $form->editfieldkey("Date", 'date', '', $object, (int) $editenable);
3045 3045
 			print '</td><td class="valuefield">';
3046 3046
 			if ($action == 'editdate') {
3047
-				print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
3048
-				print '<input type="hidden" name="token" value="' . newToken() . '">';
3047
+				print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
3048
+				print '<input type="hidden" name="token" value="'.newToken().'">';
3049 3049
 				print '<input type="hidden" name="action" value="setdate">';
3050
-				print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
3050
+				print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
3051 3051
 				print $form->selectDate($object->date, 'order_', 0, 0, 0, "setdate");
3052
-				print '<input type="submit" class="button button-edit" value="' . $langs->trans('Modify') . '">';
3052
+				print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
3053 3053
 				print '</form>';
3054 3054
 			} else {
3055 3055
 				print $object->date ? dol_print_date($object->date, 'day') : '&nbsp;';
3056 3056
 				if ($object->hasDelay() && empty($object->delivery_date)) {	// If there is a delivery date planned, warning should be on this date
3057
-					print ' ' . img_picto($langs->trans("Late") . ' : ' . $object->showDelay(), "warning");
3057
+					print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
3058 3058
 				}
3059 3059
 			}
3060 3060
 			print '</td>';
@@ -3066,17 +3066,17 @@  discard block
 block discarded – undo
3066 3066
 			print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, (int) $editenable);
3067 3067
 			print '</td><td class="valuefield">';
3068 3068
 			if ($action == 'editdate_livraison') {
3069
-				print '<form name="setdate_livraison" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
3070
-				print '<input type="hidden" name="token" value="' . newToken() . '">';
3069
+				print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
3070
+				print '<input type="hidden" name="token" value="'.newToken().'">';
3071 3071
 				print '<input type="hidden" name="action" value="setdate_livraison">';
3072
-				print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
3072
+				print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
3073 3073
 				print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0);
3074
-				print '<input type="submit" class="button button-edit" value="' . $langs->trans('Modify') . '">';
3074
+				print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
3075 3075
 				print '</form>';
3076 3076
 			} else {
3077 3077
 				print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : '&nbsp;';
3078 3078
 				if ($object->hasDelay() && !empty($object->delivery_date)) {
3079
-					print ' ' . img_picto($langs->trans("Late") . ' : ' . $object->showDelay(), "warning");
3079
+					print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
3080 3080
 				}
3081 3081
 			}
3082 3082
 			print '</td>';
@@ -3088,9 +3088,9 @@  discard block
 block discarded – undo
3088 3088
 			print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, (int) $editenable);
3089 3089
 			print '</td><td class="valuefield">';
3090 3090
 			if ($action == 'editavailability') {
3091
-				$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->availability_id, 'availability_id', 1);
3091
+				$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'availability_id', 1);
3092 3092
 			} else {
3093
-				$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->availability_id, 'none', 1);
3093
+				$form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'none', 1);
3094 3094
 			}
3095 3095
 			print '</td></tr>';
3096 3096
 
@@ -3101,9 +3101,9 @@  discard block
 block discarded – undo
3101 3101
 				print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, (int) $editenable);
3102 3102
 				print '</td><td class="valuefield">';
3103 3103
 				if ($action == 'editshippingmethod') {
3104
-					$form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1);
3104
+					$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1);
3105 3105
 				} else {
3106
-					$form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->shipping_method_id, 'none');
3106
+					$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'none');
3107 3107
 				}
3108 3108
 				print '</td>';
3109 3109
 				print '</tr>';
@@ -3112,16 +3112,16 @@  discard block
 block discarded – undo
3112 3112
 			// Warehouse
3113 3113
 			if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
3114 3114
 				$langs->load('stocks');
3115
-				require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
3115
+				require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
3116 3116
 				$formproduct = new FormProduct($db);
3117 3117
 				print '<tr><td>';
3118 3118
 				$editenable = $usercancreate;
3119 3119
 				print $form->editfieldkey("Warehouse", 'warehouse', '', $object, (int) $editenable);
3120 3120
 				print '</td><td class="valuefield">';
3121 3121
 				if ($action == 'editwarehouse') {
3122
-					$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->warehouse_id, 'warehouse_id', 1);
3122
+					$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
3123 3123
 				} else {
3124
-					$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->warehouse_id, 'none');
3124
+					$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
3125 3125
 				}
3126 3126
 				print '</td>';
3127 3127
 				print '</tr>';
@@ -3133,9 +3133,9 @@  discard block
 block discarded – undo
3133 3133
 			print $form->editfieldkey("Source", 'demandreason', '', $object, (int) $editenable);
3134 3134
 			print '</td><td class="valuefield">';
3135 3135
 			if ($action == 'editdemandreason') {
3136
-				$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1);
3136
+				$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1);
3137 3137
 			} else {
3138
-				$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->demand_reason_id, 'none');
3138
+				$form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none');
3139 3139
 			}
3140 3140
 			print '</td></tr>';
3141 3141
 
@@ -3145,9 +3145,9 @@  discard block
 block discarded – undo
3145 3145
 			print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, (int) $editenable);
3146 3146
 			print '</td><td class="valuefield">';
3147 3147
 			if ($action == 'editconditions') {
3148
-				$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent);
3148
+				$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'cond_reglement_id', 1, '', 1, $object->deposit_percent);
3149 3149
 			} else {
3150
-				$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent);
3150
+				$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->cond_reglement_id, 'none', 1, '', 1, $object->deposit_percent);
3151 3151
 			}
3152 3152
 			print '</td>';
3153 3153
 
@@ -3159,9 +3159,9 @@  discard block
 block discarded – undo
3159 3159
 			print $form->editfieldkey("PaymentMode", 'mode', '', $object, (int) $editenable);
3160 3160
 			print '</td><td class="valuefield">';
3161 3161
 			if ($action == 'editmode') {
3162
-				$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
3162
+				$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
3163 3163
 			} else {
3164
-				$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->mode_reglement_id, 'none');
3164
+				$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->mode_reglement_id, 'none');
3165 3165
 			}
3166 3166
 			print '</td></tr>';
3167 3167
 
@@ -3183,13 +3183,13 @@  discard block
 block discarded – undo
3183 3183
 			$totalWeight = $tmparray['weight'];
3184 3184
 			$totalVolume = $tmparray['volume'];
3185 3185
 			if ($totalWeight) {
3186
-				print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
3186
+				print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
3187 3187
 				print '<td class="valuefield">';
3188 3188
 				print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
3189 3189
 				print '</td></tr>';
3190 3190
 			}
3191 3191
 			if ($totalVolume) {
3192
-				print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
3192
+				print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
3193 3193
 				print '<td class="valuefield">';
3194 3194
 				print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
3195 3195
 				print '</td></tr>';
@@ -3207,7 +3207,7 @@  discard block
 block discarded – undo
3207 3207
 				if ($action != 'editincoterm') {
3208 3208
 					print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
3209 3209
 				} else {
3210
-					print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'] . '?id=' . $object->id);
3210
+					print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
3211 3211
 				}
3212 3212
 				print '</td></tr>';
3213 3213
 			}
@@ -3219,9 +3219,9 @@  discard block
 block discarded – undo
3219 3219
 				print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, (int) $editenable);
3220 3220
 				print '</td><td class="valuefield">';
3221 3221
 				if ($action == 'editbankaccount') {
3222
-					$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'fk_account', 1);
3222
+					$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'fk_account', 1);
3223 3223
 				} else {
3224
-					$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, (string) $object->fk_account, 'none');
3224
+					$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->fk_account, 'none');
3225 3225
 				}
3226 3226
 				print '</td>';
3227 3227
 				print '</tr>';
@@ -3234,7 +3234,7 @@  discard block
 block discarded – undo
3234 3234
 				print $langs->trans("Categories");
3235 3235
 				print '<td><td class="right">';
3236 3236
 				if ($usercancreate) {
3237
-					print '<a class="editfielda" href="' . DOL_URL_ROOT . '/commande/card.php?id=' . $object->id . '&action=edittags&token=' . newToken() . '">' . img_edit() . '</a>';
3237
+					print '<a class="editfielda" href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=edittags&token='.newToken().'">'.img_edit().'</a>';
3238 3238
 				} else {
3239 3239
 					print '&nbsp;';
3240 3240
 				}
@@ -3242,11 +3242,11 @@  discard block
 block discarded – undo
3242 3242
 				print '</td>';
3243 3243
 				print '<td>';
3244 3244
 				if ($action == 'edittags') {
3245
-					print '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
3245
+					print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
3246 3246
 					print '<input type="hidden" name="action" value="settags">';
3247
-					print '<input type="hidden" name="token" value="' . newToken() . '">';
3247
+					print '<input type="hidden" name="token" value="'.newToken().'">';
3248 3248
 					print $form->selectCategories(Categorie::TYPE_ORDER, 'categories', $object);
3249
-					print '<input type="submit" class="button valignmiddle smallpaddingimp" value="' . $langs->trans("Modify") . '">';
3249
+					print '<input type="submit" class="button valignmiddle smallpaddingimp" value="'.$langs->trans("Modify").'">';
3250 3250
 					print '</form>';
3251 3251
 				} else {
3252 3252
 					print $form->showCategories($object->id, Categorie::TYPE_ORDER, 1);
@@ -3255,7 +3255,7 @@  discard block
 block discarded – undo
3255 3255
 			}
3256 3256
 
3257 3257
 			// Other attributes
3258
-			include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
3258
+			include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
3259 3259
 
3260 3260
 			print '</table>';
3261 3261
 
@@ -3265,40 +3265,40 @@  discard block
 block discarded – undo
3265 3265
 
3266 3266
 			print '<table class="border tableforfield centpercent">';
3267 3267
 
3268
-			include DOL_DOCUMENT_ROOT . '/core/tpl/object_currency_amount.tpl.php';
3268
+			include DOL_DOCUMENT_ROOT.'/core/tpl/object_currency_amount.tpl.php';
3269 3269
 
3270 3270
 			$alert = '';
3271 3271
 			if (getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT') && $object->total_ht < $object->thirdparty->order_min_amount) {
3272
-				$alert = ' ' . img_warning($langs->trans('OrderMinAmount') . ': ' . price($object->thirdparty->order_min_amount));
3272
+				$alert = ' '.img_warning($langs->trans('OrderMinAmount').': '.price($object->thirdparty->order_min_amount));
3273 3273
 			}
3274 3274
 
3275 3275
 			print '<tr>';
3276
-			print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
3277
-			print '<td class="nowrap amountcard right">' . price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
3276
+			print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
3277
+			print '<td class="nowrap amountcard right">'.price($object->total_ht, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
3278 3278
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3279 3279
 				// Multicurrency Amount HT
3280
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3280
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3281 3281
 			}
3282 3282
 			print '</tr>';
3283 3283
 
3284 3284
 			print '<tr>';
3285
-			print '<td class="titlefieldmiddle">' . $langs->trans('AmountVAT') . '</td>';
3286
-			print '<td class="nowrap amountcard right">' . price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
3285
+			print '<td class="titlefieldmiddle">'.$langs->trans('AmountVAT').'</td>';
3286
+			print '<td class="nowrap amountcard right">'.price($object->total_tva, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
3287 3287
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3288 3288
 				// Multicurrency Amount VAT
3289
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3289
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3290 3290
 			}
3291 3291
 			print '</tr>';
3292 3292
 
3293 3293
 			// Amount Local Taxes
3294 3294
 			if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) {
3295 3295
 				print '<tr>';
3296
-				print '<td class="titlefieldmiddle">' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
3297
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
3296
+				print '<td class="titlefieldmiddle">'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
3297
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
3298 3298
 				if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3299 3299
 					$object->multicurrency_total_localtax1 = price2num($object->total_localtax1 * $object->multicurrency_tx, 'MT');
3300 3300
 
3301
-					print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3301
+					print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax1, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3302 3302
 				}
3303 3303
 				print '</tr>';
3304 3304
 			}
@@ -3306,24 +3306,24 @@  discard block
 block discarded – undo
3306 3306
 			// Amount Local Taxes
3307 3307
 			if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {
3308 3308
 				print '<tr>';
3309
-				print '<td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
3310
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency) . '</td>';
3309
+				print '<td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
3310
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency).'</td>';
3311 3311
 				if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3312 3312
 					$object->multicurrency_total_localtax2 = price2num($object->total_localtax2 * $object->multicurrency_tx, 'MT');
3313 3313
 
3314
-					print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3314
+					print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_localtax2, 0, $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3315 3315
 				}
3316 3316
 				print '</tr>';
3317 3317
 			}
3318 3318
 
3319 3319
 			print '<tr>';
3320
-			print '<td>' . $langs->trans('AmountTTC') . '</td>';
3321
-			print '<td class="valuefield nowrap right amountcard">' . price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency) . '</td>';
3320
+			print '<td>'.$langs->trans('AmountTTC').'</td>';
3321
+			print '<td class="valuefield nowrap right amountcard">'.price($object->total_ttc, 1, '', 1, -1, -1, $conf->currency).'</td>';
3322 3322
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3323 3323
 				// Multicurrency Amount TTC
3324
-				print '<td class="valuefield nowrap right amountcard">' . price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code) . '</td>';
3324
+				print '<td class="valuefield nowrap right amountcard">'.price($object->multicurrency_total_ttc, 1, '', 1, -1, -1, $object->multicurrency_code).'</td>';
3325 3325
 			}
3326
-			print '</tr>' . "\n";
3326
+			print '</tr>'."\n";
3327 3327
 
3328 3328
 			print '</table>';
3329 3329
 
@@ -3344,13 +3344,13 @@  discard block
 block discarded – undo
3344 3344
 			if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
3345 3345
 				$blocname = 'contacts';
3346 3346
 				$title = $langs->trans('ContactsAddresses');
3347
-				include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php';
3347
+				include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
3348 3348
 			}
3349 3349
 
3350 3350
 			if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) {
3351 3351
 				$blocname = 'notes';
3352 3352
 				$title = $langs->trans('Notes');
3353
-				include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php';
3353
+				include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
3354 3354
 			}
3355 3355
 
3356 3356
 			/*
@@ -3365,20 +3365,20 @@  discard block
 block discarded – undo
3365 3365
 			global $inputalsopricewithtax;
3366 3366
 			$inputalsopricewithtax = 1;
3367 3367
 
3368
-			print '<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">
3369
-			<input type="hidden" name="token" value="' . newToken() . '">
3370
-			<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
3368
+			print '<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">
3369
+			<input type="hidden" name="token" value="' . newToken().'">
3370
+			<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
3371 3371
 			<input type="hidden" name="mode" value="">
3372 3372
 			<input type="hidden" name="page_y" value="">
3373
-			<input type="hidden" name="id" value="' . $object->id . '">
3374
-			<input type="hidden" name="backtopage" value="' . $backtopage . '">
3373
+			<input type="hidden" name="id" value="' . $object->id.'">
3374
+			<input type="hidden" name="backtopage" value="' . $backtopage.'">
3375 3375
 				';
3376 3376
 
3377 3377
 			if (!empty($conf->use_javascript_ajax) && $object->status == Commande::STATUS_DRAFT) {
3378 3378
 				if (isModEnabled('subtotals')) {
3379
-					include DOL_DOCUMENT_ROOT . '/core/tpl/subtotal_ajaxrow.tpl.php';
3379
+					include DOL_DOCUMENT_ROOT.'/core/tpl/subtotal_ajaxrow.tpl.php';
3380 3380
 				} else {
3381
-					include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
3381
+					include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
3382 3382
 				}
3383 3383
 			}
3384 3384
 
@@ -3433,22 +3433,22 @@  discard block
 block discarded – undo
3433 3433
 
3434 3434
 				// Reopen a closed order
3435 3435
 				if (($object->status == Commande::STATUS_CLOSED || $object->status == Commande::STATUS_CANCELED) && $usercancreate && (!$object->billed || !getDolGlobalInt('ORDER_DONT_REOPEN_BILLED'))) {
3436
-					print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"] . '?action=reopen&amp;token=' . newToken() . '&amp;id=' . $object->id, '');
3436
+					print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&amp;token='.newToken().'&amp;id='.$object->id, '');
3437 3437
 				}
3438 3438
 
3439 3439
 				// Send
3440 3440
 				if (empty($user->socid)) {
3441 3441
 					if ($object->status > Commande::STATUS_DRAFT || getDolGlobalString('COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS')) {
3442 3442
 						if ($usercansend) {
3443
-							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '');
3443
+							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
3444 3444
 						} else {
3445
-							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'] . '#', '', false);
3445
+							print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'].'#', '', false);
3446 3446
 						}
3447 3447
 					}
3448 3448
 				}
3449 3449
 
3450 3450
 				// Subtotal
3451
-				if ($object->status == Commande::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_' . strtoupper($object->element))) {
3451
+				if ($object->status == Commande::STATUS_DRAFT && isModEnabled('subtotals') && getDolGlobalString('SUBTOTAL_TITLE_'.strtoupper($object->element))) {
3452 3452
 					$langs->load('subtotals');
3453 3453
 
3454 3454
 					$url_button = array();
@@ -3458,7 +3458,7 @@  discard block
 block discarded – undo
3458 3458
 						'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT),
3459 3459
 						'perm' => (bool) $usercancreate,
3460 3460
 						'label' => $langs->trans('AddTitleLine'),
3461
-						'url' => '/commande/card.php?id=' . $object->id . '&action=add_title_line&token=' . newToken()
3461
+						'url' => '/commande/card.php?id='.$object->id.'&action=add_title_line&token='.newToken()
3462 3462
 					);
3463 3463
 
3464 3464
 					$url_button[] = array(
@@ -3466,7 +3466,7 @@  discard block
 block discarded – undo
3466 3466
 						'enabled' => (isModEnabled('order') && $object->status == Commande::STATUS_DRAFT),
3467 3467
 						'perm' => (bool) $usercancreate,
3468 3468
 						'label' => $langs->trans('AddSubtotalLine'),
3469
-						'url' => '/commande/card.php?id=' . $object->id . '&action=add_subtotal_line&token=' . newToken()
3469
+						'url' => '/commande/card.php?id='.$object->id.'&action=add_subtotal_line&token='.newToken()
3470 3470
 					);
3471 3471
 					print dolGetButtonAction('', $langs->trans('Subtotal'), 'default', $url_button, '', true);
3472 3472
 				}
@@ -3474,15 +3474,15 @@  discard block
 block discarded – undo
3474 3474
 				// Valid
3475 3475
 				if ($object->status == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || getDolGlobalString('ORDER_ENABLE_NEGATIVE')) && $usercanvalidate) {
3476 3476
 					if ($numlines > 0) {
3477
-						print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"] . '?action=validate&amp;token=' . newToken() . '&amp;id=' . $object->id, (string) $object->id, 1);
3477
+						print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&amp;token='.newToken().'&amp;id='.$object->id, (string) $object->id, 1);
3478 3478
 					} else {
3479 3479
 						$langs->load("errors");
3480
-						print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"] . '?action=validate&amp;token=' . newToken() . '&amp;id=' . $object->id, (string) $object->id, -1);
3480
+						print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&amp;token='.newToken().'&amp;id='.$object->id, (string) $object->id, -1);
3481 3481
 					}
3482 3482
 				}
3483 3483
 				// Edit
3484 3484
 				if (($object->status == Commande::STATUS_VALIDATED || ($object->status == Commande::STATUS_SHIPMENTONPROCESS && getDolGlobalString('EDIT_ORDER_SHIPMENT_ON_PROCESS'))) && $usercancreate) {
3485
-					print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"] . '?action=modif&amp;token=' . newToken() . '&amp;id=' . $object->id, '');
3485
+					print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&amp;token='.newToken().'&amp;id='.$object->id, '');
3486 3486
 				}
3487 3487
 
3488 3488
 				$arrayforbutaction = array();
@@ -3494,7 +3494,7 @@  discard block
 block discarded – undo
3494 3494
 						'enabled' => (isModEnabled("supplier_order") && $object->status > Commande::STATUS_DRAFT),
3495 3495
 						'perm' => $usercancreatepurchaseorder,
3496 3496
 						'label' => 'AddPurchaseOrder',
3497
-						'url' => '/fourn/commande/card.php?action=create&amp;origin=' . urlencode($object->element) . '&amp;originid=' . ((int) $object->id)
3497
+						'url' => '/fourn/commande/card.php?action=create&amp;origin='.urlencode($object->element).'&amp;originid='.((int) $object->id)
3498 3498
 					);
3499 3499
 				}
3500 3500
 
@@ -3511,7 +3511,7 @@  discard block
 block discarded – undo
3511 3511
 						'enabled' => (isModEnabled("intervention") && $object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0),
3512 3512
 						'perm' => ($user->hasRight('ficheinter', 'creer') == 1),
3513 3513
 						'label' => 'AddIntervention',
3514
-						'url' => '/fichinter/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid),
3514
+						'url' => '/fichinter/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid),
3515 3515
 					);
3516 3516
 				}
3517 3517
 
@@ -3521,7 +3521,7 @@  discard block
 block discarded – undo
3521 3521
 					'enabled' => (isModEnabled("contract") && ($object->status == Commande::STATUS_VALIDATED || $object->status == Commande::STATUS_SHIPMENTONPROCESS || $object->status == Commande::STATUS_CLOSED)),
3522 3522
 					'perm' => ($user->hasRight('contrat', 'creer') == 1),
3523 3523
 					'label' => 'AddContract',
3524
-					'url' => '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid,
3524
+					'url' => '/contrat/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
3525 3525
 				);
3526 3526
 				/*if (isModEnabled('contrat') && ($object->status == Commande::STATUS_VALIDATED || $object->status == Commande::STATUS_SHIPMENTONPROCESS || $object->status == Commande::STATUS_CLOSED)) {
3527 3527
 					$langs->load("contracts");
@@ -3545,7 +3545,7 @@  discard block
 block discarded – undo
3545 3545
 								'enabled' => (isModEnabled("shipping") && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))),
3546 3546
 								'perm' => $user->hasRight('expedition', 'creer'),
3547 3547
 								'label' => 'CreateShipment',
3548
-								'url' => '/expedition/shipment.php?id=' . $object->id
3548
+								'url' => '/expedition/shipment.php?id='.$object->id
3549 3549
 							);
3550 3550
 						} else {
3551 3551
 							//c$langs->load("errors");
@@ -3555,7 +3555,7 @@  discard block
 block discarded – undo
3555 3555
 								'enabled' => (isModEnabled("shipping") && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))),
3556 3556
 								'perm' => 0,
3557 3557
 								'label' => 'CreateShipment',
3558
-								'url' => '/expedition/shipment.php?id=' . $object->id
3558
+								'url' => '/expedition/shipment.php?id='.$object->id
3559 3559
 							);
3560 3560
 						}
3561 3561
 					}
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
 					'enabled' => (isModEnabled('invoice') && $object->status > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0),
3568 3568
 					'perm' => ($user->hasRight('facture', 'creer') && !getDolGlobalInt('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')),
3569 3569
 					'label' => 'CreateBill',
3570
-					'url' => '/compta/facture/card.php?action=create&amp;token=' . newToken() . '&amp;origin=' . urlencode($object->element) . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid
3570
+					'url' => '/compta/facture/card.php?action=create&amp;token='.newToken().'&amp;origin='.urlencode($object->element).'&amp;originid='.$object->id.'&amp;socid='.$object->socid
3571 3571
 				);
3572 3572
 				/*
3573 3573
 				 if (isModEnabled('facture') && $object->status > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
@@ -3588,38 +3588,38 @@  discard block
 block discarded – undo
3588 3588
 
3589 3589
 				// Set to shipped
3590 3590
 				if (($object->status == Commande::STATUS_VALIDATED || $object->status == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
3591
-					print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"] . '?action=shipped&amp;token=' . newToken() . '&amp;id=' . $object->id, '');
3591
+					print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"].'?action=shipped&amp;token='.newToken().'&amp;id='.$object->id, '');
3592 3592
 				}
3593 3593
 
3594 3594
 				// Set billed or unbilled
3595 3595
 				// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
3596 3596
 				if ($object->status > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
3597 3597
 					if ($usercancreate && $object->status >= Commande::STATUS_VALIDATED && !getDolGlobalString('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER') && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) {
3598
-						print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"] . '?action=classifybilled&amp;token=' . newToken() . '&amp;id=' . $object->id, '');
3598
+						print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&amp;token='.newToken().'&amp;id='.$object->id, '');
3599 3599
 					}
3600 3600
 				}
3601 3601
 				if ($object->status > Commande::STATUS_DRAFT && $object->billed) {
3602 3602
 					if ($usercancreate && $object->status >= Commande::STATUS_VALIDATED && !getDolGlobalString('ORDER_DISABLE_CLASSIFY_BILLED_FROM_ORDER') && !getDolGlobalString('WORKFLOW_BILL_ON_SHIPMENT')) {
3603
-						print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'delete', $_SERVER["PHP_SELF"] . '?action=classifyunbilled&amp;token=' . newToken() . '&amp;id=' . $object->id, '');
3603
+						print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'delete', $_SERVER["PHP_SELF"].'?action=classifyunbilled&amp;token='.newToken().'&amp;id='.$object->id, '');
3604 3604
 					}
3605 3605
 				}
3606 3606
 
3607 3607
 				// Clone
3608 3608
 				if ($usercancreate) {
3609
-					print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"] . '?action=clone&token=' . newToken() . '&id=' . $object->id . '&socid=' . $object->socid, '');
3609
+					print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id.'&socid='.$object->socid, '');
3610 3610
 				}
3611 3611
 
3612 3612
 				// Cancel order
3613 3613
 				if ($object->status == Commande::STATUS_VALIDATED && !empty($usercancancel)) {
3614
-					print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel&token=' . newToken() . '">' . $langs->trans("CancelOrder") . '</a>';
3614
+					print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("CancelOrder").'</a>';
3615 3615
 				}
3616 3616
 
3617 3617
 				// Delete order
3618 3618
 				if ($usercandelete) {
3619 3619
 					if ($numshipping == 0) {
3620
-						print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"] . '?action=delete&token=' . newToken() . '&id=' . $object->id, '');
3620
+						print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
3621 3621
 					} else {
3622
-						print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'] . '#', '', false);
3622
+						print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF'].'#', '', false);
3623 3623
 					}
3624 3624
 				}
3625 3625
 			}
@@ -3636,8 +3636,8 @@  discard block
 block discarded – undo
3636 3636
 			print '<a name="builddoc"></a>'; // ancre
3637 3637
 			// Documents
3638 3638
 			$objref = dol_sanitizeFileName($object->ref);
3639
-			$relativepath = $objref . '/' . $objref . '.pdf';
3640
-			$filedir = $conf->commande->multidir_output[$object->entity ?? $conf->entity] . '/' . $objref;
3639
+			$relativepath = $objref.'/'.$objref.'.pdf';
3640
+			$filedir = $conf->commande->multidir_output[$object->entity ?? $conf->entity].'/'.$objref;
3641 3641
 			$urlsource = dolBuildUrl($_SERVER["PHP_SELF"], ["id" => $object->id]);
3642 3642
 			$genallowed = $usercanread;
3643 3643
 			$delallowed = $usercancreate;
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
 
3662 3662
 			// Show online payment link
3663 3663
 			// The list can be complete by the hook 'doValidatePayment' executed inside getValidOnlinePaymentMethods()
3664
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php';
3664
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
3665 3665
 			$validpaymentmethod = getValidOnlinePaymentMethods('');
3666 3666
 			$useonlinepayment = count($validpaymentmethod);
3667 3667
 
@@ -3670,8 +3670,8 @@  discard block
 block discarded – undo
3670 3670
 			}
3671 3671
 			if ($object->status != Commande::STATUS_DRAFT && $useonlinepayment) {
3672 3672
 				print '<br><!-- Link to pay -->';
3673
-				require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php';
3674
-				print showOnlinePaymentUrl('order', $object->ref) . '<br>';
3673
+				require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
3674
+				print showOnlinePaymentUrl('order', $object->ref).'<br>';
3675 3675
 			}
3676 3676
 
3677 3677
 			print '</div><div class="fichehalfright">';
@@ -3679,11 +3679,11 @@  discard block
 block discarded – undo
3679 3679
 			$MAXEVENT = 10;
3680 3680
 
3681 3681
 			//button to go to messaging from the events box
3682
-			$morehtmlcenter = dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', dolBuildUrl(DOL_URL_ROOT . '/commande/messaging.php', ['id' => $object->id]));
3683
-			$morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dolBuildUrl(DOL_URL_ROOT . '/commande/agenda.php', ['id' => $object->id]));
3682
+			$morehtmlcenter = dolGetButtonTitle($langs->trans('FullConversation'), '', 'fa fa-comments imgforviewmode', dolBuildUrl(DOL_URL_ROOT.'/commande/messaging.php', ['id' => $object->id]));
3683
+			$morehtmlcenter .= dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dolBuildUrl(DOL_URL_ROOT.'/commande/agenda.php', ['id' => $object->id]));
3684 3684
 
3685 3685
 			// List of actions on element
3686
-			include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
3686
+			include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
3687 3687
 			$formactions = new FormActions($db);
3688 3688
 			$somethingshown = $formactions->showactions($object, 'order', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty
3689 3689
 
@@ -3694,9 +3694,9 @@  discard block
 block discarded – undo
3694 3694
 		$modelmail = 'order_send';
3695 3695
 		$defaulttopic = 'SendOrderRef';
3696 3696
 		$diroutput = getMultidirOutput($object);
3697
-		$trackid = 'ord' . $object->id;
3697
+		$trackid = 'ord'.$object->id;
3698 3698
 
3699
-		include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
3699
+		include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
3700 3700
 	}
3701 3701
 }
3702 3702
 
Please login to merge, or discard this patch.
htdocs/commande/class/commande.class.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	/**
397 397
 	 * Shipment on process
398 398
 	 */
399
-	const STATUS_SHIPMENTONPROCESS = 2;		// We set this status when a shipment is validated
399
+	const STATUS_SHIPMENTONPROCESS = 2; // We set this status when a shipment is validated
400 400
 
401 401
 	/**
402 402
 	 * For backward compatibility. Use key STATUS_SHIPMENTONPROCESS instead.
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
 	/*
413 413
 	 * No signature
414 414
 	 */
415
-	const STATUS_NO_SIGNATURE    = 0;
415
+	const STATUS_NO_SIGNATURE = 0;
416 416
 
417 417
 	/*
418 418
 	 * Signed by sender
419 419
 	 */
420
-	const STATUS_SIGNED_SENDER   = 1;
420
+	const STATUS_SIGNED_SENDER = 1;
421 421
 
422 422
 	/*
423 423
 	 * Signed by receiver
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	/*
428 428
 	 * Signed by all
429 429
 	 */
430
-	const STATUS_SIGNED_ALL      = 9; // To handle future kind of signature (ex: tripartite contract)
430
+	const STATUS_SIGNED_ALL = 9; // To handle future kind of signature (ex: tripartite contract)
431 431
 
432 432
 
433 433
 	/**
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		if (getDolGlobalString('COMMANDE_ADDON')) {
461 461
 			$mybool = false;
462 462
 
463
-			$file = getDolGlobalString('COMMANDE_ADDON') . ".php";
463
+			$file = getDolGlobalString('COMMANDE_ADDON').".php";
464 464
 			$classname = getDolGlobalString('COMMANDE_ADDON');
465 465
 
466 466
 			// Include file with class
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 		// Set new ref and current status
651 651
 		if (!$error) {
652 652
 			$this->ref = $num;
653
-			$this->statut = self::STATUS_VALIDATED;	// deprecated
653
+			$this->statut = self::STATUS_VALIDATED; // deprecated
654 654
 			$this->status = self::STATUS_VALIDATED;
655 655
 		}
656 656
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 			}
735 735
 
736 736
 			if (!$error) {
737
-				$this->statut = self::STATUS_DRAFT;	// deprecated
737
+				$this->statut = self::STATUS_DRAFT; // deprecated
738 738
 				$this->status = self::STATUS_DRAFT;
739 739
 				$this->db->commit();
740 740
 				return 1;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		}
792 792
 
793 793
 		if (!$error) {
794
-			$this->statut = self::STATUS_VALIDATED;	// deprecated
794
+			$this->statut = self::STATUS_VALIDATED; // deprecated
795 795
 			$this->status = self::STATUS_VALIDATED;
796 796
 			$this->billed = 0;
797 797
 
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 				}
848 848
 
849 849
 				if (!$error) {
850
-					$this->statut = self::STATUS_CLOSED;	// deprecated
850
+					$this->statut = self::STATUS_CLOSED; // deprecated
851 851
 					$this->status = self::STATUS_CLOSED;
852 852
 
853 853
 					$this->db->commit();
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 			}
939 939
 
940 940
 			if (!$error) {
941
-				$this->statut = self::STATUS_CANCELED;	// deprecated
941
+				$this->statut = self::STATUS_CANCELED; // deprecated
942 942
 				$this->status = self::STATUS_CANCELED;
943 943
 				$this->db->commit();
944 944
 				return 1;
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 		$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
1062 1062
 		$sql .= ", ".(int) $this->entity;
1063 1063
 		$sql .= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
1064
-		$sql .= ", ".((!is_null($this->pos_source) && $this->pos_source != '') ? "'".$this->db->escape($this->pos_source)."'" : "null");	// Can be null, '', '0', '1'
1064
+		$sql .= ", ".((!is_null($this->pos_source) && $this->pos_source != '') ? "'".$this->db->escape($this->pos_source)."'" : "null"); // Can be null, '', '0', '1'
1065 1065
 		$sql .= ", ".(int) $this->fk_multicurrency;
1066 1066
 		$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
1067 1067
 		$sql .= ", ".(float) $this->multicurrency_tx;
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
 			if ($objsoc->fetch($socid) > 0) {
1307 1307
 				$this->socid = $objsoc->id;
1308 1308
 				$this->cond_reglement_id	= (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
1309
-				$this->deposit_percent		= (!empty($objsoc->deposit_percent) ? $objsoc->deposit_percent : 0);
1309
+				$this->deposit_percent = (!empty($objsoc->deposit_percent) ? $objsoc->deposit_percent : 0);
1310 1310
 				$this->mode_reglement_id	= (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
1311 1311
 				$this->fk_project = 0;
1312 1312
 				$this->fk_delivery_address = 0;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
 
1318 1318
 		$this->id = 0;
1319 1319
 		$this->ref = '';
1320
-		$this->statut = self::STATUS_DRAFT;	// deprecated
1320
+		$this->statut = self::STATUS_DRAFT; // deprecated
1321 1321
 		$this->status = self::STATUS_DRAFT;
1322 1322
 
1323 1323
 		// Clear fields
@@ -1398,8 +1398,8 @@  discard block
 block discarded – undo
1398 1398
 	{
1399 1399
 		global $conf, $hookmanager;
1400 1400
 
1401
-		require_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php';
1402
-		require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
1401
+		require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
1402
+		require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
1403 1403
 
1404 1404
 		$error = 0;
1405 1405
 
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 			$line->fk_parent_line    = $object->lines[$i]->fk_parent_line;
1432 1432
 			$line->fk_unit = $object->lines[$i]->fk_unit;
1433 1433
 
1434
-			$line->date_start 		= $object->lines[$i]->date_start;
1434
+			$line->date_start = $object->lines[$i]->date_start;
1435 1435
 			$line->date_end    		= $object->lines[$i]->date_end;
1436 1436
 
1437 1437
 			$line->fk_fournprice	= $object->lines[$i]->fk_fournprice;
@@ -1804,7 +1804,7 @@  discard block
 block discarded – undo
1804 1804
 			$this->line->date_end = $date_end;
1805 1805
 
1806 1806
 			$this->line->fk_fournprice = $fk_fournprice;
1807
-			$this->line->pa_ht = $pa_ht;	// Can be '' when not defined or 0 if defined to 0 or a price value
1807
+			$this->line->pa_ht = $pa_ht; // Can be '' when not defined or 0 if defined to 0 or a price value
1808 1808
 
1809 1809
 			// Multicurrency
1810 1810
 			$this->line->fk_multicurrency = $this->fk_multicurrency;
@@ -2039,7 +2039,7 @@  discard block
 block discarded – undo
2039 2039
 				$this->fk_project = $obj->fk_project;
2040 2040
 				$this->project = null; // Clear if another value was already set by fetch_projet
2041 2041
 
2042
-				$this->statut = $obj->status;	// deprecated
2042
+				$this->statut = $obj->status; // deprecated
2043 2043
 				$this->status = $obj->status;
2044 2044
 
2045 2045
 				$this->user_author_id = $obj->fk_user_author;
@@ -2294,7 +2294,7 @@  discard block
 block discarded – undo
2294 2294
 				$line->weight_units     = $objp->weight_units;
2295 2295
 				$line->volume           = $objp->volume;
2296 2296
 				$line->volume_units     = $objp->volume_units;
2297
-				$line->packaging 		= $objp->packaging;
2297
+				$line->packaging = $objp->packaging;
2298 2298
 
2299 2299
 				$line->date_start       = $this->db->jdate($objp->date_start);
2300 2300
 				$line->date_end         = $this->db->jdate($objp->date_end);
@@ -3639,15 +3639,15 @@  discard block
 block discarded – undo
3639 3639
 		//$sql.= " AND c.fk_statut IN (1,2,3) AND c.facture = 0";
3640 3640
 		if ($mode == 'toship') {
3641 3641
 			// An order to ship is an open order (validated or in progress)
3642
-			$sql .= " AND c.fk_statut IN (" . self::STATUS_VALIDATED . "," . self::STATUS_SHIPMENTONPROCESS . ")";
3642
+			$sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.")";
3643 3643
 		}
3644 3644
 		if ($mode == 'tobill') {
3645 3645
 			// An order to bill is an order not already billed
3646
-			$sql .= " AND c.fk_statut IN (" . self::STATUS_VALIDATED . "," . self::STATUS_SHIPMENTONPROCESS . ", " . self::STATUS_CLOSED . ") AND c.facture = 0";
3646
+			$sql .= " AND c.fk_statut IN (".self::STATUS_VALIDATED.",".self::STATUS_SHIPMENTONPROCESS.", ".self::STATUS_CLOSED.") AND c.facture = 0";
3647 3647
 		}
3648 3648
 		if ($mode == 'shippedtobill') {
3649 3649
 			// An order shipped and to bill is a delivered order not already billed
3650
-			$sql .= " AND c.fk_statut IN (" . self::STATUS_CLOSED . ") AND c.facture = 0";
3650
+			$sql .= " AND c.fk_statut IN (".self::STATUS_CLOSED.") AND c.facture = 0";
3651 3651
 		}
3652 3652
 		if ($user->socid) {
3653 3653
 			$sql .= " AND c.fk_soc = ".((int) $user->socid);
@@ -3890,9 +3890,9 @@  discard block
 block discarded – undo
3890 3890
 		$result = '';
3891 3891
 
3892 3892
 		if (isModEnabled("shipping") && ($option == '1' || $option == '2')) {
3893
-			$baseurl = DOL_URL_ROOT . '/expedition/shipment.php';
3893
+			$baseurl = DOL_URL_ROOT.'/expedition/shipment.php';
3894 3894
 		} else {
3895
-			$baseurl = DOL_URL_ROOT . '/commande/card.php';
3895
+			$baseurl = DOL_URL_ROOT.'/commande/card.php';
3896 3896
 		}
3897 3897
 		$query = ['id' => $this->id];
3898 3898
 		if (!$user->hasRight('commande', 'lire')) {
@@ -3978,7 +3978,7 @@  discard block
 block discarded – undo
3978 3978
 		}
3979 3979
 
3980 3980
 		global $action;
3981
-		$hookmanager->initHooks(array($this->element . 'dao'));
3981
+		$hookmanager->initHooks(array($this->element.'dao'));
3982 3982
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
3983 3983
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
3984 3984
 		if ($reshook > 0) {
@@ -4086,7 +4086,7 @@  discard block
 block discarded – undo
4086 4086
 		$this->status = $this::STATUS_DRAFT;
4087 4087
 
4088 4088
 		// Lines
4089
-		$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
4089
+		$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
4090 4090
 		$xnbp = 0;
4091 4091
 
4092 4092
 		while ($xnbp < $nbp) {
Please login to merge, or discard this patch.
htdocs/admin/mails_templates.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 				print '<tr class="oddeven nohover" id="tr-aaa-'.$rowid.'">';
1161 1161
 				print '<td colspan="'.$colspan.'" class="" style="padding-left: 20px; padding-right: 20px;">';
1162 1162
 
1163
-				$fieldsforcontent = array('topic', 'email_from','joinfiles', 'content');
1163
+				$fieldsforcontent = array('topic', 'email_from', 'joinfiles', 'content');
1164 1164
 				if (getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
1165 1165
 					$fieldsforcontent[] = 'content_lines';
1166 1166
 				}
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 					continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
1240 1240
 				}
1241 1241
 				// Test on 'enabled'
1242
-				if (! (int) dol_eval($obj->enabled, 1, 1, '1')) {
1242
+				if (!(int) dol_eval($obj->enabled, 1, 1, '1')) {
1243 1243
 					$i++;
1244 1244
 					continue; // Email template not qualified
1245 1245
 				}
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 					print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1, false, 0, 1);
1538 1538
 				}
1539 1539
 			} else {
1540
-				print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'"'.($context == 'preview' ? ' disabled' : '').' spellcheck="false">';
1540
+				print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'.$value.'"'.($context == 'preview' ? ' disabled' : '').' spellcheck="false">';
1541 1541
 			}
1542 1542
 			print '</td>';
1543 1543
 			$nboffieldsprinted++;
Please login to merge, or discard this patch.
htdocs/user/class/user.class.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -586,8 +586,8 @@  discard block
 block discarded – undo
586 586
 			$sql .= " WHERE u.rowid = ".((int) $id);
587 587
 		} else {
588 588
 			if ($entity < 0) {
589
-				if ((! isModEnabled('multicompany') || ! getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (! empty($user->entity))) {
590
-					$sql .= " WHERE u.entity IN (0, " . ((int) $conf->entity) . ")";
589
+				if ((!isModEnabled('multicompany') || !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (!empty($user->entity))) {
590
+					$sql .= " WHERE u.entity IN (0, ".((int) $conf->entity).")";
591 591
 				} else {
592 592
 					$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
593 593
 				}
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 					if ($entity != '' && $entity == 0) {    // If $entity = 0
600 600
 						$sql .= " WHERE u.entity = 0";
601 601
 					} else {                                // if $entity is -1 or > 0
602
-						$sql .= " WHERE u.entity IN (0, " . ((int) ($entity > 0 ? $entity : $conf->entity)) . ")";
602
+						$sql .= " WHERE u.entity IN (0, ".((int) ($entity > 0 ? $entity : $conf->entity)).")";
603 603
 					}
604 604
 				}
605 605
 			}
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 				$this->note_public = $obj->note_public;
694 694
 				$this->note_private = $obj->note_private;
695 695
 
696
-				$this->statut = $obj->status;			// deprecated
696
+				$this->statut = $obj->status; // deprecated
697 697
 				$this->status = $obj->status;
698 698
 
699 699
 				$this->photo = $obj->photo;
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 			require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php';
832 832
 
833 833
 			$defaultValues = new DefaultValues($this->db);
834
-			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,'.$this->id.') AND (entity:in:'.(isset($this->entity) ? $this->entity : $conf->entity).','.$conf->entity.')');	// User 0 (all) + me (if defined)
834
+			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,'.$this->id.') AND (entity:in:'.(isset($this->entity) ? $this->entity : $conf->entity).','.$conf->entity.')'); // User 0 (all) + me (if defined)
835 835
 			//$result = $defaultValues->fetchAll('', '', 0, 0, array('t.user_id'=>array(0, $this->id), 'entity'=>array((isset($this->entity) ? $this->entity : $conf->entity), $conf->entity)));	// User 0 (all) + me (if defined)
836 836
 
837 837
 			if (!is_array($result) && $result < 0) {
@@ -948,16 +948,16 @@  discard block
 block discarded – undo
948 948
 		// Special case for external user
949 949
 		if (!empty($this->socid)) {
950 950
 			if ($module == 'societe' && ($permlevel1 == 'creer' || $permlevel1 == 'write')) {
951
-				return 0;	// An external user never has the permission ->societe->write to see all thirdparties (always restricted to himself)
951
+				return 0; // An external user never has the permission ->societe->write to see all thirdparties (always restricted to himself)
952 952
 			}
953 953
 			if ($module == 'societe' && $permlevel1 == 'client' && $permlevel2 == 'voir') {
954
-				return 0;	// An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)
954
+				return 0; // An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)
955 955
 			}
956 956
 			if ($module == 'societe' && $permlevel1 == 'export') {
957
-				return 0;	// An external user never has the permission ->societe->export to see all thirdparties (always restricted to himself)
957
+				return 0; // An external user never has the permission ->societe->export to see all thirdparties (always restricted to himself)
958 958
 			}
959 959
 			if ($module == 'societe' && ($permlevel1 == 'supprimer' || $permlevel1 == 'delete')) {
960
-				return 0;	// An external user never has the permission ->societe->delete to see all thirdparties (always restricted to himself)
960
+				return 0; // An external user never has the permission ->societe->delete to see all thirdparties (always restricted to himself)
961 961
 			}
962 962
 		}
963 963
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			$sql .= " FROM ".$this->db->prefix()."rights_def";
1106 1106
 			$sql .= " WHERE entity = ".((int) $entity);
1107 1107
 			if (!empty($whereforadd) && $whereforadd != 'allmodules') {
1108
-				$sql .= " AND (".$whereforadd.")";	// Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized
1108
+				$sql .= " AND (".$whereforadd.")"; // Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized
1109 1109
 			}
1110 1110
 
1111 1111
 			$sqldelete = "DELETE FROM ".$this->db->prefix()."user_rights";
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 			$sql .= " FROM ".$this->db->prefix()."rights_def";
1242 1242
 			$sql .= " WHERE entity IN (".$this->db->sanitize($entity, 0, 0, 0, 0).")";
1243 1243
 			if (!empty($wherefordel) && $wherefordel != 'allmodules') {
1244
-				$sql .= " AND (".$wherefordel.")";	// Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized
1244
+				$sql .= " AND (".$wherefordel.")"; // Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized
1245 1245
 			}
1246 1246
 
1247 1247
 			// avoid admin to remove his own important rights
@@ -1420,12 +1420,12 @@  discard block
 block discarded – undo
1420 1420
 					$sql .= " AND r.entity = ".((int) $conf->entity);
1421 1421
 				}
1422 1422
 			} else {
1423
-				$sql .= " AND gr.entity = ".((int) $conf->entity);	// Only groups created in current entity
1423
+				$sql .= " AND gr.entity = ".((int) $conf->entity); // Only groups created in current entity
1424 1424
 				// The entity on the table gu=usergroup_user should be useless and should never be used because it is already into gr and r.
1425 1425
 				// but when using MULTICOMPANY_TRANSVERSE_MODE, we may have inserted record that make rubbish result here due to the duplicate record of
1426 1426
 				// other entities, so we are forced to add a filter on gu here
1427 1427
 				$sql .= " AND gu.entity IN (0,".$conf->entity.")";
1428
-				$sql .= " AND r.entity = ".((int) $conf->entity);	// Only permission of modules enabled in current entity
1428
+				$sql .= " AND r.entity = ".((int) $conf->entity); // Only permission of modules enabled in current entity
1429 1429
 			}
1430 1430
 			// End of strange business rule
1431 1431
 			$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 		$this->civility_code = $member->civility_code;
1978 1978
 		$this->lastname     = $member->lastname;
1979 1979
 		$this->firstname    = $member->firstname;
1980
-		$this->gender		= $member->gender;
1980
+		$this->gender = $member->gender;
1981 1981
 		$this->email        = $member->email;
1982 1982
 		$this->fk_member    = $member->id;
1983 1983
 		$this->address      = $member->address;
@@ -2123,43 +2123,43 @@  discard block
 block discarded – undo
2123 2123
 		$this->national_registration_number = trim((string) $this->national_registration_number);
2124 2124
 		$this->employee						= ($this->employee > 0 ? $this->employee : 0);
2125 2125
 		$this->login						= trim((string) $this->login);
2126
-		$this->gender						= trim((string) $this->gender);
2126
+		$this->gender = trim((string) $this->gender);
2127 2127
 
2128 2128
 		$this->pass							= trim((string) $this->pass);
2129
-		$this->api_key						= trim((string) $this->api_key);
2130
-		$this->datestartvalidity			= empty($this->datestartvalidity) ? '' : $this->datestartvalidity;
2131
-		$this->dateendvalidity				= empty($this->dateendvalidity) ? '' : $this->dateendvalidity;
2129
+		$this->api_key = trim((string) $this->api_key);
2130
+		$this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity;
2131
+		$this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity;
2132 2132
 
2133
-		$this->address						= trim((string) $this->address);
2134
-		$this->zip							= trim((string) $this->zip);
2135
-		$this->town							= trim((string) $this->town);
2133
+		$this->address = trim((string) $this->address);
2134
+		$this->zip = trim((string) $this->zip);
2135
+		$this->town = trim((string) $this->town);
2136 2136
 
2137
-		$this->state_id						= ($this->state_id > 0 ? $this->state_id : 0);
2137
+		$this->state_id = ($this->state_id > 0 ? $this->state_id : 0);
2138 2138
 		$this->country_id					= ($this->country_id > 0 ? $this->country_id : 0);
2139
-		$this->office_phone					= trim((string) $this->office_phone);
2139
+		$this->office_phone = trim((string) $this->office_phone);
2140 2140
 		$this->office_fax					= trim((string) $this->office_fax);
2141
-		$this->user_mobile					= trim((string) $this->user_mobile);
2142
-		$this->personal_mobile				= trim((string) $this->personal_mobile);
2143
-		$this->email						= trim((string) $this->email);
2144
-		$this->personal_email				= trim((string) $this->personal_email);
2145
-
2146
-		$this->job							= trim((string) $this->job);
2147
-		$this->signature					= trim((string) $this->signature);
2148
-		$this->note_public					= trim((string) $this->note_public);
2149
-		$this->note_private					= trim((string) $this->note_private);
2150
-		$this->openid						= trim((string) $this->openid);
2151
-		$this->admin						= ($this->admin > 0 ? $this->admin : 0);
2141
+		$this->user_mobile = trim((string) $this->user_mobile);
2142
+		$this->personal_mobile = trim((string) $this->personal_mobile);
2143
+		$this->email = trim((string) $this->email);
2144
+		$this->personal_email = trim((string) $this->personal_email);
2145
+
2146
+		$this->job = trim((string) $this->job);
2147
+		$this->signature = trim((string) $this->signature);
2148
+		$this->note_public = trim((string) $this->note_public);
2149
+		$this->note_private = trim((string) $this->note_private);
2150
+		$this->openid = trim((string) $this->openid);
2151
+		$this->admin = ($this->admin > 0 ? $this->admin : 0);
2152 2152
 		$this->user_modification_id = $user->id;
2153 2153
 
2154 2154
 		$this->accountancy_code_user_general = trim((string) $this->accountancy_code_user_general);
2155 2155
 		$this->accountancy_code				= trim((string) $this->accountancy_code);
2156
-		$this->color						= trim((string) $this->color);
2157
-		$this->dateemployment				= empty($this->dateemployment) ? '' : $this->dateemployment;
2156
+		$this->color = trim((string) $this->color);
2157
+		$this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;
2158 2158
 		$this->dateemploymentend			= empty($this->dateemploymentend) ? '' : $this->dateemploymentend;
2159 2159
 
2160
-		$this->birth						= empty($this->birth) ? '' : $this->birth;
2161
-		$this->fk_warehouse					= (int) $this->fk_warehouse;
2162
-		$this->fk_establishment				= (int) $this->fk_establishment;
2160
+		$this->birth = empty($this->birth) ? '' : $this->birth;
2161
+		$this->fk_warehouse = (int) $this->fk_warehouse;
2162
+		$this->fk_establishment = (int) $this->fk_establishment;
2163 2163
 
2164 2164
 		$this->setUpperOrLowerCase();
2165 2165
 
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
 		$sql .= " WHERE fk_user  = ".((int) $this->id);
2926 2926
 		$sql .= " AND fk_usergroup = ".((int) $group);
2927 2927
 		if (empty($entity)) {
2928
-			$sql .= " AND entity IN (0, 1)";	// group may be in entity 0 (so $entity=0) and link with user into entity 1.
2928
+			$sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1.
2929 2929
 		} else {
2930 2930
 			$sql .= " AND entity = ".((int) $entity);
2931 2931
 		}
@@ -3161,9 +3161,9 @@  discard block
 block discarded – undo
3161 3161
 			$label = '';
3162 3162
 		}
3163 3163
 
3164
-		$baseurl = DOL_URL_ROOT . '/user/card.php';
3164
+		$baseurl = DOL_URL_ROOT.'/user/card.php';
3165 3165
 		if ($option == 'leave') {
3166
-			$baseurl = DOL_URL_ROOT . '/holiday/list.php';
3166
+			$baseurl = DOL_URL_ROOT.'/holiday/list.php';
3167 3167
 		}
3168 3168
 		$query = ['id' => $this->id];
3169 3169
 		if ($option != 'nolink') {
@@ -3187,7 +3187,7 @@  discard block
 block discarded – undo
3187 3187
 				$linkclose .= ' alt="'.dolPrintHTMLForAttribute($label).'"';
3188 3188
 			}
3189 3189
 			$linkclose .= ($label ? ' title="'.dolPrintHTMLForAttribute($label).'"' : ' title="tocomplete"');
3190
-			$linkclose .= $dataparams . ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
3190
+			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
3191 3191
 		} else {
3192 3192
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
3193 3193
 		}
@@ -3426,11 +3426,11 @@  discard block
 block discarded – undo
3426 3426
 		global $conf;
3427 3427
 		$dn = '';
3428 3428
 		if ($mode == 0) {
3429
-			$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')]."," . getDolGlobalString('LDAP_USER_DN');
3429
+			$dn = getDolGlobalString('LDAP_KEY_USERS')."=".$info[getDolGlobalString('LDAP_KEY_USERS')].",".getDolGlobalString('LDAP_USER_DN');
3430 3430
 		} elseif ($mode == 1) {
3431 3431
 			$dn = getDolGlobalString('LDAP_USER_DN');
3432 3432
 		} elseif ($mode == 2) {
3433
-			$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')];
3433
+			$dn = getDolGlobalString('LDAP_KEY_USERS')."=".$info[getDolGlobalString('LDAP_KEY_USERS')];
3434 3434
 		}
3435 3435
 		return $dn;
3436 3436
 	}
@@ -3897,7 +3897,7 @@  discard block
 block discarded – undo
3897 3897
 			$sql .= " WHERE u.entity IN (".getEntity('user').")";
3898 3898
 		}
3899 3899
 		if ($filter) {
3900
-			$sql .= " AND ".$filter;	// already sanitized
3900
+			$sql .= " AND ".$filter; // already sanitized
3901 3901
 		}
3902 3902
 
3903 3903
 		dol_syslog(get_class($this)."::get_full_tree get user list", LOG_DEBUG);
@@ -4229,8 +4229,8 @@  discard block
 block discarded – undo
4229 4229
 					$sql .= " WHERE t.entity IS NOT NULL"; // Show all users
4230 4230
 				} else {
4231 4231
 					$sql .= " WHERE t.entity = 0 OR EXISTS (";
4232
-					$sql .= " SELECT ug.rowid FROM " . $this->db->prefix() . "usergroup_user as ug";
4233
-					$sql .= " WHERE ug.fk_user = t.rowid AND ug.entity IN (" . getEntity('usergroup') . "))";
4232
+					$sql .= " SELECT ug.rowid FROM ".$this->db->prefix()."usergroup_user as ug";
4233
+					$sql .= " WHERE ug.fk_user = t.rowid AND ug.entity IN (".getEntity('usergroup')."))";
4234 4234
 				}
4235 4235
 			} else {
4236 4236
 				$sql .= " WHERE t.entity IN (".getEntity('user').")";
Please login to merge, or discard this patch.
htdocs/contrat/card.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 $object = new Contrat($db);
105 105
 $extrafields = new ExtraFields($db);
106 106
 $ret = 0;
107
-$pu_ht = null;  // Init for static analysis
108
-$pu_ttc = null;  // Init for static analysis
107
+$pu_ht = null; // Init for static analysis
108
+$pu_ttc = null; // Init for static analysis
109 109
 
110 110
 // Load object
111 111
 if ($id > 0 || !empty($ref) && $action != 'add') {
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 $permissionnote = $user->hasRight('contrat', 'creer'); // Used by the include of actions_setnotes.inc.php
128 128
 $permissiondellink = $user->hasRight('contrat', 'creer'); // Used by the include of actions_dellink.inc.php
129 129
 $permissiontodelete = ($user->hasRight('contrat', 'creer') && $object->status == $object::STATUS_DRAFT) || $user->hasRight('contrat', 'supprimer');
130
-$permissiontoadd   = $user->hasRight('contrat', 'creer');     //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
130
+$permissiontoadd   = $user->hasRight('contrat', 'creer'); //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
131 131
 $permissiontoedit = $permissiontoadd;
132 132
 $permissiontoactivate = $user->hasRight('contrat', 'activer');
133
-$permissiontodisable = $user->hasRight('contrat', 'desactiver');	// TODO use same than $permissiontoactivate
133
+$permissiontodisable = $user->hasRight('contrat', 'desactiver'); // TODO use same than $permissiontoactivate
134 134
 $permissiontoeditextra = $permissiontoadd;
135 135
 if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
136 136
 	// For action 'update_extras', is there a specific permission set for the attribute to update
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
158 158
 }
159 159
 if (empty($reshook)) {
160
-	$backurlforlist = dolBuildUrl(DOL_URL_ROOT . '/contrat/list.php');
160
+	$backurlforlist = dolBuildUrl(DOL_URL_ROOT.'/contrat/list.php');
161 161
 
162 162
 	if (empty($backtopage) || ($cancel && empty($id))) {
163 163
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
164 164
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
165 165
 				$backtopage = $backurlforlist;
166 166
 			} else {
167
-				$backtopage = dolBuildUrl(DOL_URL_ROOT . '/contrat/card.php', ['id'=> ((!empty($id) && $id > 0) ? $id : '__ID__')]);
167
+				$backtopage = dolBuildUrl(DOL_URL_ROOT.'/contrat/card.php', ['id'=> ((!empty($id) && $id > 0) ? $id : '__ID__')]);
168 168
 			}
169 169
 		}
170 170
 	}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
 	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
186 186
 
187
-	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';  // Must be 'include', not 'include_once'
187
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once'
188 188
 
189 189
 	if ($action == 'confirm_active' && $confirm == 'yes' && $permissiontoactivate) {
190 190
 		$date_start = '';
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	} elseif ($action == 'confirm_sign' && $confirm == 'yes' && $user->hasRight('contract', 'creer')) {
208 208
 		$result = $object->setSignedStatus($user, GETPOSTINT('signed_status'), 0, 'CONTRACT_MODIFY');
209 209
 		if ($result >= 0) {
210
-			header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
210
+			header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
211 211
 			exit;
212 212
 		} else {
213 213
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	} elseif ($action == 'confirm_unsign' && $confirm == 'yes' && $user->hasRight('contract', 'creer')) {
216 216
 		$result = $object->setSignedStatus($user, Contrat::$SIGNED_STATUSES['STATUS_NO_SIGNATURE'], 0, 'CONTRACT_MODIFY');
217 217
 		if ($result >= 0) {
218
-			header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
218
+			header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
219 219
 			exit;
220 220
 		} else {
221 221
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 					$classname = ucfirst($subelement);
348 348
 					$srcobject = new $classname($db);
349
-					'@phan-var-force Commande|Propal|Facture $srcobject';  // Can be other class, but CommonObject is too Generic
349
+					'@phan-var-force Commande|Propal|Facture $srcobject'; // Can be other class, but CommonObject is too Generic
350 350
 
351 351
 					dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
352 352
 					$result = $srcobject->fetch($object->origin_id);
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 			}
772 772
 			$objectline->fetch_optionals();
773 773
 
774
-			$objectline->oldcopy = dol_clone($objectline, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
774
+			$objectline->oldcopy = dol_clone($objectline, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
775 775
 		} else {
776 776
 			$objectline = null;
777 777
 		}
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $permissiontoactivate) {
922 922
 		$date_start = dol_mktime(12, 0, 0, GETPOSTINT('d_startmonth'), GETPOSTINT('d_startday'), GETPOSTINT('d_startyear'));
923 923
 		$date_end   = dol_mktime(12, 0, 0, GETPOSTINT('d_endmonth'), GETPOSTINT('d_endday'), GETPOSTINT('d_endyear'));
924
-		$comment      = GETPOST('comment', 'alpha');
924
+		$comment = GETPOST('comment', 'alpha');
925 925
 		$result = $object->activateAll($user, $date_start, 0, $comment, $date_end);
926 926
 		if ($result < 0) {
927 927
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 		print '<td>';
1263 1263
 		print img_picto('', 'company', 'class="pictofixedwidth"');
1264 1264
 		print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
1265
-		print ' <a href="'.dolBuildUrl(DOL_URL_ROOT . '/societe/card.php', ['action' => 'create', 'customer' => 3, 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'create'])]).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
1265
+		print ' <a href="'.dolBuildUrl(DOL_URL_ROOT.'/societe/card.php', ['action' => 'create', 'customer' => 3, 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'create'])]).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
1266 1266
 		print '</td>';
1267 1267
 	}
1268 1268
 	print '</tr>'."\n";
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
 		print '<tr><td>'.$langs->trans("Project").'</td><td>';
1311 1311
 		print img_picto('', 'project', 'class="pictofixedwidth"');
1312 1312
 		$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, "projectid", 0, 0, 1, 1);
1313
-		print ' &nbsp; <a href="' . dolBuildUrl(DOL_URL_ROOT . '/projet/card.php', ['socid' => $soc->id, 'action' => 'create', 'status' => 1, 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'create', 'socid' => $soc->id])]) . '"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
1313
+		print ' &nbsp; <a href="'.dolBuildUrl(DOL_URL_ROOT.'/projet/card.php', ['socid' => $soc->id, 'action' => 'create', 'status' => 1, 'backtopage' => dolBuildUrl($_SERVER["PHP_SELF"], ['action' => 'create', 'socid' => $soc->id])]).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
1314 1314
 		print "</td></tr>";
1315 1315
 	}
1316 1316
 
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 		$morehtmlref .= '<div class="refidno">';
1484 1484
 		// Ref customer
1485 1485
 		$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
1486
-		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
1486
+		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
1487 1487
 		// Ref supplier
1488 1488
 		$morehtmlref .= '<br>';
1489 1489
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
 		}
1577 1577
 
1578 1578
 
1579
-		$arrayothercontracts = $object->getListOfContracts('others');	// array or -1 if technical error
1579
+		$arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error
1580 1580
 
1581 1581
 		/*
1582 1582
 		 * Lines of contracts
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 							$description = $objp->description;
1709 1709
 
1710 1710
 							if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
1711
-								print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '') . $text;
1711
+								print (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : '').$text;
1712 1712
 								if (!getDolGlobalInt('PRODUIT_DESC_IN_FORM')) {
1713 1713
 									print $form->textwithpicto('', $description);
1714 1714
 								}
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
 								print $objp->label ? ' - '.dol_trunc($objp->label, 32) : '';
1845 1845
 								print '<input type="hidden" name="idprod" value="'.$currentLineProductId.'">';
1846 1846
 							} else {
1847
-								$senderissupplier = 0;	// @TODO Option to allow purchased products ?
1847
+								$senderissupplier = 0; // @TODO Option to allow purchased products ?
1848 1848
 								if (empty($senderissupplier)) {
1849 1849
 									if (getDolGlobalString('CONTRACT_SUPPORT_PRODUCTS')) {
1850 1850
 										$filtertype = '';
@@ -2354,9 +2354,9 @@  discard block
 block discarded – undo
2354 2354
 				// Sign
2355 2355
 				if (getDolGlobalString('CONTRACT_SHOW_SIGNATURE_STATUS_WITH_SERVICE_STATUS') && $object->status > Contrat::STATUS_DRAFT) {
2356 2356
 					if ($object->signed_status != Contrat::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) {
2357
-						print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=sign&token=' . newToken() . '">' . $langs->trans("ContractSign") . '</a></div>';
2357
+						print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=sign&token='.newToken().'">'.$langs->trans("ContractSign").'</a></div>';
2358 2358
 					} else {
2359
-						print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=unsign&token=' . newToken() . '">' . $langs->trans("ContractUnsign") . '</a></div>';
2359
+						print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=unsign&token='.newToken().'">'.$langs->trans("ContractUnsign").'</a></div>';
2360 2360
 					}
2361 2361
 				}
2362 2362
 
Please login to merge, or discard this patch.
htdocs/contrat/class/contrat.class.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		if (getDolGlobalString('CONTRACT_ADDON')) {
318 318
 			$mybool = false;
319 319
 
320
-			$file = getDolGlobalString('CONTRACT_ADDON') . ".php";
320
+			$file = getDolGlobalString('CONTRACT_ADDON').".php";
321 321
 			$classname = getDolGlobalString('CONTRACT_ADDON');
322 322
 
323 323
 			// Include file with class
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 			if ($contratline->statut != ContratLigne::STATUS_OPEN) {
429 429
 				$contratline->context = $this->context;
430 430
 
431
-				$result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment);	// This call trigger LINECONTRACT_ACTIVATE
431
+				$result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
432 432
 				if ($result < 0) {
433 433
 					$error++;
434 434
 					$this->error = $contratline->error;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			// Close lines not already closed
482 482
 			if ($contratline->statut != ContratLigne::STATUS_CLOSED) {
483 483
 				$contratline->date_end_real = $now;
484
-				$contratline->date_cloture = $now;	// For backward compatibility
484
+				$contratline->date_cloture = $now; // For backward compatibility
485 485
 				$contratline->user_closing_id = $user->id;
486 486
 				$contratline->statut = ContratLigne::STATUS_CLOSED;
487 487
 
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 			if (!$error) {
628 628
 				$this->ref = $num;
629 629
 				$this->status = self::STATUS_VALIDATED;
630
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
630
+				$this->statut = self::STATUS_VALIDATED; // deprecated
631 631
 				$this->date_validation = $now;
632 632
 			}
633 633
 		} else {
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
 				$line->localtax2_tx		= $objp->localtax2_tx;
904 904
 				$line->localtax1_type	= $objp->localtax1_type;
905 905
 				$line->localtax2_type	= $objp->localtax2_type;
906
-				$line->subprice			= $objp->subprice;
906
+				$line->subprice = $objp->subprice;
907 907
 				$line->statut           = $objp->status; // For backward compatibility
908 908
 				$line->status           = $objp->status;
909
-				$line->remise_percent	= $objp->remise_percent;
909
+				$line->remise_percent = $objp->remise_percent;
910 910
 				$line->total_ht			= $objp->total_ht;
911 911
 				$line->total_tva		= $objp->total_tva;
912 912
 				$line->total_localtax1	= $objp->total_localtax1;
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 		}
1419 1419
 
1420 1420
 		if (!$error) {
1421
-			$result = $this->insertExtraFields();	// This delete and reinsert extrafields
1421
+			$result = $this->insertExtraFields(); // This delete and reinsert extrafields
1422 1422
 			if ($result < 0) {
1423 1423
 				$error++;
1424 1424
 			}
@@ -2034,7 +2034,7 @@  discard block
 block discarded – undo
2034 2034
 				}
2035 2035
 				$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1);
2036 2036
 			}
2037
-			$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer;
2037
+			$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_customer;
2038 2038
 			if (!$nofetch) {
2039 2039
 				$langs->load('project');
2040 2040
 				if (is_null($this->project) || (is_object($this->project) && $this->project->isEmpty())) {
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
 
2074 2074
 		$result = '';
2075 2075
 
2076
-		$baseurl = DOL_URL_ROOT . '/contrat/card.php';
2076
+		$baseurl = DOL_URL_ROOT.'/contrat/card.php';
2077 2077
 		$query = ['id' => $this->id];
2078 2078
 
2079 2079
 		//if ($option !== 'nolink')
@@ -2464,7 +2464,7 @@  discard block
 block discarded – undo
2464 2464
 		$this->note_public = 'This is a comment (public)';
2465 2465
 		$this->fk_project = 0;
2466 2466
 		// Lines
2467
-		$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
2467
+		$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
2468 2468
 		$xnbp = 0;
2469 2469
 		while ($xnbp < $nbp) {
2470 2470
 			$line = new ContratLigne($this->db);
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
 		global $user;
2511 2511
 
2512 2512
 		$ticket = new Ticket($this->db);
2513
-		$nbTicket =  $ticket->fetchAll($user, 'ASC', 't.datec', 0, 0, 0, array('t.fk_contract' => $this->id));
2513
+		$nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', 0, 0, 0, array('t.fk_contract' => $this->id));
2514 2514
 
2515 2515
 		return ($nbTicket < 0 ? $nbTicket : $ticket->lines);
2516 2516
 	}
@@ -2532,7 +2532,7 @@  discard block
 block discarded – undo
2532 2532
 		global $conf, $langs;
2533 2533
 
2534 2534
 		if (!dol_strlen($modele)) {
2535
-			$modele = '';	// No doc template/generation by default
2535
+			$modele = ''; // No doc template/generation by default
2536 2536
 
2537 2537
 			if (!empty($this->model_pdf)) {
2538 2538
 				$modele = $this->model_pdf;
@@ -2630,14 +2630,14 @@  discard block
 block discarded – undo
2630 2630
 			}
2631 2631
 		}
2632 2632
 
2633
-		if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').".php")) {
2633
+		if (!getDolGlobalString('CONTRACT_ADDON') || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').".php")) {
2634 2634
 			$this->error = 'ErrorSetupNotComplete';
2635 2635
 			dol_syslog($this->error);
2636 2636
 			return -1;
2637 2637
 		}
2638 2638
 
2639 2639
 		// Set ref
2640
-		require_once DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').'.php';
2640
+		require_once DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').'.php';
2641 2641
 		$obj = getDolGlobalString('CONTRACT_ADDON');
2642 2642
 		$modContract = new $obj();
2643 2643
 		'@phan-var-force ModelNumRefContracts $modContract';
@@ -2760,7 +2760,7 @@  discard block
 block discarded – undo
2760 2760
 
2761 2761
 					// Load contract
2762 2762
 					$object = new Contrat($this->db);
2763
-					$object->fetch($obj->rowid);		// fetch also lines
2763
+					$object->fetch($obj->rowid); // fetch also lines
2764 2764
 					//$object->fetch_thirdparty();
2765 2765
 
2766 2766
 					if ($object->id <= 0) {
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
 					if ($expirationdate && $expirationdate < $enddatetoscan) {
2808 2808
 						dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate);
2809 2809
 						$newdate = $expirationdate;
2810
-						$protecti = 0;	// $protecti is to avoid infinite loop
2810
+						$protecti = 0; // $protecti is to avoid infinite loop
2811 2811
 						while ($newdate < $enddatetoscan && $protecti < 1000) {
2812 2812
 							$newdate = dol_time_plus_duree($newdate, (int) $duration_value, $duration_unit);
2813 2813
 							$protecti++;
@@ -2835,21 +2835,21 @@  discard block
 block discarded – undo
2835 2835
 
2836 2836
 								// Create an event
2837 2837
 								$actioncomm = new ActionComm($this->db);
2838
-								$actioncomm->type_code    = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
2838
+								$actioncomm->type_code    = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
2839 2839
 								$actioncomm->code         = 'AC_'.$actioncode;
2840 2840
 								$actioncomm->label        = $label;
2841 2841
 								$actioncomm->datep        = $now;
2842 2842
 								$actioncomm->datef        = $now;
2843
-								$actioncomm->percentage   = -1;   // Not applicable
2843
+								$actioncomm->percentage   = -1; // Not applicable
2844 2844
 								$actioncomm->socid        = $object->socid;
2845
-								$actioncomm->authorid     = $user->id;   // User saving action
2846
-								$actioncomm->userownerid  = $user->id;	// Owner of action
2845
+								$actioncomm->authorid     = $user->id; // User saving action
2846
+								$actioncomm->userownerid  = $user->id; // Owner of action
2847 2847
 								$actioncomm->fk_element   = $object->id;
2848 2848
 								$actioncomm->elementid    = $object->id;
2849 2849
 								$actioncomm->elementtype  = 'contract';
2850 2850
 								$actioncomm->note_private = $comment;
2851 2851
 
2852
-								$ret = $actioncomm->create($user);       // User creating action
2852
+								$ret = $actioncomm->create($user); // User creating action
2853 2853
 							} else {
2854 2854
 								$contracterror[$object->id] = $object->ref;
2855 2855
 
@@ -2858,7 +2858,7 @@  discard block
 block discarded – undo
2858 2858
 								$this->error = $this->db->lasterror();
2859 2859
 							}
2860 2860
 
2861
-							if (! $errorforlocaltransaction) {
2861
+							if (!$errorforlocaltransaction) {
2862 2862
 								$this->db->commit();
2863 2863
 							} else {
2864 2864
 								$this->db->rollback();
@@ -2916,7 +2916,7 @@  discard block
 block discarded – undo
2916 2916
 		$return .= img_picto('', $this->picto);
2917 2917
 		$return .= '</span>';
2918 2918
 		$return .= '<div class="info-box-content">';
2919
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . $this->getNomUrl() . '</span>';
2919
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.$this->getNomUrl().'</span>';
2920 2920
 		if ($selected >= 0) {
2921 2921
 			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2922 2922
 		}
Please login to merge, or discard this patch.