Completed
Branch develop (fc0392)
by
unknown
19:06
created
htdocs/imports/import.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 $endatlinenb		= (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
144 144
 $updatekeys			= (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
145 145
 $separator			= (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml', 3) : '');
146
-$enclosure			= (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');	// We must use 'nohtml' and not 'alphanohtml' because we must accept "
146
+$enclosure			= (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); // We must use 'nohtml' and not 'alphanohtml' because we must accept "
147 147
 $charset            = GETPOST('charset', 'aZ09');
148 148
 $separator_used     = str_replace('\t', "\t", $separator);
149 149
 
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	$maxfilesizearray = getMaxFileSizeArray();
614 614
 	$maxmin = $maxfilesizearray['maxmin'];
615 615
 	if ($maxmin > 0) {
616
-		print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';	// MAX_FILE_SIZE must precede the field type=file
616
+		print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
617 617
 	}
618 618
 	print '<input type="file" name="userfile" size="20" maxlength="80"> &nbsp; &nbsp; ';
619 619
 	$out = (!getDolGlobalString('MAIN_UPLOAD_DOC') ? ' disabled' : '');
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	//var_dump($_SESSION["dol_array_match_file_to_database_select"]);
733 733
 	$serialized_array_match_file_to_database = isset($_SESSION["dol_array_match_file_to_database_select"]) ? $_SESSION["dol_array_match_file_to_database_select"] : '';
734 734
 	$fieldsarray = explode(',', $serialized_array_match_file_to_database);
735
-	$array_match_file_to_database = array();		// Same than $fieldsarray but with mapped value only  (col1 => 's.fielda', col2 => 's.fieldb'...)
735
+	$array_match_file_to_database = array(); // Same than $fieldsarray but with mapped value only  (col1 => 's.fielda', col2 => 's.fieldb'...)
736 736
 	foreach ($fieldsarray as $elem) {
737 737
 		$tabelem = explode('=', $elem, 2);
738 738
 		$key = $tabelem[0];
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 	$optionsall = array();
1088 1088
 	foreach ($fieldstarget as $code => $line) {
1089
-		$tmparray = explode('|', $line["label"]);	// If label of field is several translation keys separated with |
1089
+		$tmparray = explode('|', $line["label"]); // If label of field is several translation keys separated with |
1090 1090
 		$labeltoshow = '';
1091 1091
 		foreach ($tmparray as $tmpkey => $tmpval) {
1092 1092
 			$labeltoshow .= ($labeltoshow ? ' '.$langs->trans('or').' ' : '').$langs->transnoentities($tmpval);
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 	//var_dump($fieldssource);
1121 1121
 	//var_dump($fieldstarget);
1122 1122
 
1123
-	$modetoautofillmapping = 'session';		// Use setup in session
1123
+	$modetoautofillmapping = 'session'; // Use setup in session
1124 1124
 	if ($initialloadofstep4) {
1125 1125
 		$modetoautofillmapping = 'guess';
1126 1126
 	}
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 		// - Then we set to disabled all fields that are selected
1327 1327
 		print 'function setOptionsToDisabled() {'."\n";
1328 1328
 		print '		console.log("Remove the disabled flag everywhere");'."\n";
1329
-		print '		$("select.targetselectchange").not($( this )).find(\'option\').prop("disabled", false);'."\n";	// Enable all options
1329
+		print '		$("select.targetselectchange").not($( this )).find(\'option\').prop("disabled", false);'."\n"; // Enable all options
1330 1330
 		print '		arrayofselectedvalues = [];'."\n";
1331 1331
 
1332 1332
 		print '		$("select.targetselectchange").each(function(){'."\n";
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 		print '		console.log(arrayofselectedvalues);'."\n";
1341 1341
 		print '     console.log("Set the option to disabled for every entry that is currently selected somewhere else (so into arrayofselectedvalues)");'."\n";
1342 1342
 
1343
-		print '     $.each(arrayofselectedvalues, function(key, value) {'."\n";	// Loop on each selected value
1343
+		print '     $.each(arrayofselectedvalues, function(key, value) {'."\n"; // Loop on each selected value
1344 1344
 		print '         if (value != -1) {'."\n";
1345 1345
 		print '     		console.log("Process key="+key+" value="+value+" to disable.");'."\n";
1346
-		print '				$("select.targetselectchange").find(\'option[value="\'+value+\'"]:not(:selected)\').prop("disabled", true);'."\n";	// Set to disabled except if currently selected
1346
+		print '				$("select.targetselectchange").find(\'option[value="\'+value+\'"]:not(:selected)\').prop("disabled", true);'."\n"; // Set to disabled except if currently selected
1347 1347
 		print '         }'."\n";
1348 1348
 		print '     });'."\n";
1349 1349
 		print '}'."\n";
Please login to merge, or discard this patch.
htdocs/includes/OAuth/OAuth2/Service/Generic.php 2 patches
Indentation   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -24,159 +24,159 @@
 block discarded – undo
24 24
 	const SCOPE_ADMIN_WRITE = 'admin:write';
25 25
 
26 26
 
27
-    public function __construct(
28
-        CredentialsInterface $credentials,
29
-        ClientInterface $httpClient,
30
-        TokenStorageInterface $storage,
31
-        $scopes = array(),
32
-        UriInterface $baseApiUri = null
33
-    ) {
34
-        parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
35
-        if ($baseApiUri === null) {
36
-        	$url = getDolGlobalString('OAUTH_GENERIC-'.$storage->getKeyForProvider().'_URL');
37
-        	//$url = 'https://aaaaa.com';
38
-        	if (!empty($url)) {
27
+	public function __construct(
28
+		CredentialsInterface $credentials,
29
+		ClientInterface $httpClient,
30
+		TokenStorageInterface $storage,
31
+		$scopes = array(),
32
+		UriInterface $baseApiUri = null
33
+	) {
34
+		parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
35
+		if ($baseApiUri === null) {
36
+			$url = getDolGlobalString('OAUTH_GENERIC-'.$storage->getKeyForProvider().'_URL');
37
+			//$url = 'https://aaaaa.com';
38
+			if (!empty($url)) {
39 39
 				$this->baseApiUri = new Uri($url);
40
-        	}
41
-        }
42
-    }
43
-
44
-    /**
45
-     * Return the private property $this->baseApiUri
46
-     */
47
-    public function getBaseApiUri()
48
-    {
49
-    	return $this->baseApiUri;
50
-    }
51
-
52
-    /**
53
-     * {@inheritdoc}
54
-     */
55
-    public function getRequestTokenEndpoint()
56
-    {
57
-    	return new Uri($this->baseApiUri.'/oauth/request');
58
-    }
59
-
60
-    /**
61
-     * {@inheritdoc}
62
-     */
63
-    public function getAuthorizationEndpoint()
64
-    {
65
-    	return new Uri($this->baseApiUri.'/oauth/authorize');
66
-    }
67
-
68
-    /**
69
-     * {@inheritdoc}
70
-     */
71
-    public function getAccessTokenEndpoint()
72
-    {
73
-    	return new Uri($this->baseApiUri.'/oauth/token');
74
-    }
75
-
76
-    /**
77
-     * {@inheritdoc}
78
-     */
79
-    public function getAuthorizationUri(array $additionalParameters = array())
80
-    {
81
-        $parameters = array_merge(
82
-            $additionalParameters,
83
-            array(
84
-                'redirect_uri' => $this->credentials->getCallbackUrl(),
85
-            )
86
-        );
87
-
88
-        // Build the url
89
-        $url = clone $this->getAuthorizationEndpoint();
90
-        foreach ($parameters as $key => $val) {
91
-            $url->addToQuery($key, $val);
92
-        }
93
-
94
-        return $url;
95
-    }
96
-
97
-    /**
98
-     * {@inheritdoc}
99
-     */
100
-    public function requestRequestToken()
101
-    {
102
-        $responseBody = $this->httpClient->retrieveResponse(
103
-            $this->getRequestTokenEndpoint(),
104
-            array(
105
-                'consumer_key' => $this->credentials->getConsumerId(),
106
-                'redirect_uri' => $this->credentials->getCallbackUrl(),
107
-            )
108
-        );
109
-
110
-        $code = $this->parseRequestTokenResponse($responseBody);
111
-
112
-        return $code;
113
-    }
114
-
115
-    /**
116
-     * {@inheritdoc}
117
-     */
118
-    protected function parseRequestTokenResponse($responseBody)
119
-    {
120
-    	$data = array();
121
-
122
-        parse_str($responseBody, $data);
123
-
124
-        if (null === $data || !is_array($data)) {
125
-            throw new TokenResponseException('Unable to parse response.');
126
-        } elseif (!isset($data['code'])) {
127
-            throw new TokenResponseException('Error in retrieving code.');
128
-        }
129
-        return $data['code'];
130
-    }
131
-
132
-    /**
133
-     * {@inheritdoc}
134
-     */
135
-    public function requestAccessToken($code, $state = null)
136
-    {
137
-        $bodyParams = array(
138
-        	'client_id'     => $this->credentials->getConsumerId(),
139
-        	'client_secret' => $this->credentials->getConsumerSecret(),
140
-        	'redirect_uri'  => $this->credentials->getCallbackUrl(),
141
-        	'grant_type'    => 'authorization_code',
142
-            'code'             => $code,
143
-        	'consumer_key'     => $this->credentials->getConsumerId(),
144
-        );
145
-
146
-        $responseBody = $this->httpClient->retrieveResponse(
147
-            $this->getAccessTokenEndpoint(),
148
-            $bodyParams,
149
-            $this->getExtraOAuthHeaders()
150
-        );
151
-        $token = $this->parseAccessTokenResponse($responseBody);
152
-        $this->storage->storeAccessToken($this->service(), $token);
153
-
154
-        return $token;
155
-    }
156
-
157
-    /**
158
-     * {@inheritdoc}
159
-     */
160
-    protected function parseAccessTokenResponse($responseBody)
161
-    {
162
-    	$data = json_decode($responseBody, true);
163
-
164
-        if ($data === null || !is_array($data)) {
165
-            throw new TokenResponseException('Unable to parse response.');
166
-        } elseif (isset($data['error'])) {
167
-        	throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . (isset($data['error_description']) ? ' - '.$data['error_description'] : '').'"');
168
-        }
169
-
170
-        $token = new StdOAuth2Token();
171
-        #$token->setRequestToken($data['access_token']);
172
-        $token->setAccessToken($data['access_token']);
173
-
174
-        $token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES);
175
-
176
-        unset($data['access_token']);
177
-
178
-        $token->setExtraParams($data);
179
-
180
-        return $token;
181
-    }
40
+			}
41
+		}
42
+	}
43
+
44
+	/**
45
+	 * Return the private property $this->baseApiUri
46
+	 */
47
+	public function getBaseApiUri()
48
+	{
49
+		return $this->baseApiUri;
50
+	}
51
+
52
+	/**
53
+	 * {@inheritdoc}
54
+	 */
55
+	public function getRequestTokenEndpoint()
56
+	{
57
+		return new Uri($this->baseApiUri.'/oauth/request');
58
+	}
59
+
60
+	/**
61
+	 * {@inheritdoc}
62
+	 */
63
+	public function getAuthorizationEndpoint()
64
+	{
65
+		return new Uri($this->baseApiUri.'/oauth/authorize');
66
+	}
67
+
68
+	/**
69
+	 * {@inheritdoc}
70
+	 */
71
+	public function getAccessTokenEndpoint()
72
+	{
73
+		return new Uri($this->baseApiUri.'/oauth/token');
74
+	}
75
+
76
+	/**
77
+	 * {@inheritdoc}
78
+	 */
79
+	public function getAuthorizationUri(array $additionalParameters = array())
80
+	{
81
+		$parameters = array_merge(
82
+			$additionalParameters,
83
+			array(
84
+				'redirect_uri' => $this->credentials->getCallbackUrl(),
85
+			)
86
+		);
87
+
88
+		// Build the url
89
+		$url = clone $this->getAuthorizationEndpoint();
90
+		foreach ($parameters as $key => $val) {
91
+			$url->addToQuery($key, $val);
92
+		}
93
+
94
+		return $url;
95
+	}
96
+
97
+	/**
98
+	 * {@inheritdoc}
99
+	 */
100
+	public function requestRequestToken()
101
+	{
102
+		$responseBody = $this->httpClient->retrieveResponse(
103
+			$this->getRequestTokenEndpoint(),
104
+			array(
105
+				'consumer_key' => $this->credentials->getConsumerId(),
106
+				'redirect_uri' => $this->credentials->getCallbackUrl(),
107
+			)
108
+		);
109
+
110
+		$code = $this->parseRequestTokenResponse($responseBody);
111
+
112
+		return $code;
113
+	}
114
+
115
+	/**
116
+	 * {@inheritdoc}
117
+	 */
118
+	protected function parseRequestTokenResponse($responseBody)
119
+	{
120
+		$data = array();
121
+
122
+		parse_str($responseBody, $data);
123
+
124
+		if (null === $data || !is_array($data)) {
125
+			throw new TokenResponseException('Unable to parse response.');
126
+		} elseif (!isset($data['code'])) {
127
+			throw new TokenResponseException('Error in retrieving code.');
128
+		}
129
+		return $data['code'];
130
+	}
131
+
132
+	/**
133
+	 * {@inheritdoc}
134
+	 */
135
+	public function requestAccessToken($code, $state = null)
136
+	{
137
+		$bodyParams = array(
138
+			'client_id'     => $this->credentials->getConsumerId(),
139
+			'client_secret' => $this->credentials->getConsumerSecret(),
140
+			'redirect_uri'  => $this->credentials->getCallbackUrl(),
141
+			'grant_type'    => 'authorization_code',
142
+			'code'             => $code,
143
+			'consumer_key'     => $this->credentials->getConsumerId(),
144
+		);
145
+
146
+		$responseBody = $this->httpClient->retrieveResponse(
147
+			$this->getAccessTokenEndpoint(),
148
+			$bodyParams,
149
+			$this->getExtraOAuthHeaders()
150
+		);
151
+		$token = $this->parseAccessTokenResponse($responseBody);
152
+		$this->storage->storeAccessToken($this->service(), $token);
153
+
154
+		return $token;
155
+	}
156
+
157
+	/**
158
+	 * {@inheritdoc}
159
+	 */
160
+	protected function parseAccessTokenResponse($responseBody)
161
+	{
162
+		$data = json_decode($responseBody, true);
163
+
164
+		if ($data === null || !is_array($data)) {
165
+			throw new TokenResponseException('Unable to parse response.');
166
+		} elseif (isset($data['error'])) {
167
+			throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . (isset($data['error_description']) ? ' - '.$data['error_description'] : '').'"');
168
+		}
169
+
170
+		$token = new StdOAuth2Token();
171
+		#$token->setRequestToken($data['access_token']);
172
+		$token->setAccessToken($data['access_token']);
173
+
174
+		$token->setEndOfLife(StdOAuth2Token::EOL_NEVER_EXPIRES);
175
+
176
+		unset($data['access_token']);
177
+
178
+		$token->setExtraParams($data);
179
+
180
+		return $token;
181
+	}
182 182
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@
 block discarded – undo
164 164
         if ($data === null || !is_array($data)) {
165 165
             throw new TokenResponseException('Unable to parse response.');
166 166
         } elseif (isset($data['error'])) {
167
-        	throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . (isset($data['error_description']) ? ' - '.$data['error_description'] : '').'"');
167
+        	throw new TokenResponseException('Error in retrieving token: "'.$data['error'].(isset($data['error_description']) ? ' - '.$data['error_description'] : '').'"');
168 168
         }
169 169
 
170 170
         $token = new StdOAuth2Token();
Please login to merge, or discard this patch.
htdocs/product/class/product.class.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -6268,7 +6268,6 @@
 block discarded – undo
6268 6268
 	 *  Move an uploaded file described into $file array into target directory $sdir.
6269 6269
 	 *
6270 6270
 	 * @param	string $sdir Target directory
6271
-
6272 6271
 	 * @param	array{name:string,tmp_name:string}	$file	Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...)
6273 6272
 	 * @return	int											Return integer <0 if KO, >0 if OK
6274 6273
 	 */
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		'contratdet' => array('name' => 'Contract', 'parent' => 'contrat', 'parentkey' => 'fk_contrat'),
88 88
 		'facture_fourn_det' => array('name' => 'SupplierInvoice', 'parent' => 'facture_fourn', 'parentkey' => 'fk_facture_fourn'),
89 89
 		'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande'),
90
-		'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo' ),
90
+		'mrp_production' => array('name' => 'Mo', 'parent' => 'mrp_mo', 'parentkey' => 'fk_mo'),
91 91
 		'bom_bom' => array('name' => 'BOM'),
