Completed
Branch develop (2dd6cc)
by
unknown
26:03
created
htdocs/salaries/card.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 			// Create a line of payments
315 315
 			$paiement = new PaymentSalary($db);
316 316
 			$paiement->fk_salary    = $object->id;
317
-			$paiement->chid         = $object->id;	// deprecated
317
+			$paiement->chid         = $object->id; // deprecated
318 318
 			$paiement->datep        = $datep;
319
-			$paiement->datev		= $datev;
319
+			$paiement->datev = $datev;
320 320
 			$paiement->amounts      = array($object->id => $amount); // Tableau de montant
321 321
 			$paiement->fk_typepayment = $type_payment;
322 322
 			$paiement->num_payment  = GETPOST("num_payment", 'alphanohtml');
@@ -345,10 +345,10 @@  discard block
 block discarded – undo
345 345
 
346 346
 			if (GETPOST('saveandnew', 'alpha')) {
347 347
 				setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
348
-				header("Location: card.php?action=create&fk_project=" . urlencode((string) ($projectid)) . "&accountid=" . urlencode((string) ($accountid)) . '&paymenttype=' . urlencode((string) (GETPOSTINT('paymenttype'))) . '&datepday=' . GETPOSTINT("datepday") . '&datepmonth=' . GETPOSTINT("datepmonth") . '&datepyear=' . GETPOSTINT("datepyear"));
348
+				header("Location: card.php?action=create&fk_project=".urlencode((string) ($projectid))."&accountid=".urlencode((string) ($accountid)).'&paymenttype='.urlencode((string) (GETPOSTINT('paymenttype'))).'&datepday='.GETPOSTINT("datepday").'&datepmonth='.GETPOSTINT("datepmonth").'&datepyear='.GETPOSTINT("datepyear"));
349 349
 				exit;
350 350
 			} else {
351
-				header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id);
351
+				header("Location: ".$_SERVER['PHP_SELF'].'?id='.$object->id);
352 352
 				exit;
353 353
 			}
354 354
 		} else {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 
639 639
 	// Auto create payment
640 640
 	print '<tr><td><label for="auto_create_paiement">'.$langs->trans('AutomaticCreationPayment').'</label></td>';
641
-	print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_paiement) ? '' : 'checked="checked"') . ' value="1"></td></tr>'."\n";	// Date payment
641
+	print '<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" '.(empty($auto_create_paiement) ? '' : 'checked="checked"').' value="1"></td></tr>'."\n"; // Date payment
642 642
 
643 643
 	// Bank
644 644
 	if (isModEnabled("bank")) {
@@ -906,10 +906,10 @@  discard block
 block discarded – undo
906 906
 			$userstatic = new User($db);
907 907
 			$result = $userstatic->fetch($object->fk_user);
908 908
 			if ($result > 0) {
909
-				$morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1);
909
+				$morehtmlref .= '<br>'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1);
910 910
 			}
911 911
 		} else {
912
-			$morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $permissiontoadd, 'string', '', 0, 1);
912
+			$morehtmlref .= '<br>'.$form->editfieldkey("Employee", 'fk_user', $object->label, $object, $permissiontoadd, 'string', '', 0, 1);
913 913
 
914 914
 			if (!empty($object->fk_user)) {
915 915
 				$userstatic = new User($db);
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 		print "</td></tr>";
977 977
 	} else {
978 978
 		print "<tr>";
979
-		print '<td class="titlefieldmiddle">' . $langs->trans("DateStartPeriod") . '</td><td>';
979
+		print '<td class="titlefieldmiddle">'.$langs->trans("DateStartPeriod").'</td><td>';
980 980
 		print dol_print_date($object->datesp, 'day');
981 981
 		print '</td></tr>';
982 982
 	}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 		print "</td></tr>";
988 988
 	} else {
989 989
 		print "<tr>";
990
-		print '<td>' . $langs->trans("DateEndPeriod") . '</td><td>';
990
+		print '<td>'.$langs->trans("DateEndPeriod").'</td><td>';
991 991
 		print dol_print_date($object->dateep, 'day');
992 992
 		print '</td></tr>';
993 993
 	}
@@ -1002,9 +1002,9 @@  discard block
 block discarded – undo
1002 1002
 	print '</td></tr>';*/
1003 1003
 
1004 1004
 	if ($action == 'edit') {
1005
-		print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount) . '"></td></tr>';
1005
+		print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.price($object->amount).'"></td></tr>';
1006 1006
 	} else {
1007
-		print '<tr><td>' . $langs->trans("Amount") . '</td><td><span class="amount">' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '</span></td></tr>';
1007
+		print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span></td></tr>';
1008 1008
 	}
1009 1009
 
1010 1010
 	// Default mode of payment
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 			if (empty($user->socid)) {
1191 1191
 				$canSendMail = true;
1192 1192
 
1193
-				print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', $canSendMail);
1193
+				print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', $canSendMail);
1194 1194
 			}
1195 1195
 		}
1196 1196
 
@@ -1206,12 +1206,12 @@  discard block
 block discarded – undo
1206 1206
 
1207 1207
 		// Transfer request
1208 1208
 		if ($object->status == $object::STATUS_UNPAID && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) {
1209
-			print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT . '/salaries/virement_request.php?id=' . $object->id, '');
1209
+			print dolGetButtonAction('', $langs->trans('MakeTransferRequest'), 'default', DOL_URL_ROOT.'/salaries/virement_request.php?id='.$object->id, '');
1210 1210
 		}