92 92
 		'bom_bomline' => array('name' => 'BOMLine', 'parent' => 'bom_bom', 'parentkey' => 'fk_bom'),
93 93
 	);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	/**
156 156
 	 * @var string
157 157
 	 */
158
-	public $price_formated;			// used by takepos/ajax/ajax.php
158
+	public $price_formated; // used by takepos/ajax/ajax.php
159 159
 
160 160
 	/**
161 161
 	 * Selling price with tax
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	/**
168 168
 	 * @var string
169 169
 	 */
170
-	public $price_ttc_formated;		// used by takepos/ajax/ajax.php
170
+	public $price_ttc_formated; // used by takepos/ajax/ajax.php
171 171
 
172 172
 	/**
173 173
 	 * Minimum price net
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	/**
517 517
 	 * @var int|string
518 518
 	 */
519
-	public $weight_units;	// scale -3, 0, 3, 6
519
+	public $weight_units; // scale -3, 0, 3, 6
520 520
 	/**
521 521
 	 * @var float|string
522 522
 	 */
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	/**
525 525
 	 * @var int|string
526 526
 	 */
527
-	public $length_units;	// scale -3, 0, 3, 6
527
+	public $length_units; // scale -3, 0, 3, 6
528 528
 	/**
529 529
 	 * @var float|string
530 530
 	 */
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	/**
533 533
 	 * @var int|string
534 534
 	 */
535
-	public $width_units;	// scale -3, 0, 3, 6
535
+	public $width_units; // scale -3, 0, 3, 6
536 536
 	/**
537 537
 	 * @var float|string|null
538 538
 	 */
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	/**
541 541
 	 * @var int|string|null
542 542
 	 */
543
-	public $height_units;	// scale -3, 0, 3, 6
543
+	public $height_units; // scale -3, 0, 3, 6
544 544
 	/**
545 545
 	 * @var float|string|null
546 546
 	 */
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	/**
549 549
 	 * @var int|string|null
550 550
 	 */
551
-	public $surface_units;	// scale -3, 0, 3, 6
551
+	public $surface_units; // scale -3, 0, 3, 6
552 552
 	/**
553 553
 	 * @var float|string|null
554 554
 	 */
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	/**
557 557
 	 * @var int|string|null
558 558
 	 */
559
-	public $volume_units;	// scale -3, 0, 3, 6
559
+	public $volume_units; // scale -3, 0, 3, 6
560 560
 
561 561
 	/**
562 562
 	 * @var float|string|null
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	/**
566 566
 	 * @var ?string
567 567
 	 */
568
-	public $net_measure_units;	// scale -3, 0, 3, 6
568
+	public $net_measure_units; // scale -3, 0, 3, 6
569 569
 
570 570
 	/**
571 571
 	 * @var string
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
 		'import_key'    => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'index' => 0, 'position' => 1000),
819 819
 		//'tosell'       =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
820 820
 		//'tobuy'        =>array('type'=>'integer',      'label'=>'Status',           'enabled'=>1, 'visible'=>1,  'notnull'=>1, 'default'=>'0', 'index'=>1,  'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
821
-		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1,  'notnull' => 1, 'default' => '0', 'index' => 1,  'position' => 1000),
821
+		'mandatory_period' => array('type' => 'integer', 'label' => 'mandatoryperiod', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => '0', 'index' => 1, 'position' => 1000),
822 822
 	);
823 823
 
824 824
 	/**
@@ -1122,9 +1122,9 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
 							// update accountancy for this entity
1124 1124
 							if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1125
-								$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1125
+								$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1126 1126
 
1127
-								$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1127
+								$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1128 1128
 								$sql .= " fk_product";
1129 1129
 								$sql .= ", entity";
1130 1130
 								$sql .= ", accountancy_code_buy";
@@ -1135,13 +1135,13 @@  discard block
 block discarded – undo
1135 1135
 								$sql .= ", accountancy_code_sell_export";
1136 1136
 								$sql .= ") VALUES (";
1137 1137
 								$sql .= $this->id;
1138
-								$sql .= ", " . ((int) $conf->entity);
1139
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1140
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1141
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1142
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1143
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1144
-								$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1138
+								$sql .= ", ".((int) $conf->entity);
1139
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1140
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1141
+								$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1142
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1143
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1144
+								$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1145 1145
 								$sql .= ")";
1146 1146
 								$result = $this->db->query($sql);
1147 1147
 								if (!$result) {
@@ -1522,12 +1522,12 @@  discard block
 block discarded – undo
1522 1522
 			$sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null');
1523 1523
 			$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
1524 1524
 			if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1525
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1526
-				$sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1527
-				$sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1528
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1529
-				$sql .= ", accountancy_code_sell_intra= '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1530
-				$sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1525
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1526
+				$sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1527
+				$sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
1528
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1529
+				$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1530
+				$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
1531 1531
 			}
1532 1532
 			$sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null");
1533 1533
 			$sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null');
@@ -1558,9 +1558,9 @@  discard block
 block discarded – undo
1558 1558
 
1559 1559
 				// update accountancy for this entity
1560 1560
 				if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
1561
-					$this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity));
1561
+					$this->db->query("DELETE FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $this->id)." AND entity = ".((int) $conf->entity));
1562 1562
 
1563
-					$sql = "INSERT INTO " . $this->db->prefix() . "product_perentity (";
1563
+					$sql = "INSERT INTO ".$this->db->prefix()."product_perentity (";
1564 1564
 					$sql .= " fk_product";
1565 1565
 					$sql .= ", entity";
1566 1566
 					$sql .= ", accountancy_code_buy";
@@ -1571,13 +1571,13 @@  discard block
 block discarded – undo
1571 1571
 					$sql .= ", accountancy_code_sell_export";
1572 1572
 					$sql .= ") VALUES (";
1573 1573
 					$sql .= ((int) $this->id);
1574
-					$sql .= ", " . ((int) $conf->entity);
1575
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1576
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_intra) . "'";
1577
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_buy_export) . "'";
1578
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1579
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_intra) . "'";
1580
-					$sql .= ", '" . $this->db->escape($this->accountancy_code_sell_export) . "'";
1574
+					$sql .= ", ".((int) $conf->entity);
1575
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1576
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
1577
+					$sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
1578
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1579
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
1580
+					$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
1581 1581
 					$sql .= ")";
1582 1582
 					$result = $this->db->query($sql);
1583 1583
 					if (!$result) {
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 								$error++;
1656 1656
 							} else {
1657 1657
 								// to keep old entries with the new dir
1658
-								require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
1658
+								require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
1659 1659
 								$ecmfiles = new EcmFiles($this->db);
1660 1660
 								$ecmfiles->updateAfterRename("produit/".dol_sanitizeFileName($this->oldcopy->ref), "produit/".dol_sanitizeFileName($this->ref));
1661 1661
 							}
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 				}
1954 1954
 			} elseif (isset($this->multilangs[$key])) {
1955 1955
 				if (empty($this->multilangs[$key]["label"])) {
1956
-					$this->errors[] = $key . ' : ' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
1956
+					$this->errors[] = $key.' : '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"));
1957 1957
 					return -1;
1958 1958
 				}
1959 1959
 
@@ -2148,7 +2148,7 @@  discard block
 block discarded – undo
2148 2148
 	 */
2149 2149
 	private function getArrayForPriceCompare($level = 0)
2150 2150
 	{
2151
-		$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
2151
+		$testExit = array('multiprices', 'multiprices_ttc', 'multiprices_base_type', 'multiprices_min', 'multiprices_min_ttc', 'multiprices_tva_tx', 'multiprices_recuperableonly');
2152 2152
 
2153 2153
 		foreach ($testExit as $field) {
2154 2154
 			if (!isset($this->$field)) {
@@ -2792,12 +2792,12 @@  discard block
 block discarded – undo
2792 2792
 
2793 2793
 		//For MultiCompany
2794 2794
 		//PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
2795
-		$separatedEntityPMP = false;	// Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2796
-		$separatedStock = false;		// Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2795
+		$separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product.
2796
+		$separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses.
2797 2797
 		$visibleWarehousesEntities = $conf->entity;
2798 2798
 		if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) {
2799 2799
 			if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) {
2800
-				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2800
+				$checkPMPPerEntity = $this->db->query("SELECT pmp FROM ".$this->db->prefix()."product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity);
2801 2801
 				if ($this->db->num_rows($checkPMPPerEntity) > 0) {
2802 2802
 					$separatedEntityPMP = true;
2803 2803
 				}
@@ -2805,7 +2805,7 @@  discard block
 block discarded – undo
2805 2805
 			global $mc;
2806 2806
 			$separatedStock = true;
2807 2807
 			if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) {
2808
-				$visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']);
2808
+				$visibleWarehousesEntities .= ",".implode(",", $mc->sharings['stock']);
2809 2809
 			}
2810 2810
 		}
2811 2811
 		if ($separatedEntityPMP) {
@@ -2823,10 +2823,10 @@  discard block
 block discarded – undo
2823 2823
 		}
2824 2824
 		$sql .= " FROM ".$this->db->prefix()."product as p";
2825 2825
 		if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) {
2826
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
2826
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity);
2827 2827
 		}
2828 2828
 		if ($separatedStock) {
2829
-			$sql .= " LEFT JOIN " . $this->db->prefix() . "product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
2829
+			$sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as sp ON sp.fk_product = p.rowid AND sp.fk_entrepot IN (SELECT rowid FROM ".$this->db->prefix()."entrepot WHERE entity IN (".$this->db->sanitize($visibleWarehousesEntities)."))";
2830 2830
 		}
2831 2831
 
2832 2832
 		if ($id) {
@@ -2986,15 +2986,15 @@  discard block
 block discarded – undo
2986 2986
 						$sql .= " WHERE entity IN (".getEntity('productprice').")";
2987 2987
 						$sql .= " AND price_level=".((int) $i);
2988 2988
 						$sql .= " AND fk_product = ".((int) $this->id);
2989
-						$sql .= " ORDER BY date_price DESC, rowid DESC";	// Get the most recent line
2990
-						$sql .= " LIMIT 1";									// Only the first one
2989
+						$sql .= " ORDER BY date_price DESC, rowid DESC"; // Get the most recent line
2990
+						$sql .= " LIMIT 1"; // Only the first one
2991 2991
 						$resql = $this->db->query($sql);
2992 2992
 						if ($resql) {
2993 2993
 							$result = $this->db->fetch_array($resql);
2994 2994
 
2995 2995
 							$this->multiprices[$i] = $result ? $result["price"] : null;
2996 2996
 							$this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null;
2997
-							$this->multiprices_min[$i] =  $result ? $result["price_min"] : null;
2997
+							$this->multiprices_min[$i] = $result ? $result["price_min"] : null;
2998 2998
 							$this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null;
2999 2999
 							$this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null;
3000 3000
 							// Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on
@@ -3219,7 +3219,7 @@  discard block
 block discarded – undo
3219 3219
 				$obj = $this->db->fetch_object($result);
3220 3220
 				$this->stats_mo['customers_'.$role] = $obj->nb_customers ? $obj->nb_customers : 0;
3221 3221
 				$this->stats_mo['nb_'.$role] = $obj->nb ? $obj->nb : 0;
3222
-				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0;		// qty may be a float due to the SUM()
3222
+				$this->stats_mo['qty_'.$role] = $obj->qty ? price2num($obj->qty, 'MS') : 0; // qty may be a float due to the SUM()
3223 3223
 			} else {
3224 3224
 				$this->error = $this->db->error();
3225 3225
 				$error++;
@@ -4722,7 +4722,7 @@  discard block
 block discarded – undo
4722 4722
 				//Addition of a product with the highest rank +1
4723 4723
 				$sql = "INSERT INTO ".$this->db->prefix()."product_association(fk_product_pere,fk_product_fils,qty,incdec,rang)";
4724 4724
 				$sql .= " VALUES (".((int) $id_pere).", ".((int) $id_fils).", ".price2num($qty, 'MS').", ".((int) $incdec).", ".((int) $rank).")";
4725
-				if (! $this->db->query($sql)) {
4725
+				if (!$this->db->query($sql)) {
4726 4726
 					dol_print_error($this->db);
4727 4727
 					return -1;
4728 4728
 				} else {
@@ -4843,7 +4843,7 @@  discard block
 block discarded – undo
4843 4843
 				$sql = "UPDATE ".$this->db->prefix()."product_association";
4844 4844
 				$sql .= " SET rang = ".((int) $cpt);
4845 4845
 				$sql .= " WHERE rowid = ".((int) $objrank->rowid);
4846
-				if (! $this->db->query($sql)) {
4846
+				if (!$this->db->query($sql)) {
4847 4847
 					dol_print_error($this->db);
4848 4848
 					return -1;
4849 4849
 				}
@@ -5278,7 +5278,7 @@  discard block
 block discarded – undo
5278 5278
 		if (isset($this->sousprods) && is_array($this->sousprods)) {
5279 5279
 			foreach ($this->sousprods as $prod_name => $desc_product) {
5280 5280
 				if (is_array($desc_product)) {
5281
-					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load);	// This set $this->res
5281
+					$this->fetch_prod_arbo($desc_product, "", $multiply, 1, $this->id, $ignore_stock_load); // This set $this->res
5282 5282
 				}
5283 5283
 			}
5284 5284
 		}
@@ -5434,7 +5434,7 @@  discard block
 block discarded – undo
5434 5434
 		$sql .= " AND pa.fk_product_fils <> ".((int) $id); // This should not happens, it is to avoid infinite loop if it happens
5435 5435
 		$sql .= " ORDER BY pa.rang";
5436 5436
 
5437
-		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5437
+		dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level.' parents='.(is_array($parents) ? implode(',', $parents) : $parents), LOG_DEBUG);
5438 5438
 
5439 5439
 		if ($level == 1) {
5440 5440
 			$alreadyfound = array($id => 1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediately
@@ -5499,7 +5499,7 @@  discard block
 block discarded – undo
5499 5499
 			$parent[$this->label][$keyChild] = $valueChild;
5500 5500
 		}
5501 5501
 		foreach ($parent as $key => $value) {        // key=label, value is array of children
5502
-			$this->sousprods[$key] = $value;  // @phan-suppress-current-line PhanTypeMismatchProperty
5502
+			$this->sousprods[$key] = $value; // @phan-suppress-current-line PhanTypeMismatchProperty
5503 5503
 		}
5504 5504
 	}
5505 5505
 
@@ -5526,7 +5526,7 @@  discard block
 block discarded – undo
5526 5526
 		if (!empty($this->entity)) {
5527 5527
 			$tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1);
5528 5528
 			if ($this->nbphoto > 0) {
5529
-				$datas['photo'] = '<div class="photointooltip floatright">'."\n" . $tmpphoto . '</div>';
5529
+				$datas['photo'] = '<div class="photointooltip floatright">'."\n".$tmpphoto.'</div>';
5530 5530
 			}
5531 5531
 		}
5532 5532
 
@@ -5536,7 +5536,7 @@  discard block
 block discarded – undo
5536 5536
 			$datas['picto'] = img_picto('', 'service').' <u class="paddingrightonly">'.$langs->trans("Service").'</u>';
5537 5537
 		}
5538 5538
 		if (isset($this->status) && isset($this->status_buy)) {
5539
-			$datas['status'] = ' '.$this->getLibStatut(5, 0) . ' '.$this->getLibStatut(5, 1);
5539
+			$datas['status'] = ' '.$this->getLibStatut(5, 0).' '.$this->getLibStatut(5, 1);
5540 5540
 		}
5541 5541
 
5542 5542
 		if (!empty($this->ref)) {
@@ -5584,7 +5584,7 @@  discard block
 block discarded – undo
5584 5584
 				$labelsurfacevolume .= ($labelsurfacevolume ? " - " : "")."<b>".$langs->trans("Volume").'</b>: '.$this->volume.' '.measuringUnitString(0, 'volume', $this->volume_units);
5585 5585
 			}
5586 5586
 			if ($labelsurfacevolume) {
5587
-				$datas['surface'] = "<br>" . $labelsurfacevolume;
5587
+				$datas['surface'] = "<br>".$labelsurfacevolume;
5588 5588
 			}
5589 5589
 		}
5590 5590
 		if ($this->isService() && !empty($this->duration_value)) {
@@ -5626,9 +5626,9 @@  discard block
 block discarded – undo
5626 5626
 		}
5627 5627
 		// show categories for this record only in ajax to not overload lists
5628 5628
 		if (isModEnabled('category') && !$nofetch) {
5629
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
5629
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
5630 5630
 			$form = new Form($this->db);
5631
-			$datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5631
+			$datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1);
5632 5632
 		}
5633 5633
 
5634 5634
 		return $datas;
@@ -6150,7 +6150,7 @@  discard block
 block discarded – undo
6150 6150
 		if (isModEnabled("supplier_order")) {
6151 6151
 			$filterStatus = getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK', '3,4');
6152 6152
 			if (isset($includedraftpoforvirtual)) {
6153
-				$filterStatus = '0,1,2,'.$filterStatus;	// 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
6153
+				$filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
6154 6154
 			}
6155 6155
 			$result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1, $dateofvirtualstock);