1211 1211
 
1212 1212
 		// Emit payment
1213 1213
 		if ($object->status == $object::STATUS_UNPAID && ((price2num($object->amount) < 0 && $resteapayer < 0) || (price2num($object->amount) > 0 && $resteapayer > 0)) && $permissiontoadd) {
1214
-			print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='. $object->id, '');
1214
+			print dolGetButtonAction('', $langs->trans('DoPayment'), 'default', DOL_URL_ROOT.'/salaries/paiement_salary.php?action=create&token='.newToken().'&id='.$object->id, '');
1215 1215
 		}
1216 1216
 
1217 1217
 		// Classify 'paid'
Please login to merge, or discard this patch.
htdocs/includes/OAuth/Common/Http/Client/CurlClient.php 1 patch
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -10,142 +10,142 @@
 block discarded – undo
10 10
  */
11 11
 class CurlClient extends AbstractClient
12 12
 {
13
-    /**
14
-     * If true, explicitly sets cURL to use SSL version 3. Use this if cURL
15
-     * compiles with GnuTLS SSL.
16
-     *
17
-     * @var bool
18
-     */
19
-    private $forceSSL3 = false;
20
-
21
-    /**
22
-     * Additional parameters (as `key => value` pairs) to be passed to `curl_setopt`
23
-     *
24
-     * @var array
25
-     */
26
-    private $parameters = array();
27
-
28
-    /**
29
-     * Additional `curl_setopt` parameters
30
-     *
31
-     * @param array $parameters
32
-     */
33
-    public function setCurlParameters(array $parameters)
34
-    {
35
-        $this->parameters = $parameters;
36
-    }
37
-
38
-    /**
39
-     * @param bool $force
40
-     *
41
-     * @return CurlClient
42
-     */
43
-    public function setForceSSL3($force)
44
-    {
45
-        $this->forceSSL3 = $force;
46
-
47
-        return $this;
48
-    }
49
-
50
-    /**
51
-     * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
52
-     * They should return, in string form, the response body and throw an exception on error.
53
-     *
54
-     * @param UriInterface $endpoint
55
-     * @param mixed        $requestBody
56
-     * @param array        $extraHeaders
57
-     * @param string       $method
58
-     *
59
-     * @return string
60
-     *
61
-     * @throws TokenResponseException
62
-     * @throws \InvalidArgumentException
63
-     */
64
-    public function retrieveResponse(
65
-        UriInterface $endpoint,
66
-        $requestBody,
67
-        array $extraHeaders = array(),
68
-        $method = 'POST'
69
-    ) {
70
-        // Normalize method name
71
-        $method = strtoupper($method);
72
-
73
-        $extraHeaders = $this->normalizeHeaders($extraHeaders);
74
-
75
-        if ($method === 'GET' && !empty($requestBody)) {
76
-            throw new \InvalidArgumentException('No body expected for "GET" request.');
77
-        }
78
-
79
-        if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
80
-            $extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
81
-        }
82
-
83
-        $extraHeaders['Host']       = 'Host: '.$endpoint->getHost();
84
-        $extraHeaders['Connection'] = 'Connection: close';
85
-
86
-        $ch = curl_init();
87
-
88
-        curl_setopt($ch, CURLOPT_URL, $endpoint->getAbsoluteUri());
89
-
90
-        if ($method === 'POST' || $method === 'PUT') {
91
-            if ($requestBody && is_array($requestBody)) {
92
-                $requestBody = http_build_query($requestBody, '', '&');
93
-            }
94
-
95
-            if ($method === 'PUT') {
96
-                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
97
-            } else {
98
-                curl_setopt($ch, CURLOPT_POST, true);
99
-            }
100
-
101
-            curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
102
-        } else {
103
-            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
104
-        }
105
-
106
-        if ($this->maxRedirects > 0) {
107
-            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
108
-            curl_setopt($ch, CURLOPT_MAXREDIRS, $this->maxRedirects);
109
-        }
110
-
111
-        curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
112
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
113
-        curl_setopt($ch, CURLOPT_HEADER, false);
114
-        curl_setopt($ch, CURLOPT_HTTPHEADER, $extraHeaders);
115
-        curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
116
-
117
-        foreach ($this->parameters as $key => $value) {
118
-            curl_setopt($ch, $key, $value);
119
-        }
120
-
121
-        if ($this->forceSSL3) {
122
-            curl_setopt($ch, CURLOPT_SSLVERSION, 3);
123
-        }
124
-
125
-        // @CHANGE DOL_LDR Add log
126
-        if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
127
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
128
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
129
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
130
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
131
-        	@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
132
-        }
133
-
134
-        $response     = curl_exec($ch);
135
-        $responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
136
-
137
-        if (false === $response) {
138
-            $errNo  = curl_errno($ch);
139
-            $errStr = curl_error($ch);
140
-            curl_close($ch);
141
-            if (empty($errStr)) {
142
-                throw new TokenResponseException('Failed to request resource.', $responseCode);
143
-            }
144
-            throw new TokenResponseException('cURL Error # '.$errNo.': '.$errStr, $responseCode);
145
-        }
146
-
147
-        curl_close($ch);
148
-
149
-        return $response;
150
-    }
13
+	/**
14
+	 * If true, explicitly sets cURL to use SSL version 3. Use this if cURL
15
+	 * compiles with GnuTLS SSL.
16
+	 *
17
+	 * @var bool
18
+	 */
19
+	private $forceSSL3 = false;
20
+
21
+	/**
22
+	 * Additional parameters (as `key => value` pairs) to be passed to `curl_setopt`
23
+	 *
24
+	 * @var array
25
+	 */
26
+	private $parameters = array();
27
+
28
+	/**
29
+	 * Additional `curl_setopt` parameters
30
+	 *
31
+	 * @param array $parameters
32
+	 */
33
+	public function setCurlParameters(array $parameters)
34
+	{
35
+		$this->parameters = $parameters;
36
+	}
37
+
38
+	/**
39
+	 * @param bool $force
40
+	 *
41
+	 * @return CurlClient
42
+	 */
43
+	public function setForceSSL3($force)
44
+	{
45
+		$this->forceSSL3 = $force;
46
+
47
+		return $this;
48
+	}
49
+
50
+	/**
51
+	 * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
52
+	 * They should return, in string form, the response body and throw an exception on error.
53
+	 *
54
+	 * @param UriInterface $endpoint
55
+	 * @param mixed        $requestBody
56
+	 * @param array        $extraHeaders
57
+	 * @param string       $method
58
+	 *
59
+	 * @return string
60
+	 *
61
+	 * @throws TokenResponseException
62
+	 * @throws \InvalidArgumentException
63
+	 */
64
+	public function retrieveResponse(
65
+		UriInterface $endpoint,
66
+		$requestBody,
67
+		array $extraHeaders = array(),
68
+		$method = 'POST'
69
+	) {
70
+		// Normalize method name
71
+		$method = strtoupper($method);
72
+
73
+		$extraHeaders = $this->normalizeHeaders($extraHeaders);
74
+
75
+		if ($method === 'GET' && !empty($requestBody)) {
76
+			throw new \InvalidArgumentException('No body expected for "GET" request.');
77
+		}
78
+
79
+		if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
80
+			$extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
81
+		}
82
+
83
+		$extraHeaders['Host']       = 'Host: '.$endpoint->getHost();
84
+		$extraHeaders['Connection'] = 'Connection: close';
85
+
86
+		$ch = curl_init();
87
+
88
+		curl_setopt($ch, CURLOPT_URL, $endpoint->getAbsoluteUri());
89
+
90
+		if ($method === 'POST' || $method === 'PUT') {
91
+			if ($requestBody && is_array($requestBody)) {
92
+				$requestBody = http_build_query($requestBody, '', '&');
93
+			}
94
+
95
+			if ($method === 'PUT') {
96
+				curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
97
+			} else {
98
+				curl_setopt($ch, CURLOPT_POST, true);
99
+			}
100
+
101
+			curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
102
+		} else {
103
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
104
+		}
105
+
106
+		if ($this->maxRedirects > 0) {
107
+			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
108
+			curl_setopt($ch, CURLOPT_MAXREDIRS, $this->maxRedirects);
109
+		}
110
+
111
+		curl_setopt($ch, CURLOPT_TIMEOUT, $this->timeout);
112
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
113
+		curl_setopt($ch, CURLOPT_HEADER, false);
114
+		curl_setopt($ch, CURLOPT_HTTPHEADER, $extraHeaders);
115
+		curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent);
116
+
117
+		foreach ($this->parameters as $key => $value) {
118
+			curl_setopt($ch, $key, $value);
119
+		}
120
+
121
+		if ($this->forceSSL3) {
122
+			curl_setopt($ch, CURLOPT_SSLVERSION, 3);
123
+		}
124
+
125
+		// @CHANGE DOL_LDR Add log
126
+		if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
127
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
128
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
129
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
130
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
131
+			@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
132
+		}
133
+
134
+		$response     = curl_exec($ch);
135
+		$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
136
+
137
+		if (false === $response) {
138
+			$errNo  = curl_errno($ch);
139
+			$errStr = curl_error($ch);
140
+			curl_close($ch);
141
+			if (empty($errStr)) {
142
+				throw new TokenResponseException('Failed to request resource.', $responseCode);
143
+			}
144
+			throw new TokenResponseException('cURL Error # '.$errNo.': '.$errStr, $responseCode);
145
+		}
146
+
147
+		curl_close($ch);
148
+
149
+		return $response;
150
+	}
151 151
 }