6156 6156
 			if ($result < 0) {
@@ -6567,7 +6567,7 @@  discard block
 block discarded – undo
6567 6567
 		if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) {
6568 6568
 			$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
6569 6569
 			foreach ($dirsociete as $dirroot) {
6570
-				$res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6570
+				$res = dol_include_once($dirroot.getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
6571 6571
 				if ($res) {
6572 6572
 					break;
6573 6573
 				}
Please login to merge, or discard this patch.
htdocs/product/class/api_products.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 		$sql = "SELECT t.rowid, t.ref, t.ref_ext";
192 192
 		$sql .= " FROM ".$this->db->prefix()."product as t";
193
-		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON ef.fk_object = t.rowid";	// So we will be able to filter on extrafields
193
+		$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields
194 194
 		if ($category > 0) {
195 195
 			$sql .= ", ".$this->db->prefix()."categorie_product as c";
196 196
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		}
231 231
 
232 232
 		//this query will return total products with the filters given
233
-		$sqlTotals =  str_replace('SELECT t.rowid, t.ref, t.ref_ext', 'SELECT count(t.rowid) as total', $sql);
233
+		$sqlTotals = str_replace('SELECT t.rowid, t.ref, t.ref_ext', 'SELECT count(t.rowid) as total', $sql);
234 234
 
235 235
 		$sql .= $this->db->order($sortfield, $sortorder);
236 236
 		if ($limit) {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			$obj_ret['pagination'] = array(
291 291
 				'total' => (int) $total,
292 292
 				'page' => $page, //count starts from 0
293
-				'page_count' => ceil((int) $total/$limit),
293
+				'page_count' => ceil((int) $total / $limit),
294 294
 				'limit' => $limit
295 295
 			);
296 296
 		}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 		if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
329 329
 			$key_max = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT');
330
-			for ($key = 1; $key <= $key_max ; $key++) {
330
+			for ($key = 1; $key <= $key_max; $key++) {
331 331
 				$newvat = $this->product->multiprices_tva_tx[$key];
332 332
 				$newnpr = 0;
333 333
 				$newvatsrccode = $this->product->default_vat_code;
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
 		if ($result > 0 && getDolGlobalString('PRODUIT_MULTIPRICES')) {
462 462
 			$key_max = getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT');
463
-			for ($key = 1; $key <= $key_max ; $key++) {
463
+			for ($key = 1; $key <= $key_max; $key++) {
464 464
 				$pricemodified = false;
465 465
 				if ($this->product->multiprices_base_type[$key] != $oldproduct->multiprices_base_type[$key]) {
466 466
 					$pricemodified = true;
@@ -2065,7 +2065,7 @@  discard block
 block discarded – undo
2065 2065
 		unset($object->fk_bank);
2066 2066
 		unset($object->fk_account);
2067 2067
 
2068
-		unset($object->supplierprices);	// Must use another API to get them
2068
+		unset($object->supplierprices); // Must use another API to get them
2069 2069
 
2070 2070
 		if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) {
2071 2071
 			unset($object->stock_reel);
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
 				$children[] = array_combine($keys, $values);
2159 2159
 			}
2160 2160
 
2161
-			$this->product->sousprods = $children;  // @phpstan-ignore-line
2161
+			$this->product->sousprods = $children; // @phpstan-ignore-line
2162 2162
 		}
2163 2163
 
2164 2164
 		if ($includeparentid) {
Please login to merge, or discard this patch.
htdocs/core/class/html.formcompany.class.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  *	Only common components are here.
34 34
  */
35 35
 
36
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
37 37
 
38 38
 
39 39
 /**
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 		$effs = array();
58 58
 
59 59
 		$sql = "SELECT id, code, libelle as label";
60
-		$sql .= " FROM " . $this->db->prefix() . "c_typent";
61
-		$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = " . (empty($mysoc->country_id) ? '0' : $mysoc->country_id) . ")";
60
+		$sql .= " FROM ".$this->db->prefix()."c_typent";
61
+		$sql .= " WHERE active = 1 AND (fk_country IS NULL OR fk_country = ".(empty($mysoc->country_id) ? '0' : $mysoc->country_id).")";
62 62
 		if ($filter) {
63
-			$sql .= " " . $filter;
63
+			$sql .= " ".$filter;
64 64
 		}
65 65
 		$sql .= " ORDER by position, id";
66
-		dol_syslog(get_class($this) . '::typent_array', LOG_DEBUG);
66
+		dol_syslog(get_class($this).'::typent_array', LOG_DEBUG);
67 67
 		$resql = $this->db->query($sql);
68 68
 		if ($resql) {
69 69
 			$num = $this->db->num_rows($resql);
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 		$effs = array();
107 107
 
108 108
 		$sql = "SELECT id, code, libelle as label";
109
-		$sql .= " FROM " . $this->db->prefix() . "c_effectif";
109
+		$sql .= " FROM ".$this->db->prefix()."c_effectif";
110 110
 		$sql .= " WHERE active = 1";
111 111
 		if ($filter) {
112
-			$sql .= " " . $filter;
112
+			$sql .= " ".$filter;
113 113
 		}
114 114
 		$sql .= " ORDER BY id ASC";
115
-		dol_syslog(get_class($this) . '::effectif_array', LOG_DEBUG);
115
+		dol_syslog(get_class($this).'::effectif_array', LOG_DEBUG);
116 116
 		$resql = $this->db->query($sql);
117 117
 		if ($resql) {
118 118
 			$num = $this->db->num_rows($resql);
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 		// phpcs:enable
153 153
 		global $user, $langs;
154 154
 
155
-		print '<form method="post" action="' . $page . '">';
155
+		print '<form method="post" action="'.$page.'">';
156 156
 		print '<input type="hidden" name="action" value="setprospectlevel">';
157
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
157
+		print '<input type="hidden" name="token" value="'.newToken().'">';
158 158
 
159
-		dol_syslog(get_class($this) . '::form_prospect_level', LOG_DEBUG);
159
+		dol_syslog(get_class($this).'::form_prospect_level', LOG_DEBUG);
160 160
 		$sql = "SELECT code, label";
161
-		$sql .= " FROM " . $this->db->prefix() . "c_prospectlevel";
161
+		$sql .= " FROM ".$this->db->prefix()."c_prospectlevel";
162 162
 		$sql .= " WHERE active > 0";
163 163
 		$sql .= " ORDER BY sortorder";
164 164
 		$resql = $this->db->query($sql);
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 			dol_print_error($this->db);
185 185
 		}
186 186
 		if (!empty($htmlname) && $user->admin) {
187
-			print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
187
+			print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
188 188
 		}
189
-		print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">';
189
+		print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
190 190
 		print '</form>';
191 191
 	}
192 192
 
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
 	{
204 204
 		global $user, $langs;
205 205
 
206
-		print '<form method="post" action="' . $page . '">';
206
+		print '<form method="post" action="'.$page.'">';
207 207
 		print '<input type="hidden" name="action" value="setprospectcontactlevel">';
208
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
208
+		print '<input type="hidden" name="token" value="'.newToken().'">';
209 209
 
210 210
 		dol_syslog(__METHOD__, LOG_DEBUG);
211 211
 		$sql = "SELECT code, label";
212
-		$sql .= " FROM " . $this->db->prefix() . "c_prospectcontactlevel";
212
+		$sql .= " FROM ".$this->db->prefix()."c_prospectcontactlevel";
213 213
 		$sql .= " WHERE active > 0";
214 214
 		$sql .= " ORDER BY sortorder";
215 215
 		$resql = $this->db->query($sql);
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 			dol_print_error($this->db);
236 236
 		}
237 237
 		if (!empty($htmlname) && $user->admin) {
238
-			print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
238
+			print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
239 239
 		}
240
-		print '<input type="submit" class="button button-save valignmiddle small" value="' . $langs->trans("Modify") . '">';
240
+		print '<input type="submit" class="button button-save valignmiddle small" value="'.$langs->trans("Modify").'">';
241 241
 		print '</form>';
242 242
 	}
243 243
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		// phpcs:enable
279 279
 		global $conf, $langs, $user;
280 280
 
281
-		dol_syslog(get_class($this) . "::select_departement selected=" . $selected . ", country_codeid=" . $country_codeid, LOG_DEBUG);
281
+		dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG);
282 282
 
283 283
 		$langs->load("dict");
284 284
 
@@ -286,28 +286,28 @@  discard block
 block discarded – undo
286 286
 
287 287
 		// Search departements/cantons/province active d'une region et pays actif
288 288
 		$sql = "SELECT d.rowid, d.code_departement as code, d.nom as name, d.active, c.label as country, c.code as country_code, r.nom as region_name FROM";
289
-		$sql .= " " . $this->db->prefix() . "c_departements as d, " . $this->db->prefix() . "c_regions as r," . $this->db->prefix() . "c_country as c";
289
+		$sql .= " ".$this->db->prefix()."c_departements as d, ".$this->db->prefix()."c_regions as r,".$this->db->prefix()."c_country as c";
290 290
 		$sql .= " WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid";
291 291
 		$sql .= " AND d.active = 1 AND r.active = 1 AND c.active = 1";
292 292
 		if ($country_codeid && is_numeric($country_codeid)) {
293
-			$sql .= " AND c.rowid = '" . $this->db->escape($country_codeid) . "'";
293
+			$sql .= " AND c.rowid = '".$this->db->escape($country_codeid)."'";
294 294
 		}
295 295
 		if ($country_codeid && !is_numeric($country_codeid)) {
296
-			$sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'";
296
+			$sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
297 297
 		}
298 298
 		$sql .= " ORDER BY c.code, d.code_departement";
299 299
 
300 300
 		$result = $this->db->query($sql);
301 301
 		if ($result) {
302 302
 			if (!empty($htmlname)) {
303
-				$out .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '">';
303
+				$out .= '<select id="'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'">';
304 304
 			}
305 305
 			if ($country_codeid) {
306 306
 				$out .= '<option value="0">&nbsp;</option>';
307 307
 			}
308 308
 			$num = $this->db->num_rows($result);
309 309
 			$i = 0;
310
-			dol_syslog(get_class($this) . "::select_departement num=" . $num, LOG_DEBUG);
310
+			dol_syslog(get_class($this)."::select_departement num=".$num, LOG_DEBUG);
311 311
 			if ($num) {
312 312
 				$country = '';
313 313
 				while ($i < $num) {
@@ -318,15 +318,15 @@  discard block
 block discarded – undo
318 318
 						if (!$country || $country != $obj->country) {
319 319
 							// Show break if we are in list with multiple countries
320 320
 							if (!$country_codeid && $obj->country_code) {
321
-								$out .= '<option value="-1" disabled data-html="----- ' . $obj->country . ' -----">----- ' . $obj->country . " -----</option>\n";
321
+								$out .= '<option value="-1" disabled data-html="----- '.$obj->country.' -----">----- '.$obj->country." -----</option>\n";
322 322
 								$country = $obj->country;
323 323
 							}
324 324
 						}
325 325
 
326 326
 						if (!empty($selected) && $selected == $obj->rowid) {
327
-							$out .= '<option value="' . $obj->rowid . '" selected>';
327
+							$out .= '<option value="'.$obj->rowid.'" selected>';
328 328
 						} else {
329
-							$out .= '<option value="' . $obj->rowid . '">';
329
+							$out .= '<option value="'.$obj->rowid.'">';
330 330
 						}
331 331
 
332 332
 						// Si traduction existe, on l'utilise, sinon on prend le libelle par default
@@ -335,13 +335,13 @@  discard block
 block discarded – undo
335 335
 							(getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 1 || getDolGlobalInt('MAIN_SHOW_STATE_CODE') == 2 || getDolGlobalString('MAIN_SHOW_STATE_CODE') === 'all')
336 336
 						) {
337 337
 							if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) {
338
-								$out .= $obj->region_name . ' - ' . $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
338
+								$out .= $obj->region_name.' - '.$obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
339 339
 							} else {
340
-								$out .= $obj->code . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
340
+								$out .= $obj->code.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
341 341
 							}
342 342
 						} else {
343 343
 							if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1) {
344
-								$out .= $obj->region_name . ' - ' . ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
344
+								$out .= $obj->region_name.' - '.($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
345 345
 							} else {
346 346
 								$out .= ($langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : ($obj->name != '-' ? $obj->name : ''));
347 347
 							}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 				$out .= '</select>';
357 357
 			}
358 358
 			if (!empty($htmlname) && $user->admin) {
359
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
359
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
360 360
 			}
361 361
 		} else {
362 362
 			dol_print_error($this->db);
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
 		// Make select dynamic
366 366
 		if (!empty($htmlname)) {
367
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
367
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
368 368
 			$out .= ajax_combobox($htmlname);
369 369
 		}
370 370
 
@@ -417,14 +417,14 @@  discard block
 block discarded – undo
417 417
 		$langs->load("dict");
418 418
 
419 419
 		$sql = "SELECT r.rowid, r.code_region as code, r.nom as label, r.active, c.code as country_code, c.label as country";
420
-		$sql .= " FROM " . $this->db->prefix() . "c_regions as r, " . $this->db->prefix() . "c_country as c";
420
+		$sql .= " FROM ".$this->db->prefix()."c_regions as r, ".$this->db->prefix()."c_country as c";
421 421
 		$sql .= " WHERE r.fk_pays=c.rowid AND r.active = 1 and c.active = 1";
422 422
 		$sql .= " ORDER BY c.code, c.label ASC";
423 423
 
424
-		dol_syslog(get_class($this) . "::select_region", LOG_DEBUG);
424
+		dol_syslog(get_class($this)."::select_region", LOG_DEBUG);
425 425
 		$resql = $this->db->query($sql);
426 426
 		if ($resql) {
427
-			print '<select class="flat" id="' . $htmlname . '" name="' . $htmlname . '">';
427
+			print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
428 428
 			$num = $this->db->num_rows($resql);
429 429
 			$i = 0;
430 430
 			if ($num) {
@@ -436,16 +436,16 @@  discard block
 block discarded – undo
436 436
 					} else {
437 437
 						if ($country == '' || $country != $obj->country) {
438 438
 							// Show break
439
-							$key = $langs->trans("Country" . strtoupper($obj->country_code));
440
-							$valuetoshow = ($key != "Country" . strtoupper($obj->country_code)) ? $obj->country_code . " - " . $key : $obj->country;
441
-							print '<option value="-2" disabled>----- ' . $valuetoshow . " -----</option>\n";
439
+							$key = $langs->trans("Country".strtoupper($obj->country_code));
440
+							$valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country;
441
+							print '<option value="-2" disabled>----- '.$valuetoshow." -----</option>\n";
442 442
 							$country = $obj->country;
443 443
 						}
444 444
 
445 445
 						if ($selected > 0 && $selected == $obj->code) {
446
-							print '<option value="' . $obj->code . '" selected>' . $obj->label . '</option>';
446
+							print '<option value="'.$obj->code.'" selected>'.$obj->label.'</option>';
447 447
 						} else {
448
-							print '<option value="' . $obj->code . '">' . $obj->label . '</option>';
448
+							print '<option value="'.$obj->code.'">'.$obj->label.'</option>';
449 449
 						}
450 450
 					}
451 451
 					$i++;
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
 
477 477
 		$out = '';
478 478
 
479
-		$sql = "SELECT rowid, code, label, active FROM " . $this->db->prefix() . "c_civility";
479
+		$sql = "SELECT rowid, code, label, active FROM ".$this->db->prefix()."c_civility";
480 480
 		$sql .= " WHERE active = 1";
481 481
 
482 482
 		dol_syslog("Form::select_civility", LOG_DEBUG);
483 483
 		$resql = $this->db->query($sql);
484 484
 		if ($resql) {
485
-			$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
485
+			$out .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
486 486
 			$out .= '<option value="">&nbsp;</option>';
487 487
 			$num = $this->db->num_rows($resql);
488 488
 			$i = 0;
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 				while ($i < $num) {
491 491
 					$obj = $this->db->fetch_object($resql);
492 492
 					if ($selected == $obj->code) {
493
-						$out .= '<option value="' . $obj->code . '" selected>';
493
+						$out .= '<option value="'.$obj->code.'" selected>';
494 494
 					} else {
495
-						$out .= '<option value="' . $obj->code . '">';
495
+						$out .= '<option value="'.$obj->code.'">';
496 496
 					}
497 497
 					// If translation exists, we use it, otherwise, we use the hard coded label
498
-					$out .= ($langs->trans("Civility" . $obj->code) != "Civility" . $obj->code ? $langs->trans("Civility" . $obj->code) : ($obj->label != '-' ? $obj->label : ''));
498
+					$out .= ($langs->trans("Civility".$obj->code) != "Civility".$obj->code ? $langs->trans("Civility".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
499 499
 					$out .= '</option>';
500 500
 					$i++;
501 501
 				}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
 			if ($addjscombo) {
509 509
 				// Enhance with select2
510
-				include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
510
+				include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
511 511
 				$out .= ajax_combobox($htmlname);
512 512
 			}
513 513
 		} else {
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 
558 558
 		// Lookup the active juridical types for the active countries
559 559
 		$sql  = "SELECT f.rowid, f.code as code , f.libelle as label, f.active, c.label as country, c.code as country_code";
560
-		$sql .= " FROM " . $this->db->prefix() . "c_forme_juridique as f, " . $this->db->prefix() . "c_country as c";
560
+		$sql .= " FROM ".$this->db->prefix()."c_forme_juridique as f, ".$this->db->prefix()."c_country as c";
561 561
 		$sql .= " WHERE f.fk_pays=c.rowid";
562 562
 		$sql .= " AND f.active = 1 AND c.active = 1";
563 563
 		if ($country_codeid) {
564
-			$sql .= " AND c.code = '" . $this->db->escape($country_codeid) . "'";
564
+			$sql .= " AND c.code = '".$this->db->escape($country_codeid)."'";
565 565
 		}
566 566
 		if ($filter) {
567
-			$sql .= " " . $filter;
567
+			$sql .= " ".$filter;
568 568
 		}
569 569
 		$sql .= " ORDER BY c.code";
570 570
 
571
-		dol_syslog(get_class($this) . "::select_juridicalstatus", LOG_DEBUG);
571
+		dol_syslog(get_class($this)."::select_juridicalstatus", LOG_DEBUG);
572 572
 		$resql = $this->db->query($sql);
573 573
 		if ($resql) {
574 574
 			$out .= '<div id="particulier2" class="visible">';
575
-			$out .= '<select class="flat minwidth200' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
575
+			$out .= '<select class="flat minwidth200'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
576 576
 			if ($country_codeid) {
577 577
 				$out .= '<option value="0">&nbsp;</option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
578 578
 			}
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 					$obj = $this->db->fetch_object($resql);
587 587
 
588 588
 					if ($obj->code) {		// We exclude empty line, we will add it later
589
-						$labelcountry = (($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code) ? $langs->trans("Country" . $obj->country_code) : $obj->country);
590
-						$labeljs = (($langs->trans("JuridicalStatus" . $obj->code) != "JuridicalStatus" . $obj->code) ? $langs->trans("JuridicalStatus" . $obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
591
-						$arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry . '_' . $labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry);
589
+						$labelcountry = (($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) ? $langs->trans("Country".$obj->country_code) : $obj->country);
590
+						$labeljs = (($langs->trans("JuridicalStatus".$obj->code) != "JuridicalStatus".$obj->code) ? $langs->trans("JuridicalStatus".$obj->code) : ($obj->label != '-' ? $obj->label : '')); // $obj->label is already in output charset (converted by database driver)
591
+						$arraydata[$obj->code] = array('code' => $obj->code, 'label' => $labeljs, 'label_sort' => $labelcountry.'_'.$labeljs, 'country_code' => $obj->country_code, 'country' => $labelcountry);
592 592
 					}
593 593
 					$i++;
594 594
 				}
@@ -602,15 +602,15 @@  discard block
 block discarded – undo
602 602
 					if (!$country || $country != $val['country']) {
603 603
 						// Show break when we are in multi country mode
604 604
 						if (empty($country_codeid) && $val['country_code']) {
605
-							$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- ' . $val['country'] . " -----</option>\n";
605
+							$out .= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n";
606 606
 							$country = $val['country'];
607 607
 						}
608 608
 					}
609 609
 
610 610
 					if ($selected > 0 && $selected == $val['code']) {
611
-						$out .= '<option value="' . $val['code'] . '" selected>';
611
+						$out .= '<option value="'.$val['code'].'" selected>';
612 612
 					} else {
613
-						$out .= '<option value="' . $val['code'] . '">';
613
+						$out .= '<option value="'.$val['code'].'">';
614 614
 					}
615 615
 					// If translation exists, we use it, otherwise we use default label in database
616 616
 					$out .= $val['label'];
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 			}
620 620
 			$out .= '</select>';
621 621
 			if ($user->admin) {
622
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
622
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
623 623
 			}
624 624
 
625 625
 			// Make select dynamic
626
-			include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
626
+			include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
627 627
 			$out .= ajax_combobox($htmlname);
628 628
 
629 629
 			$out .= '</div>';
@@ -677,13 +677,13 @@  discard block
 block discarded – undo
677 677
 			$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
678 678
 
679 679
 			if (count($events)) {	// If there is some ajax events to run once selection is done, we add code here to run events
680
-				print '<script nonce="' . getNonce() . '" type="text/javascript">
680
+				print '<script nonce="'.getNonce().'" type="text/javascript">
681 681
 				jQuery(document).ready(function() {
682
-					$("#search_' . $htmlname . '").change(function() {
683
-						var obj = ' . json_encode($events) . ';
682
+					$("#search_' . $htmlname.'").change(function() {
683
+						var obj = ' . json_encode($events).';
684 684
 						$.each(obj, function(key,values) {
685 685
 							if (values.method.length) {
686
-								runJsCodeForEvent' . $htmlname . '(values);
686
+								runJsCodeForEvent' . $htmlname.'(values);
687 687
 							}
688 688
 						});
689 689
 
@@ -691,13 +691,13 @@  discard block
 block discarded – undo
691 691
 					});
692 692
 
693 693
 					// Function used to execute events when search_htmlname change
694
-					function runJsCodeForEvent' . $htmlname . '(obj) {
695
-						var id = $("#' . $htmlname . '").val();
694
+					function runJsCodeForEvent' . $htmlname.'(obj) {
695
+						var id = $("#' . $htmlname.'").val();
696 696
 						var method = obj.method;
697 697
 						var url = obj.url;
698 698
 						var htmlname = obj.htmlname;
699 699
 						var showempty = obj.showempty;
700
-						console.log("Run runJsCodeForEvent-' . $htmlname . ' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
700
+						console.log("Run runJsCodeForEvent-' . $htmlname.' from selectCompaniesForNewContact id="+id+" method="+method+" showempty="+showempty+" url="+url+" htmlname="+htmlname);
701 701
 						$.getJSON(url,
702 702
 							{
703 703
 								action: method,
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 				</script>';
728 728
 			}
729 729
 
730
-			print "\n" . '<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->' . "\n";
731
-			print '<input type="text" size="30" id="search_' . $htmlname . '" name="search_' . $htmlname . '" value="' . $name . '" />';
732
-			print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT . '/societe/ajax/ajaxcompanies.php', '', $minLength, 0);
730
+			print "\n".'<!-- Input text for third party with Ajax.Autocompleter (selectCompaniesForNewContact) -->'."\n";
731
+			print '<input type="text" size="30" id="search_'.$htmlname.'" name="search_'.$htmlname.'" value="'.$name.'" />';
732
+			print ajax_autocompleter(($socid ? $socid : -1), $htmlname, DOL_URL_ROOT.'/societe/ajax/ajaxcompanies.php', '', $minLength, 0);
733 733
 			return $socid;
734 734
 		} else {
735 735
 			// Search to list thirdparties
@@ -741,14 +741,14 @@  discard block
 block discarded – undo
741 741
 				$sql .= ", s.address, s.zip, s.town";
742 742
 				$sql .= ", dictp.code as country_code";
743 743
 			}
744
-			$sql .= " FROM " . $this->db->prefix() . "societe as s";
744
+			$sql .= " FROM ".$this->db->prefix()."societe as s";
745 745
 			if (getDolGlobalString('COMPANY_SHOW_ADDRESS_SELECTLIST')) {
746
-				$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
746
+				$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as dictp ON dictp.rowid = s.fk_pays";
747 747
 			}
748
-			$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
748
+			$sql .= " WHERE s.entity IN (".getEntity('societe').")";
749 749
 			// For ajax search we limit here. For combo list, we limit later
750 750
 			if (is_array($limitto) && count($limitto)) {
751
-				$sql .= " AND s.rowid IN (" . $this->db->sanitize(implode(',', $limitto)) . ")";
751
+				$sql .= " AND s.rowid IN (".$this->db->sanitize(implode(',', $limitto)).")";
752 752
 			}
753 753
 			// Add where from hooks
754 754
 			$parameters = array();
@@ -758,10 +758,10 @@  discard block
 block discarded – undo
758 758
 
759 759
 			$resql = $this->db->query($sql);
760 760
 			if ($resql) {
761
-				print '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" id="' . $htmlname . '" name="' . $htmlname . '"';
761
+				print '<select class="flat'.($morecss ? ' '.$morecss : '').'" id="'.$htmlname.'" name="'.$htmlname.'"';
762 762
 				if ($conf->use_javascript_ajax) {
763
-					$javaScript = "window.location='" . dol_escape_js($_SERVER['PHP_SELF']) . "?" . $var_id . "=" . ($forceid > 0 ? $forceid : $object->id) . $moreparam . "&" . $htmlname . "=' + form." . $htmlname . ".options[form." . $htmlname . ".selectedIndex].value;";
764
-					print ' onChange="' . $javaScript . '"';
763
+					$javaScript = "window.location='".dol_escape_js($_SERVER['PHP_SELF'])."?".$var_id."=".($forceid > 0 ? $forceid : $object->id).$moreparam."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
764
+					print ' onChange="'.$javaScript.'"';
765 765
 				}
766 766
 				print '>';
767 767
 				print '<option value="-1">&nbsp;</option>';
@@ -779,18 +779,18 @@  discard block
 block discarded – undo
779 779
 							$disabled = 1;
780 780
 						}
781 781
 						if ($selected > 0 && $selected == $obj->rowid) {
782
-							print '<option value="' . $obj->rowid . '"';
782
+							print '<option value="'.$obj->rowid.'"';
783 783
 							if ($disabled) {
784 784
 								print ' disabled';
785 785
 							}
786
-							print ' selected>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
786
+							print ' selected>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>';
787 787
 							$firstCompany = $obj->rowid;
788 788
 						} else {
789
-							print '<option value="' . $obj->rowid . '"';
789
+							print '<option value="'.$obj->rowid.'"';
790 790
 							if ($disabled) {
791 791
 								print ' disabled';
792 792
 							}
793
-							print '>' . dol_escape_htmltag($obj->name, 0, 0, '', 0, 1) . '</option>';
793
+							print '>'.dol_escape_htmltag($obj->name, 0, 0, '', 0, 1).'</option>';
794 794
 						}
795 795
 						$i++;
796 796
 					}
@@ -825,22 +825,22 @@  discard block
 block discarded – undo
825 825
 
826 826
 		$out = '';
827 827
 		if (is_object($object) && method_exists($object, 'liste_type_contact')) {
828
-			$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);	// List of types into c_type_contact for element=$object->element
828
+			$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); // List of types into c_type_contact for element=$object->element
829 829
 
830
-			$out .= '<select class="flat valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
830
+			$out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
831 831
 			if ($showempty) {
832 832
 				$out .= '<option value="0">&nbsp;</option>';
833 833
 			}
834 834
 			foreach ($lesTypes as $key => $value) {
835
-				$out .= '<option value="' . $key . '"';
835
+				$out .= '<option value="'.$key.'"';
836 836
 				if ($key == $selected) {
837 837
 					$out .= ' selected';
838 838
 				}
839
-				$out .= '>' . $value . '</option>';
839
+				$out .= '>'.$value.'</option>';
840 840
 			}
841 841
 			$out .= "</select>";
842 842
 			if ($user->admin && empty($forcehidetooltip)) {
843
-				$out .= ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
843
+				$out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
844 844
 			}
845 845
 
846 846
 			$out .= ajax_combobox($htmlname);
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
 		if ($rendermode === 'view') {
871 871
 			$toprint = array();
872 872
 			foreach ($contact->roles as $key => $val) {
873
-				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">' . $val['label'] . '</li>';
873
+				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb;">'.$val['label'].'</li>';
874 874
 			}
875
-			return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="' . $htmlname . '"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
875
+			return '<div class="select2-container-multi-dolibarr" style="width: 90%;" id="'.$htmlname.'"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
876 876
 		}
877 877
 
878 878
 		if ($rendermode === 'edit') {	// A multiselect combo list
@@ -918,14 +918,14 @@  discard block
 block discarded – undo
918 918
 
919 919
 		$size = '';
920 920
 		if (!empty($fieldsize)) {
921
-			$size = 'size="' . $fieldsize . '"';
921
+			$size = 'size="'.$fieldsize.'"';
922 922
 		}
923 923
 
924 924
 		if ($conf->use_javascript_ajax && empty($disableautocomplete)) {
925
-			$out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT . '/core/ajax/ziptown.php') . "\n";
925
+			$out .= ajax_multiautocompleter($htmlname, $fields, DOL_URL_ROOT.'/core/ajax/ziptown.php')."\n";
926 926
 			$moreattrib .= ' autocomplete="off"';
927 927
 		}
928
-		$out .= '<input id="' . $htmlname . '" class="maxwidthonsmartphone' . ($morecss ? ' ' . $morecss : '') . '" type="text"' . ($moreattrib ? ' ' . $moreattrib : '') . ' name="' . $htmlname . '" ' . $size . ' value="' . $selected . '">' . "\n";
928
+		$out .= '<input id="'.$htmlname.'" class="maxwidthonsmartphone'.($morecss ? ' '.$morecss : '').'" type="text"'.($moreattrib ? ' '.$moreattrib : '').' name="'.$htmlname.'" '.$size.' value="'.$selected.'">'."\n";
929 929
 
930 930
 		return $out;
931 931
 	}
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		$parameters = array('formlength' => $formlength, 'selected' => $preselected, 'idprof' => $idprof, 'htmlname' => $htmlname, 'country_code' => $country_code);
1002 1002
 		$reshook = $hookmanager->executeHooks('getInputIdProf', $parameters);
1003 1003
 		if (empty($reshook)) {
1004
-			$out .= '<input type="text" ' . ($morecss ? 'class="' . $morecss . '" ' : '') . 'name="' . $htmlname . '" id="' . $htmlname . '" maxlength="' . $maxlength . '" value="' . $selected . '">';
1004
+			$out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">';
1005 1005
 		}
1006 1006
 		$out .= $hookmanager->resPrint;
1007 1007
 
@@ -1032,9 +1032,9 @@  discard block
 block discarded – undo
1032 1032
 				$i = 0;
1033 1033
 				while ($i < $nbvalues) {
1034 1034
 					if ($selected == $valors[$i]) {
1035
-						print '<option value="' . $valors[$i] . '" selected>';
1035
+						print '<option value="'.$valors[$i].'" selected>';
1036 1036
 					} else {
1037
-						print '<option value="' . $valors[$i] . '">';
1037
+						print '<option value="'.$valors[$i].'">';
1038 1038
 					}
1039 1039
 					print $valors[$i];
1040 1040
 					print '</option>';
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 			return '';
1064 1064
 		}
1065 1065
 
1066
-		$out = '<select class="flat ' . $morecss . '" name="' . $htmlname . '" id="' . $htmlidname . '">';
1066
+		$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
1067 1067
 		if ($typeinput == 'form') {
1068 1068
 			if ($allowempty || ($selected == '' || $selected == '-1')) {
1069 1069
 				$out .= '<option value="-1">';
@@ -1075,33 +1075,33 @@  discard block
 block discarded – undo
1075 1075
 				$out .= '</option>';
1076 1076
 			}
1077 1077
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1078
-				$out .= '<option value="2"' . ($selected == 2 ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
1078
+				$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
1079 1079
 			}
1080 1080
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
1081
-				$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
1081
+				$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
1082 1082
 			}
1083 1083
 			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1084
-				$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
1084
+				$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
1085 1085
 			}
1086
-			$out .= '<option value="0"' . ((string) $selected == '0' ? ' selected' : '') . '>' . $langs->trans('NorProspectNorCustomer') . '</option>';
1086
+			$out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
1087 1087
 		} elseif ($typeinput == 'list') {
1088
-			$out .= '<option value="-1"' . (($selected == '' || $selected == '-1') ? ' selected' : '') . '>&nbsp;</option>';
1088
+			$out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'>&nbsp;</option>';
1089 1089
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) {
1090
-				$out .= '<option value="2,3"' . ($selected == '2,3' ? ' selected' : '') . '>' . $langs->trans('Prospect') . '</option>';
1090
+				$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
1091 1091
 			}
1092 1092
 			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1093
-				$out .= '<option value="1,3"' . ($selected == '1,3' ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
1093
+				$out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
1094 1094
 			}
1095 1095
 			if (isModEnabled("fournisseur")) {
1096
-				$out .= '<option value="4"' . ($selected == '4' ? ' selected' : '') . '>' . $langs->trans('Supplier') . '</option>';
1096
+				$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
1097 1097
 			}
1098
-			$out .= '<option value="0"' . ($selected == '0' ? ' selected' : '') . '>' . $langs->trans('Other') . '</option>';
1098
+			$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
1099 1099
 		} elseif ($typeinput == 'admin') {
1100 1100
 			if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS') && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
1101
-				$out .= '<option value="3"' . ($selected == 3 ? ' selected' : '') . '>' . $langs->trans('ProspectCustomer') . '</option>';
1101
+				$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
1102 1102
 			}
1103 1103
 			if (!getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) {
1104
-				$out .= '<option value="1"' . ($selected == 1 ? ' selected' : '') . '>' . $langs->trans('Customer') . '</option>';
1104
+				$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
1105 1105
 			}
1106 1106
 		}
1107 1107
 		$out .= '</select>';
@@ -1127,12 +1127,12 @@  discard block
 block discarded – undo
1127 1127
 
1128 1128
 		$out = '';
1129 1129
 		if ($htmlname != "none") {
1130
-			$out .= '<form method="post" action="' . $page . '">';
1130
+			$out .= '<form method="post" action="'.$page.'">';
1131 1131
 			$out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
1132
-			$out .= '<input type="hidden" name="token" value="' . newToken() . '">';
1132
+			$out .= '<input type="hidden" name="token" value="'.newToken().'">';
1133 1133
 			$sortparam = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
1134 1134
 			$out .= $this->selectarray($htmlname, $this->typent_array(0, $filter), $selected, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
1135
-			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="' . $langs->trans("Modify") . '">';
1135
+			$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
1136 1136
 			$out .= '</form>';
1137 1137
 		} else {
1138 1138
 			if ($selected > 0) {
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 
1172 1172
 			//print $prospectstatic->LibProspCommStatut($statusprospect, 2, $prospectstatic->cacheprospectstatus[$statusprospect]['label'], $prospectstatic->cacheprospectstatus[$statusprospect]['picto']);
1173 1173
 			print img_action('', $actioncode, $actionpicto, 'class="inline-block valignmiddle paddingright pictoprospectstatus"');
1174
-			print '<select class="flat selectprospectstatus maxwidth150" id="'. $htmlname.$idprospect .'" data-socid="'.$idprospect.'" name="' . $htmlname .'"';
1174
+			print '<select class="flat selectprospectstatus maxwidth150" id="'.$htmlname.$idprospect.'" data-socid="'.$idprospect.'" name="'.$htmlname.'"';
1175 1175
 			if (!$user->hasRight('societe', 'creer')) {
1176 1176
 				print ' disabled';
1177 1177
 			}
@@ -1201,8 +1201,8 @@  discard block
 block discarded – undo
1201 1201
 						var image = $(this).prev(".pictoprospectstatus");
1202 1202
 						$.ajax({
1203 1203
 							type: "POST",
1204
-							url: \'' . DOL_URL_ROOT . '/core/ajax/ajaxstatusprospect.php\',
1205
-							data: { id: statusid, prospectid: prospectid, token: \''. newToken() .'\', action: \'updatestatusprospect\' },
1204
+							url: \'' . DOL_URL_ROOT.'/core/ajax/ajaxstatusprospect.php\',
1205
+							data: { id: statusid, prospectid: prospectid, token: \''. newToken().'\', action: \'updatestatusprospect\' },
1206 1206
 							success: function(response) {
1207 1207
 								console.log(response.img);
1208 1208
 								image.replaceWith(response.img);
Please login to merge, or discard this patch.
htdocs/core/modules/oauth/generic_oauthcallback.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 // access type needed to have oauth provider refreshing token
141 141
 // also note that a refresh token is sent only after a prompt
142 142
 if (method_exists($apiService, 'setAccessType')) {
143
-	$apiService->setAccessType('offline');		// Most generic OAUTH provider does not provide AccessType online/offline. They are mostly offline.
143
+	$apiService->setAccessType('offline'); // Most generic OAUTH provider does not provide AccessType online/offline. They are mostly offline.
144 144
 }
145 145
 
146 146
 if (!getDolGlobalString($keyforparamid)) {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 	// Set approval_prompt. Note: A refresh token will be provided only if prompt is done.
185 185
 	if ($forlogin) {
186
-		$approval_prompt = getDolGlobalString('OAUTH_'.$genericstring.'_FORCE_PROMPT_ON_LOGIN', 'auto');	// Can be 'force'
186
+		$approval_prompt = getDolGlobalString('OAUTH_'.$genericstring.'_FORCE_PROMPT_ON_LOGIN', 'auto'); // Can be 'force'
187 187
 		if (method_exists($apiService, 'setApprouvalPrompt')) {
188 188
 			$apiService->setApprouvalPrompt($approval_prompt);
189 189
 		}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	$url .= '&scope='.str_replace(',', '+', $statewithscopeonly);
207 207
 
208 208
 	// Add more param
209
-	$url .= '&nonce='.bin2hex(random_bytes(64/8));
209
+	$url .= '&nonce='.bin2hex(random_bytes(64 / 8));
210 210
 
211 211
 	if ($forlogin) {
212 212
 		// TODO Add param hd. What is it for ?
@@ -325,10 +325,10 @@  discard block
 block discarded – undo
325 325
 					$entitytosearchuser = (isset($tmparray['entity']) ? $tmparray['entity'] : -1);
326 326
 
327 327
 					// Delete the old token
328
-					$storage->clearToken($genericstring);	// Delete the token called ("Generic-".$storage->keyforprovider)
328
+					$storage->clearToken($genericstring); // Delete the token called ("Generic-".$storage->keyforprovider)
329 329
 
330 330
 					$tmpuser = new User($db);
331
-					$res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1);	// Load user. Can load with email_oauth2.
331
+					$res = $tmpuser->fetch(0, '', '', 0, $entitytosearchuser, $useremail, 0, 1); // Load user. Can load with email_oauth2.
332 332
 
333 333
 					if ($res > 0) {
334 334
 						$username = $tmpuser->login;
Please login to merge, or discard this patch.
htdocs/projet/class/project.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1741,7 +1741,7 @@  discard block
 block discarded – undo
1741 1741
 		global $langs, $conf;
1742 1742
 
1743 1743
 		$error = 0;
1744
-		$clone_project_id = 0;   // For static toolcheck
1744
+		$clone_project_id = 0; // For static toolcheck
1745 1745
 
1746 1746
 		dol_syslog("createFromClone clone_contact=".json_encode($clone_contact)." clone_task=".json_encode($clone_task)." clone_project_file=".json_encode($clone_project_file)." clone_note=".json_encode($clone_note)." move_date=".json_encode($move_date), LOG_DEBUG);
1747 1747
 
@@ -2035,7 +2035,7 @@  discard block
 block discarded – undo
2035 2035
 		if ($tableName == "actioncomm") {
2036 2036
 			$sql .= " SET fk_project=".$this->id;
2037 2037
 			$sql .= " WHERE id=".((int) $elementSelectId);
2038
-		} elseif (in_array($tableName, ["entrepot","mrp_mo","stocktransfer_stocktransfer"])) {
2038
+		} elseif (in_array($tableName, ["entrepot", "mrp_mo", "stocktransfer_stocktransfer"])) {
2039 2039
 			$sql .= " SET fk_project=".$this->id;
2040 2040
 			$sql .= " WHERE rowid=".((int) $elementSelectId);
2041 2041
 		} else {
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
 					$date = explode('-', $obj->element_date);
2227 2227
 					$week_number = getWeekNumber((int) $date[2], (int) $date[1], (int) $date[0]);
2228 2228
 				}
2229
-				'@phan-var-force int $week_number';  // Needed because phan considers it might be null
2229
+				'@phan-var-force int $week_number'; // Needed because phan considers it might be null
2230 2230
 				if (empty($weekalreadyfound[$week_number])) {
2231 2231
 					$this->monthWorkLoad[$week_number] = $obj->element_duration;
2232 2232
 					$this->monthWorkLoadPerTask[$week_number][$obj->fk_element] = $obj->element_duration;
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 			$return .= '<br><span class="info-box-label opacitymedium">'.$langs->trans("Author").'</span>';
2571 2571
 			$return .= '<span> : '.$user->getNomUrl(1).'</span>';
2572 2572
 		}*/
2573
-		$return .= '<br><div>';	// start div line status
2573
+		$return .= '<br><div>'; // start div line status
2574 2574
 		if ($this->usage_opportunity && $this->opp_status_code) {
2575 2575
 			//$return .= '<br><span class="info-bo-label opacitymedium">'.$langs->trans("OpportunityStatusShort").'</span>';
2576 2576
 			//$return .= '<div class="small inline-block">'.dol_trunc($langs->trans("OppStatus".$this->opp_status_code), 5).'</div>';
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
 		if (method_exists($this, 'getLibStatut')) {
2581 2581
 			$return .= '<div class="info-box-status small inline-block valignmiddle">'.$this->getLibStatut(3).'</div>';
2582 2582
 		}
2583
-		$return .= '</div>';	// end div line status
2583
+		$return .= '</div>'; // end div line status
2584 2584
 
2585 2585
 		$return .= '</div>';
2586 2586
 		$return .= '</div>';
Please login to merge, or discard this patch.
htdocs/societe/class/societe.class.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1042,8 +1042,8 @@  discard block
 block discarded – undo
1042 1042
 			$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
1043 1043
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1044 1044
 				$sql .= ", ".(empty($this->vat_reverse_charge) ? '0' : '1');
1045
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'";
1046
-				$sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'";
1045
+				$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
1046
+				$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
1047 1047
 			}
1048 1048
 			$sql .= ")";
1049 1049
 
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 				}
1093 1093
 
1094 1094
 				if ($ret >= 0) {
1095
-					if (! $notrigger) {
1095
+					if (!$notrigger) {
1096 1096
 						// Call trigger
1097 1097
 						$result = $this->call_trigger('COMPANY_CREATE', $user);
1098 1098
 						if ($result < 0) {
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 		$contact->town              = $this->town;
1170 1170
 		$this->setUpperOrLowerCase();
1171 1171
 		$contact->phone_pro         = $this->phone;
1172
-		$contact->roles				= explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES'));
1172
+		$contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES'));
1173 1173
 
1174 1174
 		$contactId = $contact->create($user, $notrigger);
1175 1175
 		if ($contactId < 0) {
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1337 1337
 							$langs->loadLangs(array("errors", 'compta'));
1338 1338
 							$error++;
1339
-							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1339
+							$this->errors[] = $langs->trans('CustomerAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1340 1340
 						}
1341 1341
 					}
1342 1342
 
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1345 1345
 						$langs->loadLangs(array("errors", 'compta'));
1346 1346
 						$error++;
1347
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1347
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('CustomerAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1348 1348
 					}
1349 1349
 				} elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER' && !empty($this->fournisseur)) {
1350 1350
 					// Check for unicity
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 						if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
1353 1353
 							$langs->loadLangs(array("errors", 'compta'));
1354 1354
 							$error++;
1355
-							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort') . " " . $langs->trans("ErrorProdIdAlreadyExist", $vallabel) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1355
+							$this->errors[] = $langs->trans('SupplierAccountancyCodeShort')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
1356 1356
 						}
1357 1357
 					}
1358 1358
 
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 					if (getDolGlobalString('SOCIETE_ACCOUNTANCY_CODE_SUPPLIER_MANDATORY') && (!isset($vallabel) || trim($vallabel) === '')) {
1361 1361
 						$langs->loadLangs(array("errors", 'compta'));
1362 1362
 						$error++;
1363
-						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')) . ' (' . $langs->trans("ForbiddenBySetupRules") . ')';
1363
+						$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('SupplierAccountancyCodeShort')).' ('.$langs->trans("ForbiddenBySetupRules").')';
1364 1364
 					}
1365 1365
 				}
1366 1366
 			}
@@ -1402,17 +1402,17 @@  discard block
 block discarded – undo
1402 1402
 		$now = dol_now();
1403 1403
 
1404 1404
 		// Clean parameters
1405
-		$this->id 			= $id;
1406
-		$this->entity 		= ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1405
+		$this->id = $id;
1406
+		$this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity);
1407 1407
 		$this->name 		= $this->name ? trim($this->name) : trim((string) $this->nom);
1408 1408
 		$this->nom 			= $this->name; // For backward compatibility
1409
-		$this->name_alias 	= trim((string) $this->name_alias);
1409
+		$this->name_alias = trim((string) $this->name_alias);
1410 1410
 		$this->ref_ext		= (empty($this->ref_ext) ? '' : trim($this->ref_ext));
1411 1411
 		$this->address		= trim((string) $this->address);
1412 1412
 		$this->zip 			= trim((string) $this->zip);
1413 1413
 		$this->town 		= trim((string) $this->town);
1414
-		$this->state_id 	= (is_numeric($this->state_id)) ? (int) trim((string) $this->state_id) : 0;
1415
-		$this->country_id 	= ($this->country_id > 0) ? $this->country_id : 0;
1414
+		$this->state_id = (is_numeric($this->state_id)) ? (int) trim((string) $this->state_id) : 0;
1415
+		$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
1416 1416
 		$this->phone		= trim((string) $this->phone);
1417 1417
 		$this->phone		= preg_replace("/\s/", "", $this->phone);
1418 1418
 		$this->phone		= preg_replace("/\./", "", $this->phone);
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 		$this->fax			= trim((string) $this->fax);
1423 1423
 		$this->fax			= preg_replace("/\s/", "", $this->fax);
1424 1424
 		$this->fax			= preg_replace("/\./", "", $this->fax);
1425
-		$this->email		= trim((string) $this->email);
1425
+		$this->email = trim((string) $this->email);
1426 1426
 		$this->url			= $this->url ? clean_url($this->url, 0) : '';
1427 1427
 		$this->note_private = (empty($this->note_private) ? '' : trim($this->note_private));
1428 1428
 		$this->note_public  = (empty($this->note_public) ? '' : trim($this->note_public));
@@ -1432,14 +1432,14 @@  discard block
 block discarded – undo
1432 1432
 		$this->idprof4		= trim((string) $this->idprof4);
1433 1433
 		$this->idprof5		= (!empty($this->idprof5) ? trim($this->idprof5) : '');
1434 1434
 		$this->idprof6		= (!empty($this->idprof6) ? trim($this->idprof6) : '');
1435
-		$this->prefix_comm 	= trim((string) $this->prefix_comm);
1435
+		$this->prefix_comm = trim((string) $this->prefix_comm);
1436 1436
 		$this->outstanding_limit = price2num($this->outstanding_limit);
1437 1437
 		$this->order_min_amount = price2num($this->order_min_amount);
1438 1438
 		$this->supplier_order_min_amount = price2num($this->supplier_order_min_amount);
1439 1439
 
1440 1440
 		$this->tva_assuj			= (is_numeric($this->tva_assuj)) ? (int) trim((string) $this->tva_assuj) : 0;
1441 1441
 		$this->tva_intra			= dol_sanitizeFileName($this->tva_intra, '');
1442
-		$this->vat_reverse_charge	= empty($this->vat_reverse_charge) ? 0 : 1;
1442
+		$this->vat_reverse_charge = empty($this->vat_reverse_charge) ? 0 : 1;
1443 1443
 		if (empty($this->status)) {
1444 1444
 			$this->status = 0;
1445 1445
 		}
@@ -1590,7 +1590,7 @@  discard block
 block discarded – undo
1590 1590
 			$sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null");
1591 1591
 			$sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'";
1592 1592
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1593
-				$sql .= ",vat_reverse_charge = " . ($this->vat_reverse_charge != '' ? "'" . $this->db->escape($this->vat_reverse_charge) . "'" : 0);
1593
+				$sql .= ",vat_reverse_charge = ".($this->vat_reverse_charge != '' ? "'".$this->db->escape($this->vat_reverse_charge)."'" : 0);
1594 1594
 			}
1595 1595
 			$sql .= ",status = ".((int) $this->status);
1596 1596
 
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 			$sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null');
1652 1652
 			$sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'";
1653 1653
 			if (!getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
1654
-				$sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'";
1655
-				$sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'";
1654
+				$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
1655
+				$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
1656 1656
 				if ($customer) {
1657 1657
 					$sql .= ", code_compta = ".(!empty($this->code_compta_client) ? "'".$this->db->escape($this->code_compta_client)."'" : "null");
1658 1658
 				}
@@ -2022,7 +2022,7 @@  discard block
 block discarded – undo
2022 2022
 				$this->code_client = $obj->code_client;
2023 2023
 				$this->code_fournisseur = $obj->code_fournisseur;
2024 2024
 
2025
-				$this->code_compta = $obj->code_compta;			// For backward compatibility
2025
+				$this->code_compta = $obj->code_compta; // For backward compatibility
2026 2026
 				$this->code_compta_client = $obj->code_compta;
2027 2027
 				$this->code_compta_fournisseur = $obj->code_compta_fournisseur;
2028 2028
 
@@ -2039,7 +2039,7 @@  discard block
 block discarded – undo
2039 2039
 					$this->vat_reverse_charge = 0;
2040 2040
 				}
2041 2041
 
2042
-				$this->status				= $obj->status;
2042
+				$this->status = $obj->status;
2043 2043
 
2044 2044
 				// Local Taxes
2045 2045
 				$this->localtax1_assuj      = $obj->localtax1_assuj;
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
 
2067 2067
 				$this->mode_reglement_id 	= $obj->mode_reglement;
2068 2068
 				$this->cond_reglement_id 	= $obj->cond_reglement;
2069
-				$this->deposit_percent		= $obj->deposit_percent;
2069
+				$this->deposit_percent = $obj->deposit_percent;
2070 2070
 				$this->transport_mode_id 	= $obj->transport_mode;
2071 2071
 				$this->mode_reglement_supplier_id 	= $obj->mode_reglement_supplier;
2072 2072
 				$this->cond_reglement_supplier_id 	= $obj->cond_reglement_supplier;
@@ -2598,10 +2598,10 @@  discard block
 block discarded – undo
2598 2598
 					$reparray[$i]['firstname'] = $obj->firstname;
2599 2599
 					$reparray[$i]['email'] = $obj->email;
2600 2600
 					$reparray[$i]['phone'] = $obj->office_phone;
2601
-					$reparray[$i]['office_phone'] = $obj->office_phone;			// Pro phone
2601
+					$reparray[$i]['office_phone'] = $obj->office_phone; // Pro phone
2602 2602
 					$reparray[$i]['office_fax'] = $obj->office_fax;
2603
-					$reparray[$i]['user_mobile'] = $obj->user_mobile;			// Pro mobile
2604
-					$reparray[$i]['personal_mobile'] = $obj->personal_mobile;	// Personal mobile
2603
+					$reparray[$i]['user_mobile'] = $obj->user_mobile; // Pro mobile
2604
+					$reparray[$i]['personal_mobile'] = $obj->personal_mobile; // Personal mobile
2605 2605
 					$reparray[$i]['job'] = $obj->job;
2606 2606
 					$reparray[$i]['statut'] = $obj->status; // deprecated
2607 2607
 					$reparray[$i]['status'] = $obj->status;
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
 			$datas['status'] = ' '.$this->getLibStatut(5);
2815 2815
 		}
2816 2816
 		if (isset($this->client) && isset($this->fournisseur)) {
2817
-			$datas['type'] = ' &nbsp; ' . $this->getTypeUrl(1);
2817
+			$datas['type'] = ' &nbsp; '.$this->getTypeUrl(1);
2818 2818
 		}
2819 2819
 		$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_escape_htmltag(dol_string_nohtmltag($this->name));
2820 2820
 		if (!empty($this->name_alias) && empty($noaliasinname)) {
@@ -2882,9 +2882,9 @@  discard block
 block discarded – undo
2882 2882
 		}
2883 2883
 		// show categories for this record only in ajax to not overload lists
2884 2884
 		if (!$nofetch && isModEnabled('category') && $this->client) {
2885
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2885
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2886 2886
 			$form = new Form($this->db);
2887
-			$datas['categories_customer'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
2887
+			$datas['categories_customer'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1);
2888 2888
 		}
2889 2889
 		if (!empty($this->code_fournisseur) && $this->fournisseur) {
2890 2890
 			$datas['suppliercode'] = '<br><b>'.$langs->trans('SupplierCode').':</b> '.$this->code_fournisseur;
@@ -2895,9 +2895,9 @@  discard block
 block discarded – undo
2895 2895
 		}
2896 2896
 		// show categories for this record only in ajax to not overload lists
2897 2897
 		if (!$nofetch && isModEnabled('category') && $this->fournisseur) {
2898
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
2898
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
2899 2899
 			$form = new Form($this->db);
2900
-			$datas['categories_supplier'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
2900
+			$datas['categories_supplier'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1);
2901 2901
 		}
2902 2902
 
2903 2903
 		$datas['divclose'] = '</div>';
@@ -3711,7 +3711,7 @@  discard block
 block discarded – undo
3711 3711
 		} else {
3712 3712
 			if ($type == 'customer') {
3713 3713
 				$this->code_compta_client = '';
3714
-				$this->code_compta = '';	// For backward compatibility
3714
+				$this->code_compta = ''; // For backward compatibility
3715 3715
 			} elseif ($type == 'supplier') {
3716 3716
 				$this->code_compta_fournisseur = '';
3717 3717
 			}
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
 		global $langs;
3804 3804
 
3805 3805
 		if ($company_id > 0) {
3806
-			$sql = "SELECT parent FROM " . MAIN_DB_PREFIX . "societe WHERE rowid = ".((int) $company_id);
3806
+			$sql = "SELECT parent FROM ".MAIN_DB_PREFIX."societe WHERE rowid = ".((int) $company_id);
3807 3807
 			$resql = $this->db->query($sql);
3808 3808
 			if ($resql) {
3809 3809
 				if ($obj = $this->db->fetch_object($resql)) {
@@ -4419,7 +4419,7 @@  discard block
 block discarded – undo
4419 4419
 		$country_code = $country_label = '';
4420 4420
 		if (getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY')) {
4421 4421
 			$tmp = explode(':', getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY'));
4422
-			$country_id =  (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4422
+			$country_id = (is_numeric($tmp[0])) ? (int) $tmp[0] : 0;
4423 4423
 			if (!empty($tmp[1])) {   // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label"
4424 4424
 				$country_code = $tmp[1];
4425 4425
 				$country_label = $tmp[2];
@@ -5294,7 +5294,7 @@  discard block
 block discarded – undo
5294 5294
 		if (method_exists($this, 'getLibStatut')) {
5295 5295
 			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
5296 5296
 		}
5297
-		$return .= '</div>';	// end info-box-content
5297
+		$return .= '</div>'; // end info-box-content
5298 5298
 		$return .= '</div>';
5299 5299
 		$return .= '</div>';
5300 5300
 
@@ -5398,7 +5398,7 @@  discard block
 block discarded – undo
5398 5398
 		global $conf, $langs, $hookmanager, $user, $action;
5399 5399
 
5400 5400
 		$error = 0;
5401
-		$soc_origin = new Societe($this->db);		// The thirdparty that we will delete
5401
+		$soc_origin = new Societe($this->db); // The thirdparty that we will delete
5402 5402
 
5403 5403
 		dol_syslog("mergeCompany merge thirdparty id=".$soc_origin_id." (will be deleted) into the thirdparty id=".$this->id);
5404 5404
 
Please login to merge, or discard this patch.
htdocs/compta/facture/class/facture.class.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 			$this->mode_reglement_id = 0;
504 504
 		}
505 505
 		$this->status = self::STATUS_DRAFT;
506
-		$this->statut = self::STATUS_DRAFT;	// deprecated
506
+		$this->statut = self::STATUS_DRAFT; // deprecated
507 507
 
508 508
 		if (!empty($this->multicurrency_code)) {
509 509
 			// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			if (!empty($_facrec->frequency)) {  // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarily when there is no recurrence.
575 575
 				$this->socid = $_facrec->socid;
576 576
 			}
577
-			$this->entity            = $_facrec->entity; // Invoice created in same entity than template
577
+			$this->entity = $_facrec->entity; // Invoice created in same entity than template
578 578
 
579 579
 			// Fields coming from GUI.
580 580
 			// @TODO Value of template should be used as default value on the form on the GUI, and we should here always use the value from GUI
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 				$this->mode_reglement_id = 0;
614 614
 			}
615 615
 			$this->status = self::STATUS_DRAFT;
616
-			$this->statut = self::STATUS_DRAFT;	// deprecated
616
+			$this->statut = self::STATUS_DRAFT; // deprecated
617 617
 
618 618
 			$this->linked_objects = $_facrec->linkedObjectsIds;
619 619
 			// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 						// Complete vat rate with code
861 861
 						$vatrate = $newinvoiceline->tva_tx;
862
-						if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
862
+						if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
863 863
 							$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
864 864
 						}
865 865
 
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 						($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '',
1080 1080
 						0,
1081 1081
 						$tva_npr,
1082
-						0,  // fk_remise_except
1082
+						0, // fk_remise_except
1083 1083
 						'HT',
1084 1084
 						0,
1085 1085
 						$_facrec->lines[$i]->product_type,
@@ -1092,8 +1092,8 @@  discard block
 block discarded – undo
1092 1092
 						$buyprice,
1093 1093
 						$_facrec->lines[$i]->label,
1094 1094
 						empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1095
-						100,	// situation percent is undefined on recurring invoice lines
1096
-						0,  // fk_prev_id
1095
+						100, // situation percent is undefined on recurring invoice lines
1096
+						0, // fk_prev_id
1097 1097
 						$_facrec->lines[$i]->fk_unit,
1098 1098
 						$_facrec->lines[$i]->multicurrency_subprice,
1099 1099
 						$_facrec->lines[$i]->ref_ext,
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
 		$facture->fk_facture_source = $this->fk_facture_source;
1187 1187
 		$facture->type 			    = $this->type;
1188
-		$facture->subtype 			= $this->subtype;
1188
+		$facture->subtype = $this->subtype;
1189 1189
 		$facture->socid 		    = $this->socid;
1190 1190
 		$facture->date              = $this->date;
1191 1191
 		$facture->date_pointoftax   = $this->date_pointoftax;
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 
1203 1203
 		$facture->origin            = $this->origin;
1204 1204
 		$facture->origin_id         = $this->origin_id;
1205
-		$facture->fk_account         = $this->fk_account;
1205
+		$facture->fk_account = $this->fk_account;
1206 1206
 
1207 1207
 		$facture->lines = $this->lines; // Array of lines of invoice
1208 1208
 		$facture->situation_counter = $this->situation_counter;
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 	{
1677 1677
 		global $conf, $langs, $hookmanager, $action;
1678 1678
 
1679
-		if (! in_array($origin->element, array('propal', 'commande'))) {
1679
+		if (!in_array($origin->element, array('propal', 'commande'))) {
1680 1680
 			$origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1681 1681
 			return null;
1682 1682
 		}
@@ -1686,7 +1686,7 @@  discard block
 block discarded – undo
1686 1686
 			return null;
1687 1687
 		}
1688 1688
 
1689
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
1689
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
1690 1690
 
1691 1691
 		if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + getDolGlobalInt('INVOICE_MAX_FUTURE_DELAY'))) {
1692 1692
 			$origin->error = 'ErrorDateIsInFuture';
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
 		$deposit->pos_source = $origin->pos_source;
1731 1731
 		$deposit->model_pdf = 'crabe';
1732 1732
 
1733
-		$modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type;
1733
+		$modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type;
1734 1734
 
1735 1735
 		if (getDolGlobalString($modelByTypeConfName)) {
1736 1736
 			$deposit->model_pdf = getDolGlobalString($modelByTypeConfName);
@@ -1790,10 +1790,10 @@  discard block
 block discarded – undo
1790 1790
 					$descriptions[$key] = '';
1791 1791
 				}
1792 1792
 				$TTotalByTva[$key] += $line->total_ttc;
1793
-				$descriptions[$key] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : '');
1794
-				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : '');
1795
-				$descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty;
1796
-				$descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>';
1793
+				$descriptions[$key] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : '');
1794
+				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label.' - ' : '');
1795
+				$descriptions[$key] .= $langs->trans('Qty').' : '.$line->qty;
1796
+				$descriptions[$key] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>';
1797 1797
 			}
1798 1798
 
1799 1799
 			foreach ($TTotalByTva as $tva => &$total) {
@@ -1817,10 +1817,10 @@  discard block
 block discarded – undo
1817 1817
 				$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1818 1818
 				$tva_tx = $lines[$i]->tva_tx;
1819 1819
 				$amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100;
1820
-				$descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : '');
1821
-				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : '');
1822
-				$descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty;
1823
-				$descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>';
1820
+				$descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : '');
1821
+				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : '');
1822
+				$descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty;
1823
+				$descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>';
1824 1824
 			}