Please login to merge, or discard this patch.
htdocs/includes/OAuth/Common/Http/Client/StreamClient.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -10,96 +10,96 @@
 block discarded – undo
10 10
  */
11 11
 class StreamClient extends AbstractClient
12 12
 {
13
-    /**
14
-     * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
15
-     * They should return, in string form, the response body and throw an exception on error.
16
-     *
17
-     * @param UriInterface $endpoint
18
-     * @param mixed        $requestBody
19
-     * @param array        $extraHeaders
20
-     * @param string       $method
21
-     *
22
-     * @return string
23
-     *
24
-     * @throws TokenResponseException
25
-     * @throws \InvalidArgumentException
26
-     */
27
-    public function retrieveResponse(
28
-        UriInterface $endpoint,
29
-        $requestBody,
30
-        array $extraHeaders = array(),
31
-        $method = 'POST'
32
-    ) {
33
-        // Normalize method name
34
-        $method = strtoupper($method);
13
+	/**
14
+	 * Any implementing HTTP providers should send a request to the provided endpoint with the parameters.
15
+	 * They should return, in string form, the response body and throw an exception on error.
16
+	 *
17
+	 * @param UriInterface $endpoint
18
+	 * @param mixed        $requestBody
19
+	 * @param array        $extraHeaders
20
+	 * @param string       $method
21
+	 *
22
+	 * @return string
23
+	 *
24
+	 * @throws TokenResponseException
25
+	 * @throws \InvalidArgumentException
26
+	 */
27
+	public function retrieveResponse(
28
+		UriInterface $endpoint,
29
+		$requestBody,
30
+		array $extraHeaders = array(),
31
+		$method = 'POST'
32
+	) {
33
+		// Normalize method name
34
+		$method = strtoupper($method);
35 35
 
36
-        $extraHeaders = $this->normalizeHeaders($extraHeaders);
36
+		$extraHeaders = $this->normalizeHeaders($extraHeaders);
37 37
 
38
-        if ($method === 'GET' && !empty($requestBody)) {
39
-            throw new \InvalidArgumentException('No body expected for "GET" request.');
40
-        }
38
+		if ($method === 'GET' && !empty($requestBody)) {
39
+			throw new \InvalidArgumentException('No body expected for "GET" request.');
40
+		}
41 41
 
42
-        if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
43
-            $extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
44
-        }
42
+		if (!isset($extraHeaders['Content-Type']) && $method === 'POST' && is_array($requestBody)) {
43
+			$extraHeaders['Content-Type'] = 'Content-Type: application/x-www-form-urlencoded';
44
+		}
45 45
 
46
-        $host = 'Host: '.$endpoint->getHost();
47
-        // Append port to Host if it has been specified
48
-        if ($endpoint->hasExplicitPortSpecified()) {
49
-            $host .= ':'.$endpoint->getPort();
50
-        }
46
+		$host = 'Host: '.$endpoint->getHost();
47
+		// Append port to Host if it has been specified
48
+		if ($endpoint->hasExplicitPortSpecified()) {
49
+			$host .= ':'.$endpoint->getPort();
50
+		}
51 51
 
52
-        $extraHeaders['Host']       = $host;
53
-        $extraHeaders['Connection'] = 'Connection: close';
52
+		$extraHeaders['Host']       = $host;
53
+		$extraHeaders['Connection'] = 'Connection: close';
54 54
 
55
-        if (is_array($requestBody)) {
56
-            $requestBody = http_build_query($requestBody, '', '&');
57
-        }
58
-        $extraHeaders['Content-length'] = 'Content-length: '.strlen($requestBody);
55
+		if (is_array($requestBody)) {
56
+			$requestBody = http_build_query($requestBody, '', '&');
57
+		}
58
+		$extraHeaders['Content-length'] = 'Content-length: '.strlen($requestBody);
59 59
 
60
-        //var_dump($requestBody); var_dump($extraHeaders);var_dump($method);exit;
61
-        $context = $this->generateStreamContext($requestBody, $extraHeaders, $method);
60
+		//var_dump($requestBody); var_dump($extraHeaders);var_dump($method);exit;
61
+		$context = $this->generateStreamContext($requestBody, $extraHeaders, $method);
62 62
 
63 63
 		// @CHANGE DOL_LDR Add log
64
-        if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
65
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
66
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
67
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
68
-        	file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
69
-        	@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
70
-        }
64
+		if (function_exists('getDolGlobalString') && getDolGlobalString('OAUTH_DEBUG')) {
65
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $endpoint->getAbsoluteUri()."\n", FILE_APPEND);
66
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $requestBody."\n", FILE_APPEND);
67
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", $method."\n", FILE_APPEND);
68
+			file_put_contents(DOL_DATA_ROOT . "/dolibarr_oauth.log", var_export($extraHeaders, true)."\n", FILE_APPEND);
69
+			@chmod(DOL_DATA_ROOT . "/dolibarr_oauth.log", octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
70
+		}
71 71
 