1825 1825
 
1826 1826
 			if ($totalamount == 0) {
@@ -1835,11 +1835,11 @@  discard block
 block discarded – undo
1835 1835
 				continue;
1836 1836
 			}
1837 1837
 
1838
-			$descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref;
1838
+			$descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref;
1839 1839
 
1840 1840
 			// Hidden conf
1841 1841
 			if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) {
1842
-				$descline .= '<ul>' . $descriptions[$tva] . '</ul>';
1842
+				$descline .= '<ul>'.$descriptions[$tva].'</ul>';
1843 1843
 			}
1844 1844
 
1845 1845
 			$addlineResult = $deposit->addline(
@@ -2214,9 +2214,9 @@  discard block
 block discarded – undo
2214 2214
 				$this->id = $obj->rowid;
2215 2215
 				$this->entity = $obj->entity;
2216 2216
 
2217
-				$this->ref					= $obj->ref;
2218
-				$this->ref_client			= $obj->ref_client;
2219
-				$this->ref_customer			= $obj->ref_client;
2217
+				$this->ref = $obj->ref;
2218
+				$this->ref_client = $obj->ref_client;
2219
+				$this->ref_customer = $obj->ref_client;
2220 2220
 				$this->ref_ext				= $obj->ref_ext;
2221 2221
 				$this->type					= $obj->type;
2222 2222
 				$this->subtype				= $obj->subtype;
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 				$this->fk_project = $obj->fk_project;
2243 2243
 				$this->project = null; // Clear if another value was already set by fetch_projet
2244 2244
 
2245
-				$this->statut = $obj->status;	// deprecated
2245
+				$this->statut = $obj->status; // deprecated
2246 2246
 				$this->status = $obj->status;
2247 2247
 
2248 2248
 				$this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -2258,7 +2258,7 @@  discard block
 block discarded – undo
2258 2258
 				$this->fk_fac_rec_source	= $obj->fk_fac_rec_source;
2259 2259
 				$this->note = $obj->note_private; // deprecated
2260 2260
 				$this->note_private = $obj->note_private;
2261
-				$this->note_public			= $obj->note_public;
2261
+				$this->note_public = $obj->note_public;
2262 2262
 				$this->user_creation_id     = $obj->fk_user_author;
2263 2263
 				$this->user_validation_id   = $obj->fk_user_valid;
2264 2264
 				$this->user_modification_id = $obj->fk_user_modif;
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 				$line->ref              = $objp->product_ref; // Ref product
2373 2373
 				$line->product_ref      = $objp->product_ref; // Ref product
2374 2374
 				$line->libelle          = $objp->product_label; // deprecated
2375
-				$line->product_label 	= $objp->product_label; // Label product
2375
+				$line->product_label = $objp->product_label; // Label product
2376 2376
 				$line->product_barcode  = $objp->product_barcode; // Barcode number product
2377 2377
 				$line->product_desc     = $objp->product_desc; // Description product
2378 2378
 				$line->fk_product_type  = $objp->fk_product_type; // Type of product
@@ -3246,10 +3246,10 @@  discard block
 block discarded – undo
3246 3246
 		if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer'))
3247 3247
 		|| (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
3248 3248
 			$this->error = 'Permission denied';
3249
-			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3249
+			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3250 3250
 			return -1;
3251 3251
 		}
3252
-		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&	// empty should not happened, but when it occurs, the test save life
3252
+		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3253 3253
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')						// If option enabled, we force invoice date
3254 3254
 		) {
3255 3255
 			$this->date = dol_now();
@@ -3609,7 +3609,7 @@  discard block
 block discarded – undo
3609 3609
 			// Set new ref and define current status
3610 3610
 			if (!$error) {
3611 3611
 				$this->ref = $num;
3612
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
3612
+				$this->statut = self::STATUS_VALIDATED; // deprecated
3613 3613
 				$this->status = self::STATUS_VALIDATED;
3614 3614
 				$this->date_validation = $now;
3615 3615
 				$i = 0;
@@ -3764,7 +3764,7 @@  discard block
 block discarded – undo
3764 3764
 
3765 3765
 			if ($error == 0) {
3766 3766
 				$old_statut = $this->status;
3767
-				$this->statut = self::STATUS_DRAFT;	// deprecated
3767
+				$this->statut = self::STATUS_DRAFT; // deprecated
3768 3768
 				$this->status = self::STATUS_DRAFT;
3769 3769
 
3770 3770
 				// Call trigger
@@ -4668,7 +4668,7 @@  discard block
 block discarded – undo
4668 4668
 		}
4669 4669
 
4670 4670
 		if (!empty($addon)) {
4671
-			dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4671
+			dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
4672 4672
 
4673 4673
 			$mybool = false;
4674 4674
 
@@ -5747,14 +5747,14 @@  discard block
 block discarded – undo
5747 5747
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5748 5748
 			$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
5749 5749
 		}
5750
-		$sql .= " WHERE f.paye = 0";	// Only unpaid
5751
-		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;	// Only validated status
5750
+		$sql .= " WHERE f.paye = 0"; // Only unpaid
5751
+		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
5752 5752
 		if ($datetouse == 'invoicedate') {
5753 5753
 			$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
5754 5754
 		} else {
5755 5755
 			$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
5756 5756
 		}
5757
-		$sql .= " AND f.entity IN (".getEntity('facture', 0).")";	// One batch process only one company (no sharing)
5757
+		$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
5758 5758
 		if (!empty($paymentmode) && $paymentmode != 'all') {
5759 5759
 			$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
5760 5760
 		}
@@ -5972,7 +5972,7 @@  discard block
 block discarded – undo
5972 5972
 								$actioncomm->create($user);
5973 5973
 							}
5974 5974
 
5975
-							$this->db->commit();	// We always commit
5975
+							$this->db->commit(); // We always commit
5976 5976
 						}
5977 5977
 
5978 5978
 						if ($errormesg) {
@@ -6014,7 +6014,7 @@  discard block
 block discarded – undo
6014 6014
 		// get date of last validated invoices of same type
6015 6015
 		$sql  = "SELECT datef";
6016 6016
 		$sql .= " FROM ".MAIN_DB_PREFIX."facture";
6017
-		$sql .= " WHERE type = " . (int) $this->type ;
6017
+		$sql .= " WHERE type = ".(int) $this->type;
6018 6018
 		$sql .= " AND date_valid IS NOT NULL";
6019 6019
 		$sql .= " AND entity IN (".getEntity('invoice').")";
6020 6020
 		$sql .= " ORDER BY datef DESC LIMIT 1";
@@ -6272,7 +6272,7 @@  discard block
 block discarded – undo
6272 6272
 			$objp = $this->db->fetch_object($result);
6273 6273
 
6274 6274
 			if (!$objp) {
6275
-				$this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql;
6275
+				$this->error = 'InvoiceLine with id '.$rowid.' not found sql='.$sql;
6276 6276
 				return 0;
6277 6277
 			}
6278 6278
 
@@ -6303,7 +6303,7 @@  discard block
 block discarded – undo
6303 6303
 			$this->total_localtax1		= $objp->total_localtax1;
6304 6304
 			$this->total_localtax2		= $objp->total_localtax2;
6305 6305
 			$this->total_ttc			= $objp->total_ttc;
6306
-			$this->fk_code_ventilation  = $objp->fk_code_ventilation;
6306
+			$this->fk_code_ventilation = $objp->fk_code_ventilation;
6307 6307
 			$this->rang					= $objp->rang;
6308 6308
 			$this->fk_fournprice = $objp->fk_fournprice;
6309 6309
 			$marginInfos				= getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
@@ -6694,7 +6694,7 @@  discard block
 block discarded – undo
6694 6694
 		$sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
6695 6695
 		$sql .= ", product_type=".$this->product_type;
6696 6696
 		$sql .= ", info_bits='".$this->db->escape($this->info_bits)."'";
6697
-		$sql .= ", special_code=" . (int) $this->special_code;
6697
+		$sql .= ", special_code=".(int) $this->special_code;
6698 6698
 		if (empty($this->skip_update_total)) {
6699 6699
 			$sql .= ", total_ht=".price2num($this->total_ht);
6700 6700
 			$sql .= ", total_tva=".price2num($this->total_tva);
Please login to merge, or discard this patch.