72
-        $level = error_reporting(0);
73
-        $response = file_get_contents($endpoint->getAbsoluteUri(), false, $context);
74
-        error_reporting($level);
75
-        if (false === $response) {
76
-            $lastError = error_get_last();
77
-            if (is_null($lastError)) {
78
-                throw new TokenResponseException(
79
-                    'Failed to request resource. HTTP Code: ' .
80
-                    ((isset($http_response_header[0]))?$http_response_header[0]:'No response')
81
-                );
82
-            }
83
-            throw new TokenResponseException($lastError['message']);
84
-        }
72
+		$level = error_reporting(0);
73
+		$response = file_get_contents($endpoint->getAbsoluteUri(), false, $context);
74
+		error_reporting($level);
75
+		if (false === $response) {
76
+			$lastError = error_get_last();
77
+			if (is_null($lastError)) {
78
+				throw new TokenResponseException(
79
+					'Failed to request resource. HTTP Code: ' .
80
+					((isset($http_response_header[0]))?$http_response_header[0]:'No response')
81
+				);
82
+			}
83
+			throw new TokenResponseException($lastError['message']);
84
+		}
85 85
 
86
-        return $response;
87
-    }
86
+		return $response;
87
+	}
88 88
 
89
-    private function generateStreamContext($body, $headers, $method)
90
-    {
91
-        return stream_context_create(
92
-            array(
93
-                'http' => array(
94
-                    'method'           => $method,
95
-                    'header'           => implode("\r\n", array_values($headers)),
96
-                    'content'          => $body,
97
-                    'protocol_version' => '1.1',
98
-                    'user_agent'       => $this->userAgent,
99
-                    'max_redirects'    => $this->maxRedirects,
100
-                    'timeout'          => $this->timeout
101
-                ),
102
-            )
103
-        );
104
-    }
89
+	private function generateStreamContext($body, $headers, $method)
90
+	{
91
+		return stream_context_create(
92
+			array(
93
+				'http' => array(
94
+					'method'           => $method,
95
+					'header'           => implode("\r\n", array_values($headers)),
96
+					'content'          => $body,
97
+					'protocol_version' => '1.1',
98
+					'user_agent'       => $this->userAgent,
99
+					'max_redirects'    => $this->maxRedirects,
100
+					'timeout'          => $this->timeout
101
+				),
102
+			)
103
+		);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
htdocs/includes/OAuth/Common/Http/Client/AbstractClient.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,66 +7,66 @@
 block discarded – undo
7 7
  */
8 8
 abstract class AbstractClient implements ClientInterface
9 9
 {
10
-    /**
11
-     * @var string The user agent string passed to services
12
-     */
13
-    protected $userAgent;
10
+	/**
11
+	 * @var string The user agent string passed to services
12
+	 */
13
+	protected $userAgent;
14 14
 
15
-    /**
16
-     * @var int The maximum number of redirects
17
-     */
18
-    protected $maxRedirects = 5;
15
+	/**
16
+	 * @var int The maximum number of redirects
17
+	 */
18
+	protected $maxRedirects = 5;
19 19
 
20
-    /**
21
-     * @var int The maximum timeout
22
-     */
23
-    protected $timeout = 15;
20
+	/**
21
+	 * @var int The maximum timeout
22
+	 */
23
+	protected $timeout = 15;
24 24
 
25
-    /**
26
-     * Creates instance
27
-     *
28
-     * @param string $userAgent The UA string the client will use
29
-     */
30
-    public function __construct($userAgent = 'PHPoAuthLib')
31
-    {
32
-        $this->userAgent = $userAgent;
33
-    }
25
+	/**
26
+	 * Creates instance
27
+	 *
28
+	 * @param string $userAgent The UA string the client will use
29
+	 */
30
+	public function __construct($userAgent = 'PHPoAuthLib')
31
+	{
32
+		$this->userAgent = $userAgent;
33
+	}
34 34
 
35
-    /**
36
-     * @param int $redirects Maximum redirects for client
37
-     *
38
-     * @return ClientInterface
39
-     */
40
-    public function setMaxRedirects($redirects)
41
-    {
42
-        $this->maxRedirects = $redirects;
35
+	/**
36
+	 * @param int $redirects Maximum redirects for client
37
+	 *
38
+	 * @return ClientInterface
39
+	 */
40
+	public function setMaxRedirects($redirects)
41
+	{
42
+		$this->maxRedirects = $redirects;
43 43
 
44
-        return $this;
45
-    }
44
+		return $this;
45
+	}
46 46
 
47
-    /**
48
-     * @param int $timeout Request timeout time for client in seconds
49
-     *
50
-     * @return ClientInterface
51
-     */
52
-    public function setTimeout($timeout)
53
-    {
54
-        $this->timeout = $timeout;
47
+	/**
48
+	 * @param int $timeout Request timeout time for client in seconds
49
+	 *
50
+	 * @return ClientInterface
51
+	 */
52
+	public function setTimeout($timeout)
53
+	{
54
+		$this->timeout = $timeout;
55 55
 
56
-        return $this;
57
-    }
56
+		return $this;
57
+	}
58 58
 
59
-    /**
60
-     * @param array $headers
61
-     */
62
-    public function normalizeHeaders($headers)
63
-    {
64
-        $normalizeHeaders = [];
65
-        foreach ($headers as $key => $val) {
66
-            $val = ucfirst(strtolower($key)) . ': ' . $val;
67
-            $normalizeHeaders[$key] = $val;
68
-        }
59
+	/**
60
+	 * @param array $headers
61
+	 */
62
+	public function normalizeHeaders($headers)
63
+	{
64
+		$normalizeHeaders = [];
65
+		foreach ($headers as $key => $val) {
66
+			$val = ucfirst(strtolower($key)) . ': ' . $val;
67
+			$normalizeHeaders[$key] = $val;
68
+		}
69 69
 
70
-        return $normalizeHeaders;
71
-    }
70
+		return $normalizeHeaders;
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     {
64 64
         $normalizeHeaders = [];
65 65
         foreach ($headers as $key => $val) {
66
-            $val = ucfirst(strtolower($key)) . ': ' . $val;
66
+            $val = ucfirst(strtolower($key)).': '.$val;
67 67
             $normalizeHeaders[$key] = $val;
68 68
         }
69 69
 
Please login to merge, or discard this patch.
htdocs/categories/class/categorie.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
 class Categorie extends CommonObject
51 51
 {
52 52
 	// Categories types (we use string because we want to accept any modules/types in a future)
53
-	const TYPE_PRODUCT				= 'product';
53
+	const TYPE_PRODUCT = 'product';
54 54
 	const TYPE_SUPPLIER				= 'supplier';
55 55
 	const TYPE_CUSTOMER				= 'customer';
56
-	const TYPE_MEMBER				= 'member';
56
+	const TYPE_MEMBER = 'member';
57 57
 	const TYPE_CONTACT				= 'contact';
58
-	const TYPE_USER					= 'user';
58
+	const TYPE_USER = 'user';
59 59
 	const TYPE_PROJECT				= 'project';
60 60
 	const TYPE_ACCOUNT				= 'bank_account';
61 61
 	const TYPE_BANK_LINE			= 'bank_line';
62 62
 	const TYPE_WAREHOUSE			= 'warehouse';
63
-	const TYPE_ACTIONCOMM			= 'actioncomm';
64
-	const TYPE_WEBSITE_PAGE			= 'website_page';
65
-	const TYPE_TICKET				= 'ticket';
66
-	const TYPE_KNOWLEDGEMANAGEMENT	= 'knowledgemanagement';
67
-	const TYPE_FICHINTER			= 'fichinter';
68
-	const TYPE_ORDER				= 'order';
69
-	const TYPE_INVOICE				= 'invoice';
70
-	const TYPE_SUPPLIER_ORDER		= 'supplier_order';
71
-	const TYPE_SUPPLIER_INVOICE		= 'supplier_invoice';
63
+	const TYPE_ACTIONCOMM = 'actioncomm';
64
+	const TYPE_WEBSITE_PAGE = 'website_page';
65
+	const TYPE_TICKET = 'ticket';
66
+	const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement';
67
+	const TYPE_FICHINTER = 'fichinter';
68
+	const TYPE_ORDER = 'order';
69
+	const TYPE_INVOICE = 'invoice';
70
+	const TYPE_SUPPLIER_ORDER = 'supplier_order';
71
+	const TYPE_SUPPLIER_INVOICE = 'supplier_invoice';
72 72
 
73 73
 
74 74
 	/**
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 			'categorie_contact' => 'fk_categorie',
758 758
 			'categorie_fournisseur' => 'fk_categorie',
759 759
 			'categorie_knowledgemanagement' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('knowledgemanagement')),
760
-			'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => false ),  // not yet fully implemented (wait 22) isModEnabled('intervention')),
760
+			'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => false), // not yet fully implemented (wait 22) isModEnabled('intervention')),
761 761
 			'categorie_member' => 'fk_categorie',
762 762
 			'categorie_user' => 'fk_categorie',
763 763
 			'categorie_product' => 'fk_categorie',
@@ -1359,14 +1359,14 @@  discard block
 block discarded – undo
1359 1359
 					|| preg_match('/'.$keyfilter3.'/', $fullpath) || preg_match('/'.$keyfilter4.'/', $fullpath));
1360 1360
 
1361 1361
 				if (($test && !$include) || (!$test && $include)) {
1362
-					unset($this->cats[$key]);  // @phpstan-ignore-line
1362
+					unset($this->cats[$key]); // @phpstan-ignore-line
1363 1363
 				}
1364 1364
 			}
1365 1365
 		}
1366 1366
 
1367 1367
 		dol_syslog(get_class($this)."::get_full_arbo dol_sort_array", LOG_DEBUG);
1368 1368
 
1369
-		$this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0, 1);		// Sort on full label like "Label 1 >> Sublabel a >> Subsublabel"
1369
+		$this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0, 1); // Sort on full label like "Label 1 >> Sublabel a >> Subsublabel"
1370 1370
 
1371 1371
 		return $this->cats;
1372 1372
 	}
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 		$parents = $this->get_meres();
1625 1625
 		if (is_array($parents)) {
1626 1626
 			foreach ($parents as $parent) {
1627
-				$all_ways = $parent->get_all_ways();	// recursivity. TODO Add a protection for infinite loop
1627
+				$all_ways = $parent->get_all_ways(); // recursivity. TODO Add a protection for infinite loop
1628 1628
 				foreach ($all_ways as $way) {
1629 1629
 					$w = $way;
1630 1630
 					$w[] = $this;
@@ -1784,10 +1784,10 @@  discard block
 block discarded – undo
1784 1784
 	 */
1785 1785
 	public function isAnyPhotoAvailable($sdir)
1786 1786
 	{
1787
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
1788
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
1787
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
1788
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
1789 1789
 
1790
-		$sdir .= '/' . get_exdir($this->id, 2, 0, 0, $this, 'category') . $this->id . "/photos/";
1790
+		$sdir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'category').$this->id."/photos/";
1791 1791
 
1792 1792
 		$dir_osencoded = dol_osencode($sdir);
1793 1793
 		if (file_exists($dir_osencoded)) {
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 					if (!utf8_check($file)) {
1798 1798
 						$file = mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1'); // To be sure data is stored in UTF8 in memory
1799 1799
 					}
1800
-					if (dol_is_file($sdir . $file) && image_format_supported($file) >= 0) {
1800
+					if (dol_is_file($sdir.$file) && image_format_supported($file) >= 0) {
1801 1801
 						return true;
1802 1802
 					}
1803 1803
 				}
@@ -1920,7 +1920,7 @@  discard block
 block discarded – undo
1920 1920
 		$result .= $linkend;
1921 1921
 
1922 1922
 		global $action;
1923
-		$hookmanager->initHooks(array($this->element . 'dao'));
1923
+		$hookmanager->initHooks(array($this->element.'dao'));
1924 1924
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1925 1925
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1926 1926
 		if ($reshook > 0) {
Please login to merge, or discard this patch.
htdocs/public/stripe/ipn.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 		if (!empty($user->email)) {
195 195
 			$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
196 196
 		} else {
197
-			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
197
+			$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
198 198
 		}
199 199
 		$replyto = $sendto;
200 200
 		$sendtocc = '';
201 201
 		if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
202
-			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
202
+			$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
203 203
 		}
204 204
 
205 205
 		$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 				if (!empty($user->email)) {
298 298
 					$sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">";
299 299
 				} else {
300
-					$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') . '" <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
300
+					$sendto = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'" <'.getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
301 301
 				}
302 302
 				$replyto = $sendto;
303 303
 				$sendtocc = '';
304 304
 				if (getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL')) {
305
-					$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL') . '" <' . getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
305
+					$sendtocc = getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'" <'.getDolGlobalString('ONLINE_PAYMENT_SENDEMAIL').'>';
306 306
 				}
307 307
 
308 308
 				$message = "A bank transfer of ".price2num($event->data->object->amount / 100)." ".$event->data->object->currency." has been done to your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
@@ -348,19 +348,19 @@  discard block
 block discarded – undo
348 348
 	dol_syslog("object = ".var_export($event->data, true));
349 349
 	dol_syslog("object = ".var_export($event->data, true), LOG_DEBUG, 0, '_payment');
350 350
 
351
-	include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
351
+	include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
352 352
 	global $stripearrayofkeysbyenv;
353 353
 	$error = 0;
354 354
 	$object = $event->data->object;
355
-	$TRANSACTIONID = $object->id;	// Example pi_123456789...
355
+	$TRANSACTIONID = $object->id; // Example pi_123456789...
356 356
 	$ipaddress = $object->metadata->ipaddress;
357 357
 	$now = dol_now();
358 358
 	$currencyCodeType = strtoupper($object->currency);
359 359
 	$paymentmethodstripeid = $object->payment_method;
360 360
 	$customer_id = $object->customer;
361 361
 	$invoice_id = "";
362
-	$paymentTypeCode = "";			// payment type according to Stripe
363
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
362
+	$paymentTypeCode = ""; // payment type according to Stripe
363
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
364 364
 	$payment_amount = 0;
365 365
 	$payment_amountInDolibarr = 0;
366 366
 
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		$s = new \Stripe\StripeClient($stripeacc);
434 434
 
435 435
 		$paymentmethodstripe = $s->paymentMethods->retrieve($paymentmethodstripeid);
436
-		$paymentTypeCode =  $paymentmethodstripe->type;
436
+		$paymentTypeCode = $paymentmethodstripe->type;
437 437
 		if ($paymentTypeCode == "ban" || $paymentTypeCode == "sepa_debit") {
438 438
 			$paymentTypeCode = "PRE";
439 439
 		} elseif ($paymentTypeCode == "card") {
@@ -460,9 +460,9 @@  discard block
 block discarded – undo
460 460
 			$paiement->datepaye = $now;
461 461
 			$paiement->date = $now;
462 462
 			if ($currencyCodeType == $conf->currency) {
463
-				$paiement->amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching with invoice id
463
+				$paiement->amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching with invoice id
464 464
 			} else {
465
-				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount];   // Array with all payments dispatching
465
+				$paiement->multicurrency_amounts = [$invoice_id => $payment_amount]; // Array with all payments dispatching
466 466
 
467 467
 				$postactionmessages[] = 'Payment was done in a currency ('.$currencyCodeType.') other than the expected currency of company ('.$conf->currency.')';
468 468
 				$ispostactionok = -1;
@@ -485,8 +485,8 @@  discard block
 block discarded – undo
485 485
 
486 486
 			$paiement->num_payment = '';
487 487
 			$paiement->note_public = '';
488
-			$paiement->note_private = 'Stripe Sepa payment received by IPN service listening webhooks - ' . dol_print_date($now, 'standard') . ' (TZ server) using servicestatus=' . $servicestatus . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID;
489
-			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key'];		// May be we should store py_... instead of pi_... but we started with pi_... so we continue.
488
+			$paiement->note_private = 'Stripe Sepa payment received by IPN service listening webhooks - '.dol_print_date($now, 'standard').' (TZ server) using servicestatus='.$servicestatus.($ipaddress ? ' from ip '.$ipaddress : '').' - Transaction ID = '.$TRANSACTIONID;
489
+			$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer_id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // May be we should store py_... instead of pi_... but we started with pi_... so we continue.
490 490
 			$paiement->ext_payment_site = $service;
491 491
 
492 492
 			$ispaymentdone = 0;
@@ -505,23 +505,23 @@  discard block
 block discarded – undo
505 505
 			$db->begin();
506 506
 
507 507
 			if (!$error && !$ispaymentdone) {
508
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.');
509
-				dol_syslog('* Record payment type PRE for invoice id ' . $invoice_id . '. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
508
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.');
509
+				dol_syslog('* Record payment type PRE for invoice id '.$invoice_id.'. It includes closing of invoice and regenerating document.', LOG_DEBUG, 0, '_payment');
510 510
 
511 511
 				// This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document
512 512
 				$paiement_id = $paiement->create($user, 1);
513 513
 				if ($paiement_id < 0) {
514
-					$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
514
+					$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
515 515
 					$ispostactionok = -1;
516 516
 					$error++;
517 517
 
518
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id);
519
-					dol_syslog("Failed to create the payment for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
518
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id);
519
+					dol_syslog("Failed to create the payment for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
520 520
 				} else {
521 521
 					$postactionmessages[] = 'Payment created';
522 522
 
523
-					dol_syslog("The payment has been created for invoice id " . $invoice_id);
524
-					dol_syslog("The payment has been created for invoice id " . $invoice_id, LOG_DEBUG, 0, '_payment');
523
+					dol_syslog("The payment has been created for invoice id ".$invoice_id);
524
+					dol_syslog("The payment has been created for invoice id ".$invoice_id, LOG_DEBUG, 0, '_payment');
525 525
 				}
526 526
 			}
527 527
 
@@ -553,14 +553,14 @@  discard block
 block discarded – undo
553 553
 						$label = '(CustomerInvoicePayment)';
554 554
 						$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $customer_id, '');
555 555
 						if ($result < 0) {
556
-							$postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . implode("<br>\n", $paiement->errors);
556
+							$postactionmessages[] = $paiement->error.($paiement->error ? ' ' : '').implode("<br>\n", $paiement->errors);
557 557
 							$ispostactionok = -1;
558 558
 							$error++;
559 559
 						} else {
560 560
 							$postactionmessages[] = 'Bank transaction of payment created (by ipn.php file)';
561 561
 						}
562 562
 					} else {
563
-						$postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.';
563
+						$postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.';
564 564
 						$ispostactionok = -1;
565 565
 						$error++;
566 566
 					}
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			$error++;
733 733
 		}
734 734
 
735
-		if (! $error) {
735
+		if (!$error) {
736 736
 			$db->commit();
737 737
 		} else {
738 738
 			$db->rollback();
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 		$companypaymentmode->card_type       = $event->data->object->card->branding;
767 767
 
768 768
 		$companypaymentmode->owner_name      = $event->data->object->billing_details->name;
769
-		$companypaymentmode->proprio         = $companypaymentmode->owner_name;			// We may still need this formodulebuilder because name of field is "proprio"
769
+		$companypaymentmode->proprio         = $companypaymentmode->owner_name; // We may still need this formodulebuilder because name of field is "proprio"
770 770
 
771 771
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
772 772
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 		$companypaymentmode->label           = '';
809 809
 		$companypaymentmode->number          = $db->escape($event->data->object->id);
810 810
 		$companypaymentmode->last_four       = $db->escape($event->data->object->card->last4);
811
-		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name);	// deprecated
811
+		$companypaymentmode->proprio         = $db->escape($event->data->object->billing_details->name); // deprecated
812 812
 		$companypaymentmode->owner_name      = $db->escape($event->data->object->billing_details->name);
813 813
 		$companypaymentmode->exp_date_month  = (int) $event->data->object->card->exp_month;
814 814
 		$companypaymentmode->exp_date_year   = (int) $event->data->object->card->exp_year;
@@ -864,12 +864,12 @@  discard block
 block discarded – undo
864 864
 	$paymentmethodstripeid = $object->payment_method;
865 865
 	$customer_id = $object->customer;
866 866
 	$reason = $object->reason;
867
-	$amountdisputestripe = $object->amoutndispute;	// In stripe format
868
-	$amountdispute = $amountdisputestripe;			// In real currency format
867
+	$amountdisputestripe = $object->amoutndispute; // In stripe format
868
+	$amountdispute = $amountdisputestripe; // In real currency format
869 869
 
870 870
 	$invoice_id = 0;
871
-	$paymentTypeCode = "";			// payment type according to Stripe
872
-	$paymentTypeCodeInDolibarr = "";	// payment type according to Dolibarr
871
+	$paymentTypeCode = ""; // payment type according to Stripe
872
+	$paymentTypeCodeInDolibarr = ""; // payment type according to Dolibarr
873 873
 	$payment_amount = 0;
874 874
 	$payment_amountInDolibarr = 0;
875 875
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 	$paiement->multicurrency_tx = $multicurrency_tx; // Array with all currency tx of payments dispatching
952 952
 	*/
953 953
 	$paiement->paiementid   = dol_getIdFromCode($db, 'PRE', 'c_paiement', 'code', 'id', 1);
954
-	$paiement->num_payment  = $object->id;	// A string like 'du_...'
954
+	$paiement->num_payment  = $object->id; // A string like 'du_...'
955 955
 	$paiement->note_public = 'Fund withdrawn by bank. Reason: '.$reason;
956 956
 	$paiement->note_private = '';
957 957
 	$paiement->fk_account   = $accountfrom->id;
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 		$error++;
968 968
 	}
969 969
 
970
-	if (! $error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
970
+	if (!$error && $tmpinvoice->status == Facture::STATUS_CLOSED) {
971 971
 		// Switch back the invoice to status validated
972 972
 		$result = $tmpinvoice->setStatut(Facture::STATUS_VALIDATED);
973 973
 		if ($result < 0) {
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 		}
977 977
 	}
978 978
 
979
-	if (! $error) {
979
+	if (!$error) {
980 980
 		$paiement_id = $paiement->create($user, 0, $tmpinvoice->thirdparty); // This include regenerating documents
981 981
 		if ($paiement_id < 0) {
982 982
 			$errormsg = $paiement->error.implode(', ', $paiement->errors);
Please login to merge, or discard this patch.