Completed
Branch develop (784740)
by
unknown
21:57
created
test/phpunit/NumberingModulesTest.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *		\remarks	To run this script as CLI:  phpunit filename.php
26 26
  */
27 27
 
28
-global $conf,$user,$langs,$db;
28
+global $conf, $user, $langs, $db;
29 29
 //define('TEST_DB_FORCE_TYPE','mysql');	// This is to force using mysql driver
30 30
 //require_once 'PHPUnit/Autoload.php';
31 31
 require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function testFactureMercure()
57 57
 	{
58
-		global $conf,$user,$langs,$db,$mysoc;
58
+		global $conf, $user, $langs, $db, $mysoc;
59 59
 		$conf = $this->savconf;
60 60
 		$user = $this->savuser;
61 61
 		$langs = $this->savlangs;
@@ -77,50 +77,50 @@  discard block
 block discarded – undo
77 77
 		$localobject->initAsSpecimen();
78 78
 		$localobject->fetch_thirdparty();
79 79
 
80
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1915);	// we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1}
80
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1915); // we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1}
81 81
 		$numbering = new mod_facture_mercure();
82 82
 		$result = $numbering->getNextValue($mysoc, $localobject);
83 83
 		print __METHOD__." result=".$result."\n";
84
-		$this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice');				// counter must start to 1
84
+		$this->assertEquals('1915-0001', $result, 'Test for {yyyy}-{0000}, 1st invoice'); // counter must start to 1
85 85
 		$result2 = $localobject->create($user, 1);
86 86
 		print __METHOD__." result2=".$result."\n";
87
-		$result3 = $localobject->validate($user, $result);		// create invoice by forcing ref
87
+		$result3 = $localobject->validate($user, $result); // create invoice by forcing ref
88 88
 		print __METHOD__." result3=".$result."\n";
89
-		$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok');	// counter must start to 1
89
+		$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1
90 90
 		$result = $localobject->is_erasable();
91 91
 		print __METHOD__." is_erasable=".$result."\n";
92
-		$this->assertGreaterThanOrEqual(1, $result, 'Test for is_erasable, 1st invoice');						    // Can be deleted
92
+		$this->assertGreaterThanOrEqual(1, $result, 'Test for is_erasable, 1st invoice'); // Can be deleted
93 93
 
94 94
 		// We emulate print on invoice 3 times
95 95
 		$localobject->pos_print_counter = 3;
96 96
 		$result = $localobject->is_erasable();
97 97
 		print __METHOD__." is_erasable=".$result."\n";
98
-		$this->assertGreaterThanOrEqual(-6, $result, 'Test for is_erasable, 1st invoice already printed');						    // Can be deleted
98
+		$this->assertGreaterThanOrEqual(-6, $result, 'Test for is_erasable, 1st invoice already printed'); // Can be deleted
99 99
 
100 100
 
101 101
 		$localobject2 = new Facture($db);
102 102
 		$localobject2->initAsSpecimen();
103 103
 		$localobject2->fetch_thirdparty();
104 104
 
105
-		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1916);	// we use following year for second invoice (there is no reset into mask)
105
+		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1916); // we use following year for second invoice (there is no reset into mask)
106 106
 		$numbering = new mod_facture_mercure();
107 107
 		$result = $numbering->getNextValue($mysoc, $localobject2, 'last');
108 108
 		print __METHOD__." result=".$result."\n";
109 109
 		$this->assertEquals('1915-0001', $result, "Test to get last value with param 'last'");
110 110
 		$result = $numbering->getNextValue($mysoc, $localobject2);
111 111
 		print __METHOD__." result=".$result."\n";
112
-		$this->assertEquals('1916-0002', $result);				// counter must be now 2 (not reset)
112
+		$this->assertEquals('1916-0002', $result); // counter must be now 2 (not reset)
113 113
 		$result2 = $localobject2->create($user, 1);
114 114
 		print __METHOD__." result2=".$result."\n";
115
-		$result3 = $localobject2->validate($user, $result);		// create invoice by forcing ref
115
+		$result3 = $localobject2->validate($user, $result); // create invoice by forcing ref
116 116
 		print __METHOD__." result3=".$result."\n";
117
-		$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok');	// counter must start to 1
117
+		$this->assertEquals(1, $result3, 'Test validation of invoice with forced ref is ok'); // counter must start to 1
118 118
 		$result = $localobject2->is_erasable();
119 119
 		print __METHOD__." is_erasable=".$result."\n";
120
-		$this->assertGreaterThanOrEqual(1, $result);						// Can be deleted
120
+		$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
121 121
 		$result = $localobject->is_erasable();
122 122
 		print __METHOD__." is_erasable=".$result."\n";
123
-		$this->assertLessThanOrEqual(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice');						// 1 can no more be deleted (2 is more recent)
123
+		$this->assertLessThanOrEqual(0, $result, 'Test for {yyyy}-{0000} that is_erasable is 0 for 1st invoice'); // 1 can no more be deleted (2 is more recent)
124 124
 
125 125
 		// Now we try with a reset
126 126
 		$conf->global->FACTURE_MERCURE_MASK_CREDIT = '{yyyy}-{0000@1}';
@@ -130,33 +130,33 @@  discard block
 block discarded – undo
130 130
 		$localobject->initAsSpecimen();
131 131
 		$localobject->fetch_thirdparty();
132 132
 
133
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1910);	// we use year 1910 to be sure to not have existing invoice for this year
133
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1910); // we use year 1910 to be sure to not have existing invoice for this year
134 134
 		$numbering = new mod_facture_mercure();
135 135
 		$result = $numbering->getNextValue($mysoc, $localobject);
136 136
 		$result2 = $localobject->create($user, 1);
137 137
 		$result3 = $localobject->validate($user, $result);
138 138
 		print __METHOD__." result=".$result."\n";
139
-		$this->assertEquals('1910-0001', $result, 'Test for {yyyy}-{0000@1} 1st invoice');				// counter must start to 1
139
+		$this->assertEquals('1910-0001', $result, 'Test for {yyyy}-{0000@1} 1st invoice'); // counter must start to 1
140 140
 
141 141
 		$localobject2 = new Facture($db);
142 142
 		$localobject2->initAsSpecimen();
143 143
 		$localobject2->fetch_thirdparty();
144 144
 
145
-		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1910);	// we use same year for second invoice (and there is a reset required)
145
+		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1910); // we use same year for second invoice (and there is a reset required)
146 146
 		$numbering = new mod_facture_mercure();
147 147
 		$result = $numbering->getNextValue($mysoc, $localobject2);
148 148
 		print __METHOD__." result=".$result."\n";
149
-		$this->assertEquals('1910-0002', $result, 'Test for {yyyy}-{0000@1} 2nd invoice, same day');	// counter must be now 2
149
+		$this->assertEquals('1910-0002', $result, 'Test for {yyyy}-{0000@1} 2nd invoice, same day'); // counter must be now 2
150 150
 
151 151
 		$localobject3 = new Facture($db);
152 152
 		$localobject3->initAsSpecimen();
153 153
 		$localobject3->fetch_thirdparty();
154 154
 
155
-		$localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1911);	// we use next year for third invoice (and there is a reset required)
155
+		$localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1911); // we use next year for third invoice (and there is a reset required)
156 156
 		$numbering = new mod_facture_mercure();
157 157
 		$result = $numbering->getNextValue($mysoc, $localobject3);
158 158
 		print __METHOD__." result=".$result."\n";
159
-		$this->assertEquals('1911-0001', $result, 'Test for {yyyy}-{0000@1} 3rd invoice, same day');	// counter must be now 1
159
+		$this->assertEquals('1911-0001', $result, 'Test for {yyyy}-{0000@1} 3rd invoice, same day'); // counter must be now 1
160 160
 
161 161
 		// Same but we add month after year
162 162
 		$conf->global->FACTURE_MERCURE_MASK_CREDIT = '{yyyy}{mm}-{0000@1}';
@@ -166,34 +166,34 @@  discard block
 block discarded – undo
166 166
 		$localobject->initAsSpecimen();
167 167
 		$localobject->fetch_thirdparty();
168 168
 
169
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1920);	// we use year 1920 to be sure to not have existing invoice for this year
169
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1920); // we use year 1920 to be sure to not have existing invoice for this year
170 170
 		$numbering = new mod_facture_mercure();
171 171
 		$result = $numbering->getNextValue($mysoc, $localobject);
172 172
 		$result2 = $localobject->create($user, 1);
173 173
 		$result3 = $localobject->validate($user, $result);
174 174
 		print __METHOD__." result=".$result."\n";
175
-		$this->assertEquals('192001-0001', $result, 'Test for {yyyy}{mm}-{0000@1} 1st invoice');			// counter must start to 1
175
+		$this->assertEquals('192001-0001', $result, 'Test for {yyyy}{mm}-{0000@1} 1st invoice'); // counter must start to 1
176 176
 		$result = $localobject->is_erasable();
177 177
 		print __METHOD__." is_erasable=".$result."\n";
178
-		$this->assertGreaterThanOrEqual(1, $result);						// Can be deleted
178
+		$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
179 179
 
180 180
 		$localobject2 = new Facture($db);
181 181
 		$localobject2->initAsSpecimen();
182 182
 		$localobject2->fetch_thirdparty();
183 183
 
184
-		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1921);	// we use following year for second invoice (and there is a reset required)
184
+		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1921); // we use following year for second invoice (and there is a reset required)
185 185
 		$numbering = new mod_facture_mercure();
186 186
 		$result = $numbering->getNextValue($mysoc, $localobject2);
187 187
 		$result2 = $localobject2->create($user, 1);
188 188
 		$result3 = $localobject2->validate($user, $result);
189 189
 		print __METHOD__." result=".$result."\n";
190
-		$this->assertEquals('192101-0001', $result);			// counter must be reset to 1
190
+		$this->assertEquals('192101-0001', $result); // counter must be reset to 1
191 191
 		$result = $localobject2->is_erasable();
192 192
 		print __METHOD__." is_erasable=".$result."\n";
193
-		$this->assertGreaterThanOrEqual(1, $result);						// Can be deleted
193
+		$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
194 194
 		$result = $localobject->is_erasable();
195 195
 		print __METHOD__." is_erasable=".$result."\n";
196
-		$this->assertGreaterThanOrEqual(1, $result);						// Case 1 can be deleted (because there was a reset for case 2)
196
+		$this->assertGreaterThanOrEqual(1, $result); // Case 1 can be deleted (because there was a reset for case 2)
197 197
 
198 198
 		// Same but we add month before year and use a year on 2 digits
199 199
 		$conf->global->FACTURE_MERCURE_MASK_CREDIT = '[mm}{yy}-{0000@1}';
@@ -201,42 +201,42 @@  discard block
 block discarded – undo
201 201
 		$localobject = new Facture($db);
202 202
 		$localobject->initAsSpecimen();
203 203
 		$localobject->fetch_thirdparty();
204
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1925);	// we use year 1925 to be sure to not have existing invoice for this year
204
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1925); // we use year 1925 to be sure to not have existing invoice for this year
205 205
 		$numbering = new mod_facture_mercure();
206 206
 		$result = $numbering->getNextValue($mysoc, $localobject);
207 207
 		$result2 = $localobject->create($user, 1);
208 208
 		$result3 = $localobject->validate($user, $result);
209 209
 		print __METHOD__." result=".$result."\n";
210
-		$this->assertEquals('0125-0001', $result, 'Test for {mm}{yy}-{0000@1} 1st invoice');				// counter must start to 1
211
-		$result = $localobject->is_erasable();					// This call get getNextNumRef with param 'last'
210
+		$this->assertEquals('0125-0001', $result, 'Test for {mm}{yy}-{0000@1} 1st invoice'); // counter must start to 1
211
+		$result = $localobject->is_erasable(); // This call get getNextNumRef with param 'last'
212 212
 		print __METHOD__." is_erasable=".$result."\n";
213
-		$this->assertGreaterThanOrEqual(1, $result);						// Can be deleted
213
+		$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
214 214
 
215 215
 		$localobject2 = new Facture($db);
216 216
 		$localobject2->initAsSpecimen();
217 217
 		$localobject2->fetch_thirdparty();
218
-		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1925);	// we use same year 1925 for second invoice (and there is a reset required)
218
+		$localobject2->date = dol_mktime(12, 0, 0, 1, 1, 1925); // we use same year 1925 for second invoice (and there is a reset required)
219 219
 		$numbering = new mod_facture_mercure();
220 220
 		$result = $numbering->getNextValue($mysoc, $localobject2);
221 221
 		$result2 = $localobject2->create($user, 1);
222 222
 		$result3 = $localobject2->validate($user, $result);
223 223
 		print __METHOD__." result=".$result."\n";
224
-		$this->assertEquals('0125-0002', $result, 'Test for {mm}{yy}-{0000@1} 2nd invoice');			// counter must be now 2
224
+		$this->assertEquals('0125-0002', $result, 'Test for {mm}{yy}-{0000@1} 2nd invoice'); // counter must be now 2
225 225
 		$result = $localobject2->is_erasable();
226 226
 		print __METHOD__." is_erasable=".$result."\n";
227
-		$this->assertGreaterThanOrEqual(1, $result);						// Can be deleted
227
+		$this->assertGreaterThanOrEqual(1, $result); // Can be deleted
228 228
 		$result = $localobject->is_erasable();
229 229
 		print __METHOD__." is_erasable=".$result."\n";
230
-		$this->assertLessThanOrEqual(0, $result);						// Case 1 can not be deleted (because there is an invoice 2)
230
+		$this->assertLessThanOrEqual(0, $result); // Case 1 can not be deleted (because there is an invoice 2)
231 231
 
232 232
 		$localobject3 = new Facture($db);
233 233
 		$localobject3->initAsSpecimen();
234 234
 		$localobject3->fetch_thirdparty();
235
-		$localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1926);	// we use following year for third invoice (and there is a reset required)
235
+		$localobject3->date = dol_mktime(12, 0, 0, 1, 1, 1926); // we use following year for third invoice (and there is a reset required)
236 236
 		$numbering = new mod_facture_mercure();
237 237
 		$result = $numbering->getNextValue($mysoc, $localobject3);
238 238
 		print __METHOD__." result=".$result."\n";
239
-		$this->assertEquals('0126-0001', $result, 'Test for {mm}{yy}-{0000@1} 3rd invoice');			// counter must be now 1
239
+		$this->assertEquals('0126-0001', $result, 'Test for {mm}{yy}-{0000@1} 3rd invoice'); // counter must be now 1
240 240
 
241 241
 		// Try an offset when an invoice already exists
242 242
 		$conf->global->FACTURE_MERCURE_MASK_CREDIT = '{yyyy}{mm}-{0000+9990}';
@@ -251,56 +251,56 @@  discard block
 block discarded – undo
251 251
 		$localobject->initAsSpecimen();
252 252
 		$localobject->fetch_thirdparty();
253 253
 
254
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1930);	// we use year 1930 to be sure to not have existing invoice for this year
254
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1930); // we use year 1930 to be sure to not have existing invoice for this year
255 255
 		$numbering = new mod_facture_mercure();
256 256
 		$result = $numbering->getNextValue($mysoc, $localobject, 'last');
257 257
 		print __METHOD__." result for last=".$result."\n";
258
-		$this->assertEquals('', $result);						// no existing ref into reset range
258
+		$this->assertEquals('', $result); // no existing ref into reset range
259 259
 		$result = $numbering->getNextValue($mysoc, $localobject);
260 260
 		$result2 = $localobject->create($user, 1);
261 261
 		$result3 = $localobject->validate($user, $result);
262 262
 		print __METHOD__." result=".$result."\n";
263
-		$this->assertEquals('193001-0001', $result);			// counter must start to 1
263
+		$this->assertEquals('193001-0001', $result); // counter must start to 1
264 264
 		$result = $numbering->getNextValue($mysoc, $localobject, 'last');
265 265
 		print __METHOD__." result for last=".$result."\n";
266
-		$this->assertEquals('193001-0001', $result);			// last ref into reset range should be same than last created
266
+		$this->assertEquals('193001-0001', $result); // last ref into reset range should be same than last created
267 267
 
268 268
 		$localobject = new Facture($db);
269 269
 		$localobject->initAsSpecimen();
270 270
 		$localobject->fetch_thirdparty();
271 271
 
272
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1930);	// we use same year but fiscal month after
272
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1930); // we use same year but fiscal month after
273 273
 		$numbering = new mod_facture_mercure();
274 274
 		$result = $numbering->getNextValue($mysoc, $localobject, 'last');
275 275
 		print __METHOD__." result for last=".$result."\n";
276
-		$this->assertEquals('', $result);						// last ref into reset range should be ''
276
+		$this->assertEquals('', $result); // last ref into reset range should be ''
277 277
 		$result = $numbering->getNextValue($mysoc, $localobject);
278 278
 		$result2 = $localobject->create($user, 1);
279 279
 		$result3 = $localobject->validate($user, $result);
280 280
 		print __METHOD__." result=".$result."\n";
281
-		$this->assertEquals('193012-0001', $result);	// counter must be reset to 1
281
+		$this->assertEquals('193012-0001', $result); // counter must be reset to 1
282 282
 
283 283
 		$localobject = new Facture($db);
284 284
 		$localobject->initAsSpecimen();
285 285
 		$localobject->fetch_thirdparty();
286 286
 
287
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1931);	// we use same fiscal year but different year
287
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1931); // we use same fiscal year but different year
288 288
 		$numbering = new mod_facture_mercure();
289 289
 		$result = $numbering->getNextValue($mysoc, $localobject);
290 290
 		$result2 = $localobject->create($user, 1);
291 291
 		$result3 = $localobject->validate($user, $result);
292 292
 		print __METHOD__." result=".$result."\n";
293
-		$this->assertEquals('193101-0002', $result);	// counter must be 2
293
+		$this->assertEquals('193101-0002', $result); // counter must be 2
294 294
 
295 295
 		$localobject = new Facture($db);
296 296
 		$localobject->initAsSpecimen();
297 297
 		$localobject->fetch_thirdparty();
298 298
 
299
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1931);	// we use different fiscal year but same year
299
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1931); // we use different fiscal year but same year
300 300
 		$numbering = new mod_facture_mercure();
301 301
 		$result = $numbering->getNextValue($mysoc, $localobject);
302 302
 		print __METHOD__." result=".$result."\n";
303
-		$this->assertEquals('193112-0001', $result);	// counter must be reset to 1
303
+		$this->assertEquals('193112-0001', $result); // counter must be reset to 1
304 304
 
305 305
 
306 306
 		// Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START)
@@ -312,47 +312,47 @@  discard block
 block discarded – undo
312 312
 		$localobject->initAsSpecimen();
313 313
 		$localobject->fetch_thirdparty();
314 314
 
315
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1940);	// we use year 1940 to be sure to not have existing invoice for this year
315
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1940); // we use year 1940 to be sure to not have existing invoice for this year
316 316
 		$numbering = new mod_facture_mercure();
317 317
 		$result = $numbering->getNextValue($mysoc, $localobject);
318 318
 		$result2 = $localobject->create($user, 1);
319 319
 		$result3 = $localobject->validate($user, $result);
320 320
 		print __METHOD__." result=".$result."\n";
321
-		$this->assertEquals('194001-0001', $result);	// counter must start to 1
321
+		$this->assertEquals('194001-0001', $result); // counter must start to 1
322 322
 
323 323
 		$localobject = new Facture($db);
324 324
 		$localobject->initAsSpecimen();
325 325
 		$localobject->fetch_thirdparty();
326 326
 
327
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1940);	// we use same year but fiscal month after
327
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1940); // we use same year but fiscal month after
328 328
 		$numbering = new mod_facture_mercure();
329 329
 		$result = $numbering->getNextValue($mysoc, $localobject);
330 330
 		$result2 = $localobject->create($user, 1);
331 331
 		$result3 = $localobject->validate($user, $result);
332 332
 		print __METHOD__." result=".$result."\n";
333
-		$this->assertEquals('194012-0001', $result);	// counter must be reset to 1
333
+		$this->assertEquals('194012-0001', $result); // counter must be reset to 1
334 334
 
335 335
 		$localobject = new Facture($db);
336 336
 		$localobject->initAsSpecimen();
337 337
 		$localobject->fetch_thirdparty();
338 338
 
339
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1941);	// we use same fiscal year but different year
339
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1941); // we use same fiscal year but different year
340 340
 		$numbering = new mod_facture_mercure();
341 341
 		$result = $numbering->getNextValue($mysoc, $localobject);
342 342
 		$result2 = $localobject->create($user, 1);
343 343
 		$result3 = $localobject->validate($user, $result);
344 344
 		print __METHOD__." result=".$result."\n";
345
-		$this->assertEquals('194101-0002', $result);	// counter must be 2
345
+		$this->assertEquals('194101-0002', $result); // counter must be 2
346 346
 
347 347
 		$localobject = new Facture($db);
348 348
 		$localobject->initAsSpecimen();
349 349
 		$localobject->fetch_thirdparty();
350 350
 
351
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1941);	// we use different discal year but same year
351
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1941); // we use different discal year but same year
352 352
 		$numbering = new mod_facture_mercure();
353 353
 		$result = $numbering->getNextValue($mysoc, $localobject);
354 354
 		print __METHOD__." result=".$result."\n";
355
-		$this->assertEquals('194112-0001', $result);	// counter must be reset to 1
355
+		$this->assertEquals('194112-0001', $result); // counter must be reset to 1
356 356
 
357 357
 
358 358
 		// Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) and we always want year of element
@@ -364,47 +364,47 @@  discard block
 block discarded – undo
364 364
 		$localobject->initAsSpecimen();
365 365
 		$localobject->fetch_thirdparty();
366 366
 
367
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1950);	// we use year 1950 to be sure to not have existing invoice for this year
367
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1950); // we use year 1950 to be sure to not have existing invoice for this year
368 368
 		$numbering = new mod_facture_mercure();
369 369
 		$result = $numbering->getNextValue($mysoc, $localobject);
370 370
 		$result2 = $localobject->create($user, 1);
371 371
 		$result3 = $localobject->validate($user, $result);
372 372
 		print __METHOD__." result=".$result."\n";
373
-		$this->assertEquals('195001-0001', $result);	// counter must start to 1
373
+		$this->assertEquals('195001-0001', $result); // counter must start to 1
374 374
 
375 375
 		$localobject = new Facture($db);
376 376
 		$localobject->initAsSpecimen();
377 377
 		$localobject->fetch_thirdparty();
378 378
 
379
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1950);	// we use same year but fiscal month after
379
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1950); // we use same year but fiscal month after
380 380
 		$numbering = new mod_facture_mercure();
381 381
 		$result = $numbering->getNextValue($mysoc, $localobject);
382 382
 		$result2 = $localobject->create($user, 1);
383 383
 		$result3 = $localobject->validate($user, $result);
384 384
 		print __METHOD__." result=".$result."\n";
385
-		$this->assertEquals('195012-0001', $result);	// counter must be reset to 1
385
+		$this->assertEquals('195012-0001', $result); // counter must be reset to 1
386 386
 
387 387
 		$localobject = new Facture($db);
388 388
 		$localobject->initAsSpecimen();
389 389
 		$localobject->fetch_thirdparty();
390 390
 
391
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1951);	// we use same fiscal year but different year
391
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1951); // we use same fiscal year but different year
392 392
 		$numbering = new mod_facture_mercure();
393 393
 		$result = $numbering->getNextValue($mysoc, $localobject);
394 394
 		$result2 = $localobject->create($user, 1);
395 395
 		$result3 = $localobject->validate($user, $result);
396 396
 		print __METHOD__." result=".$result."\n";
397
-		$this->assertEquals('195101-0002', $result);	// counter must be 2
397
+		$this->assertEquals('195101-0002', $result); // counter must be 2
398 398
 
399 399
 		$localobject = new Facture($db);
400 400
 		$localobject->initAsSpecimen();
401 401
 		$localobject->fetch_thirdparty();
402 402
 
403
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1951);	// we use different discal year but same year
403
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1951); // we use different discal year but same year
404 404
 		$numbering = new mod_facture_mercure();
405 405
 		$result = $numbering->getNextValue($mysoc, $localobject);
406 406
 		print __METHOD__." result=".$result."\n";
407
-		$this->assertEquals('195112-0001', $result);	// counter must be reset to 1
407
+		$this->assertEquals('195112-0001', $result); // counter must be reset to 1
408 408
 
409 409
 
410 410
 		// Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) and we always want start year
@@ -416,47 +416,47 @@  discard block
 block discarded – undo
416 416
 		$localobject->initAsSpecimen();
417 417
 		$localobject->fetch_thirdparty();
418 418
 
419
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1960);	// we use year 1960 to be sure to not have existing invoice for this year
419
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1960); // we use year 1960 to be sure to not have existing invoice for this year
420 420
 		$numbering = new mod_facture_mercure();
421 421
 		$result = $numbering->getNextValue($mysoc, $localobject);
422 422
 		$result2 = $localobject->create($user, 1);
423 423
 		$result3 = $localobject->validate($user, $result);
424 424
 		print __METHOD__." result=".$result."\n";
425
-		$this->assertEquals('195901-0001', $result);	// counter must start to 1
425
+		$this->assertEquals('195901-0001', $result); // counter must start to 1
426 426
 
427 427
 		$localobject = new Facture($db);
428 428
 		$localobject->initAsSpecimen();
429 429
 		$localobject->fetch_thirdparty();
430 430
 
431
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1960);	// we use same year but fiscal month after
431
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1960); // we use same year but fiscal month after
432 432
 		$numbering = new mod_facture_mercure();
433 433
 		$result = $numbering->getNextValue($mysoc, $localobject);
434 434
 		$result2 = $localobject->create($user, 1);
435 435
 		$result3 = $localobject->validate($user, $result);
436 436
 		print __METHOD__." result=".$result."\n";
437
-		$this->assertEquals('196012-0001', $result);	// counter must be reset to 1
437
+		$this->assertEquals('196012-0001', $result); // counter must be reset to 1
438 438
 
439 439
 		$localobject = new Facture($db);
440 440
 		$localobject->initAsSpecimen();
441 441
 		$localobject->fetch_thirdparty();
442 442
 
443
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1961);	// we use same fiscal year but different year
443
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1961); // we use same fiscal year but different year
444 444
 		$numbering = new mod_facture_mercure();
445 445
 		$result = $numbering->getNextValue($mysoc, $localobject);
446 446
 		$result2 = $localobject->create($user, 1);
447 447
 		$result3 = $localobject->validate($user, $result);
448 448
 		print __METHOD__." result=".$result."\n";
449
-		$this->assertEquals('196001-0002', $result);	// counter must be 2
449
+		$this->assertEquals('196001-0002', $result); // counter must be 2
450 450
 
451 451
 		$localobject = new Facture($db);
452 452
 		$localobject->initAsSpecimen();
453 453
 		$localobject->fetch_thirdparty();
454 454
 
455
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1961);	// we use different discal year but same year
455
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1961); // we use different discal year but same year
456 456
 		$numbering = new mod_facture_mercure();
457 457
 		$result = $numbering->getNextValue($mysoc, $localobject);
458 458
 		print __METHOD__." result=".$result."\n";
459
-		$this->assertEquals('196112-0001', $result);	// counter must be reset to 1
459
+		$this->assertEquals('196112-0001', $result); // counter must be reset to 1
460 460
 
461 461
 
462 462
 		// Now we try with a different fiscal month (defined by SOCIETE_FISCAL_MONTH_START) and we always want end year
@@ -468,47 +468,47 @@  discard block
 block discarded – undo
468 468
 		$localobject->initAsSpecimen();
469 469
 		$localobject->fetch_thirdparty();
470 470
 
471
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1970);	// we use year 1970 to be sure to not have existing invoice for this year
471
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1970); // we use year 1970 to be sure to not have existing invoice for this year
472 472
 		$numbering = new mod_facture_mercure();
473 473
 		$result = $numbering->getNextValue($mysoc, $localobject);
474 474
 		$result2 = $localobject->create($user, 1);
475 475
 		$result3 = $localobject->validate($user, $result);
476 476
 		print __METHOD__." result=".$result."\n";
477
-		$this->assertEquals('197001-0001', $result);	// counter must start to 1
477
+		$this->assertEquals('197001-0001', $result); // counter must start to 1
478 478
 
479 479
 		$localobject = new Facture($db);
480 480
 		$localobject->initAsSpecimen();
481 481
 		$localobject->fetch_thirdparty();
482 482
 
483
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1970);	// we use same year but fiscal month after
483
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1970); // we use same year but fiscal month after
484 484
 		$numbering = new mod_facture_mercure();
485 485
 		$result = $numbering->getNextValue($mysoc, $localobject);
486 486
 		$result2 = $localobject->create($user, 1);
487 487
 		$result3 = $localobject->validate($user, $result);
488 488
 		print __METHOD__." result=".$result."\n";
489
-		$this->assertEquals('197112-0001', $result);	// counter must be reset to 1
489
+		$this->assertEquals('197112-0001', $result); // counter must be reset to 1
490 490
 
491 491
 		$localobject = new Facture($db);
492 492
 		$localobject->initAsSpecimen();
493 493
 		$localobject->fetch_thirdparty();
494 494
 
495
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1971);	// we use same fiscal year but different year
495
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1971); // we use same fiscal year but different year
496 496
 		$numbering = new mod_facture_mercure();
497 497
 		$result = $numbering->getNextValue($mysoc, $localobject);
498 498
 		$result2 = $localobject->create($user, 1);
499 499
 		$result3 = $localobject->validate($user, $result);
500 500
 		print __METHOD__." result=".$result."\n";
501
-		$this->assertEquals('197101-0002', $result);	// counter must be 2
501
+		$this->assertEquals('197101-0002', $result); // counter must be 2
502 502
 
503 503
 		$localobject = new Facture($db);
504 504
 		$localobject->initAsSpecimen();
505 505
 		$localobject->fetch_thirdparty();
506 506
 
507
-		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1971);	// we use different fiscal year but same year
507
+		$localobject->date = dol_mktime(12, 0, 0, 12, 1, 1971); // we use different fiscal year but same year
508 508
 		$numbering = new mod_facture_mercure();
509 509
 		$result = $numbering->getNextValue($mysoc, $localobject);
510 510
 		print __METHOD__." result=".$result."\n";
511
-		$this->assertEquals('197212-0001', $result);	// counter must be reset to 1
511
+		$this->assertEquals('197212-0001', $result); // counter must be reset to 1
512 512
 
513 513
 		// Now we try with a reset every month (@99)
514 514
 		$conf->global->SOCIETE_FISCAL_MONTH_START = 6;
@@ -519,49 +519,49 @@  discard block
 block discarded – undo
519 519
 		$localobject->initAsSpecimen();
520 520
 		$localobject->fetch_thirdparty();
521 521
 
522
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980);	// we use year 1980 to be sure to not have existing invoice for this year
522
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
523 523
 		$numbering = new mod_facture_mercure();
524 524
 		$result = $numbering->getNextValue($mysoc, $localobject);
525 525
 		$result2 = $localobject->create($user, 1);
526 526
 		$result3 = $localobject->validate($user, $result);
527 527
 		print __METHOD__." result=".$result."\n";
528
-		$this->assertEquals('198001-0001', $result);	// counter must start to 1
528
+		$this->assertEquals('198001-0001', $result); // counter must start to 1
529 529
 
530 530
 		$localobject = new Facture($db);
531 531
 		$localobject->initAsSpecimen();
532 532
 		$localobject->fetch_thirdparty();
533 533
 
534
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980);	// we use year 1980 to be sure to not have existing invoice for this year
534
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
535 535
 		$numbering = new mod_facture_mercure();
536 536
 		$result = $numbering->getNextValue($mysoc, $localobject);
537 537
 		$result2 = $localobject->create($user, 1);
538 538
 		$result3 = $localobject->validate($user, $result);
539 539
 		print __METHOD__." result=".$result."\n";
540
-		$this->assertEquals('198001-0002', $result);	// counter must start to 2
540
+		$this->assertEquals('198001-0002', $result); // counter must start to 2
541 541
 
542 542
 		$localobject = new Facture($db);
543 543
 		$localobject->initAsSpecimen();
544 544
 		$localobject->fetch_thirdparty();
545 545
 
546
-		$localobject->date = dol_mktime(12, 0, 0, 2, 1, 1980);	// we use year 1980 to be sure to not have existing invoice for this year
546
+		$localobject->date = dol_mktime(12, 0, 0, 2, 1, 1980); // we use year 1980 to be sure to not have existing invoice for this year
547 547
 		$numbering = new mod_facture_mercure();
548 548
 		$result = $numbering->getNextValue($mysoc, $localobject);
549 549
 		$result2 = $localobject->create($user, 1);
550 550
 		$result3 = $localobject->validate($user, $result);
551 551
 		print __METHOD__." result=".$result."\n";
552
-		$this->assertEquals('198002-0001', $result);	// counter must start to 1
552
+		$this->assertEquals('198002-0001', $result); // counter must start to 1
553 553
 
554 554
 		$localobject = new Facture($db);
555 555
 		$localobject->initAsSpecimen();
556 556
 		$localobject->fetch_thirdparty();
557 557
 
558
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1981);	// we use year 1981 to be sure to not have existing invoice for this year
558
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1981); // we use year 1981 to be sure to not have existing invoice for this year
559 559
 		$numbering = new mod_facture_mercure();
560 560
 		$result = $numbering->getNextValue($mysoc, $localobject);
561 561
 		$result2 = $localobject->create($user, 1);
562 562
 		$result3 = $localobject->validate($user, $result);
563 563
 		print __METHOD__." result=".$result."\n";
564
-		$this->assertEquals('198101-0001', $result);	// counter must start to 1
564
+		$this->assertEquals('198101-0001', $result); // counter must start to 1
565 565
 
566 566
 		// Test with {t} tag
567 567
 		$conf->global->SOCIETE_FISCAL_MONTH_START = 1;
@@ -576,13 +576,13 @@  discard block
 block discarded – undo
576 576
 		$localobject->initAsSpecimen();
577 577
 		$localobject->fetch_thirdparty();
578 578
 
579
-		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1982);	// we use year 1982 to be sure to not have existing invoice for this year
579
+		$localobject->date = dol_mktime(12, 0, 0, 1, 1, 1982); // we use year 1982 to be sure to not have existing invoice for this year
580 580
 		$numbering = new mod_facture_mercure();
581 581
 		$result = $numbering->getNextValue($tmpthirdparty, $localobject);
582 582
 		$result2 = $localobject->create($user, 1);
583 583
 		$result3 = $localobject->validate($user, $result);
584 584
 		print __METHOD__." result=".$result."\n";
585
-		$this->assertEquals('A198201-0001', $result);	// counter must start to 1
585
+		$this->assertEquals('A198201-0001', $result); // counter must start to 1
586 586
 
587 587
 
588 588
 		return $result;
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 */
597 597
 	public function testShipmentSafor()
598 598
 	{
599
-		global $conf,$user,$langs,$db,$mysoc;
599
+		global $conf, $user, $langs, $db, $mysoc;
600 600
 		$conf = $this->savconf;
601 601
 		$user = $this->savuser;
602 602
 		$langs = $this->savlangs;
@@ -609,11 +609,11 @@  discard block
 block discarded – undo
609 609
 		$localobject->initAsSpecimen();
610 610
 		$localobject->fetch_thirdparty();
611 611
 
612
-		$localobject->date_creation = dol_mktime(12, 0, 0, 1, 1, 1980);	// we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1}
612
+		$localobject->date_creation = dol_mktime(12, 0, 0, 1, 1, 1980); // we use year 1915 to be sure to not have existing invoice for this year (useful only if numbering is {0000@1}
613 613
 		$numbering = new mod_expedition_safor();
614 614
 		$result = $numbering->getNextValue($mysoc, $localobject);
615 615
 
616 616
 		print __METHOD__." result=".$result."\n";
617
-		$this->assertEquals('SH8001-0003', $result);	// counter must start to 1
617
+		$this->assertEquals('SH8001-0003', $result); // counter must start to 1
618 618
 	}
619 619
 }
Please login to merge, or discard this patch.
htdocs/comm/action/card.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 $offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
81 81
 $remindertype = GETPOST('selectremindertype', 'aZ09');
82 82
 $modelmail = GETPOSTINT('actioncommsendmodel_mail');
83
-$complete = GETPOST('complete', 'alpha');	// 'na' must be allowed
83
+$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
84 84
 $private = GETPOST('private', 'alphanohtml');
85 85
 if ($complete == 'na' || $complete == -2) {
86 86
 	$complete = -1;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		'label' => $langs->trans('BrowserPush'),
165 165
 		'disabled' => (getDolGlobalString('AGENDA_REMINDER_BROWSER') ? 0 : 1),
166 166
 		'type' => ActionCommReminder::TYPE_USER,
167
-		'data-html' => img_picto('', 'globe', 'class="pictofixedwidth"') . $langs->trans('BrowserPush'),
167
+		'data-html' => img_picto('', 'globe', 'class="pictofixedwidth"').$langs->trans('BrowserPush'),
168 168
 	];
169 169
 }
170 170
 if (getDolGlobalString('AGENDA_REMINDER_EMAIL')) {
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		'label' => $langs->trans('EMail'),
173 173
 		'disabled' => (getDolGlobalString('AGENDA_REMINDER_EMAIL') ? 0 : 1),
174 174
 		'type' => ActionCommReminder::TYPE_USER,
175
-		'data-html' => img_picto('', 'email', 'class="pictofixedwidth"') . $langs->trans('EMail'),
175
+		'data-html' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans('EMail'),
176 176
 	];
177 177
 }
178 178
 if (getDolGlobalString('AGENDA_REMINDER_SMS')) {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		'label' => $langs->trans('Sms'),
182 182
 		'disabled' => (getDolGlobalString('MAIN_SMS_SENDMODE') ? 0 : 1),
183 183
 		'type' => ActionCommReminder::TYPE_USER,
184
-		'data-html' => img_picto('', 'phoning_mobile', 'class="pictofixedwidth"') . $langs->trans('Sms'),
184
+		'data-html' => img_picto('', 'phoning_mobile', 'class="pictofixedwidth"').$langs->trans('Sms'),
185 185
 	];
186 186
 }
187 187
 $TDurationTypes = $form->getDurationTypes($langs);
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 				if (is_array($listofresourceid) && count($listofresourceid)) {
594 594
 					foreach ($listofresourceid as $resource_id => $val) {
595 595
 						$resource_type = 'dolresource';
596
-						$busy = 1;//GETPOSTINT('busy');
596
+						$busy = 1; //GETPOSTINT('busy');
597 597
 
598 598
 						// Resources association
599 599
 						if (getDolGlobalString('RESOURCE_USED_IN_EVENT_CHECK')) {
@@ -609,24 +609,24 @@  discard block
 block discarded – undo
609 609
 							}
610 610
 
611 611
 							$sql = "SELECT er.rowid, r.ref as r_ref, ac.id as ac_id, ac.label as ac_label";
612
-							$sql .= " FROM " . MAIN_DB_PREFIX . "element_resources as er";
613
-							$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "resource as r ON r.rowid = er.resource_id AND er.resource_type = '" . $db->escape($resource_type) . "'";
614
-							$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm as ac ON ac.id = er.element_id AND er.element_type = '" . $db->escape($object->element) . "'";
615
-							$sql .= " WHERE er.resource_id = " . ((int) $resource_id);
612
+							$sql .= " FROM ".MAIN_DB_PREFIX."element_resources as er";
613
+							$sql .= " INNER JOIN ".MAIN_DB_PREFIX."resource as r ON r.rowid = er.resource_id AND er.resource_type = '".$db->escape($resource_type)."'";
614
+							$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm as ac ON ac.id = er.element_id AND er.element_type = '".$db->escape($object->element)."'";
615
+							$sql .= " WHERE er.resource_id = ".((int) $resource_id);
616 616
 							$sql .= " AND er.busy = 1";
617 617
 							$sql .= " AND (";
618 618
 
619 619
 							// event date start between ac.datep and ac.datep2 (if datep2 is null we consider there is no end)
620
-							$sql .= " (ac.datep <= '" . $db->idate($eventDateStart) . "' AND (ac.datep2 IS NULL OR ac.datep2 >= '" . $db->idate($eventDateStart) . "'))";
620
+							$sql .= " (ac.datep <= '".$db->idate($eventDateStart)."' AND (ac.datep2 IS NULL OR ac.datep2 >= '".$db->idate($eventDateStart)."'))";
621 621
 							// event date end between ac.datep and ac.datep2
622 622
 							if (!empty($eventDateEnd)) {
623
-								$sql .= " OR (ac.datep <= '" . $db->idate($eventDateEnd) . "' AND (ac.datep2 >= '" . $db->idate($eventDateEnd) . "'))";
623
+								$sql .= " OR (ac.datep <= '".$db->idate($eventDateEnd)."' AND (ac.datep2 >= '".$db->idate($eventDateEnd)."'))";
624 624
 							}
625 625
 							// event date start before ac.datep and event date end after ac.datep2
626 626
 							$sql .= " OR (";
627
-							$sql .= "ac.datep >= '" . $db->idate($eventDateStart) . "'";
627
+							$sql .= "ac.datep >= '".$db->idate($eventDateStart)."'";
628 628
 							if (!empty($eventDateEnd)) {
629
-								$sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '" . $db->idate($eventDateEnd) . "')";
629
+								$sql .= " AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($eventDateEnd)."')";
630 630
 							}
631 631
 							$sql .= ")";
632 632
 
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
 								if ($db->num_rows($resql) > 0) {
641 641
 									// Resource already in use
642 642
 									$error++;
643
-									$object->error = $langs->trans('ErrorResourcesAlreadyInUse') . ' : ';
643
+									$object->error = $langs->trans('ErrorResourcesAlreadyInUse').' : ';
644 644
 									while ($obj = $db->fetch_object($resql)) {
645
-										$object->error .= '<br> - ' . $langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label . ' [' . $obj->ac_id . ']');
645
+										$object->error .= '<br> - '.$langs->trans('ErrorResourceUseInEvent', $obj->r_ref, $obj->ac_label.' ['.$obj->ac_id.']');
646 646
 									}
647 647
 									$object->errors[] = $object->error;
648 648
 
@@ -746,21 +746,21 @@  discard block
 block discarded – undo
746 746
 			if ($selectedrecurrulefreq == 'WEEKLY' && !empty($selectedrecurrulebyday)) {
747 747
 				$firstdatearray = dol_get_first_day_week(GETPOSTINT("apday"), GETPOSTINT("apmonth"), GETPOSTINT("apyear"));
748 748
 				$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstdatearray['month'], $firstdatearray['first_day'], $firstdatearray['year'], $tzforfullday ? $tzforfullday : 'tzuserrel');
749
-				$datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd');//We begin the week after
749
+				$datep = dol_time_plus_duree($datep, $selectedrecurrulebyday + 6, 'd'); //We begin the week after
750 750
 				$dayoffset = 7;
751 751
 				$monthoffset = 0;
752 752
 				$yearoffset = 0;
753 753
 			} elseif ($selectedrecurrulefreq == 'MONTHLY' && !empty($selectedrecurrulebymonthday)) {
754 754
 				$firstday = $selectedrecurrulebymonthday;
755
-				$firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth");//We begin the month after
755
+				$firstmonth = GETPOST("apday") > $selectedrecurrulebymonthday ? GETPOSTINT("apmonth") + 1 : GETPOSTINT("apmonth"); //We begin the month after
756 756
 				$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), $firstmonth, $firstday, GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel');
757
-				$datep = dol_time_plus_duree($datep, 1, 'm');//We begin the month after
757
+				$datep = dol_time_plus_duree($datep, 1, 'm'); //We begin the month after
758 758
 				$dayoffset = 0;
759 759
 				$monthoffset = 1;
760 760
 				$yearoffset = 0;
761 761
 			} elseif ($selectedrecurrulefreq == 'YEARLY' && !empty($selectedrecurrulebyyearmonthday)) {
762 762
 				$datep = dol_mktime($fulldayevent ? 0 : GETPOSTINT("aphour"), $fulldayevent ? 0 : GETPOSTINT("apmin"), $fulldayevent ? 0 : GETPOSTINT("apsec"), GETPOSTINT("apmonth"), GETPOSTINT("apday"), GETPOSTINT("apyear"), $tzforfullday ? $tzforfullday : 'tzuserrel');
763
-				$datep = dol_time_plus_duree($datep, 1, 'y');//We begin the year after
763
+				$datep = dol_time_plus_duree($datep, 1, 'y'); //We begin the year after
764 764
 				$dayoffset = 0;
765 765
 				$monthoffset = 0;
766 766
 				$yearoffset = 1;
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
 
858 858
 				// increment date for recurrent events
859 859
 				$datep = dol_time_plus_duree($datep, $dayoffset, 'd');
860
-				$datep = dol_time_plus_duree($datep, $monthoffset, 'm');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
861
-				$datep = dol_time_plus_duree($datep, $yearoffset, 'y');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
860
+				$datep = dol_time_plus_duree($datep, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
861
+				$datep = dol_time_plus_duree($datep, $yearoffset, 'y'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
862 862
 				$datef = dol_time_plus_duree($datef, $dayoffset, 'd');
863
-				$datef = dol_time_plus_duree($datef, $monthoffset, 'm');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
864
-				$datef = dol_time_plus_duree($datef, $yearoffset, 'y');  // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
863
+				$datef = dol_time_plus_duree($datef, $monthoffset, 'm'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
864
+				$datef = dol_time_plus_duree($datef, $yearoffset, 'y'); // @phan-suppress-current-line PhanPluginSuspiciousParamOrder
865 865
 			}
866 866
 		}
867 867
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 		$object->fetch($id);
911 911
 		$object->fetch_optionals();
912 912
 		$object->fetch_userassigned();
913
-		$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
913
+		$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
914 914
 
915 915
 		// Clean parameters
916 916
 		if ($fulldayevent) {
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 	$object->fetch($id);
1211 1211
 	$object->fetch_optionals();
1212 1212
 	$object->fetch_userassigned();
1213
-	$object->oldcopy = dol_clone($object, 2);  // @phan-suppress-current-line PhanTypeMismatchProperty
1213
+	$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
1214 1214
 
1215 1215
 	if ($user->hasRight('agenda', 'myactions', 'delete')
1216 1216
 		|| $user->hasRight('agenda', 'allactions', 'delete')) {
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate' && $usercancreate) {
1233 1233
 	$error = 0;
1234 1234
 
1235
-	$shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel');		// We take the date visible by user $newdate is also date visible by user.
1235
+	$shour = (int) dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user.
1236 1236
 	$smin = (int) dol_print_date($object->datep, "%M", 'tzuserrel');
1237 1237
 
1238 1238
 	$newdate = GETPOST('newdate', 'alpha');
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 								if (new_startdate > old_enddate) {
1408 1408
 									var timeDiff = old_enddate - old_startdate;
1409 1409
 									var new_enddate = new Date(new_startdate.getTime() + timeDiff);
1410
-									$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
1410
+									$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'"));
1411 1411
 									$("#p2day").val(new_enddate.getDate());
1412 1412
 									$("#p2month").val(new_enddate.getMonth() + 1);
1413 1413
 									$("#p2year").val(new_enddate.getFullYear());
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
 		$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV');
1480 1480
 		print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
1481 1481
 		$selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default);
1482
-		print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1);	// TODO Replace 0 with -2 in onlyautoornot
1482
+		print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot
1483 1483
 		print '</td></tr>';
1484 1484
 	}
1485 1485
 
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
 		*/
1575 1575
 
1576 1576
 		// limit date
1577
-		$repeateventlimitdate = empty($repeateventlimitdate) ?  (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate;
1577
+		$repeateventlimitdate = empty($repeateventlimitdate) ? (dol_now() + ((24 * 3600 * 365) + 1)) : $repeateventlimitdate;
1578 1578
 
1579 1579
 		print '<div class="hidden marginrightonly inline-block repeateventlimitdate">';
1580 1580
 		print $langs->trans("Until")." ";
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
 		}
1859 1859
 		//var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject);
1860 1860
 
1861
-		if (! in_array($origin, array('societe', 'project', 'project_task', 'user'))) {
1861
+		if (!in_array($origin, array('societe', 'project', 'project_task', 'user'))) {
1862 1862
 			// We do not use link for object that already contains a hard coded field to make links with agenda events
1863 1863
 			print '<tr><td class="titlefieldcreate">'.$langs->trans("LinkedObject").'</td>';
1864 1864
 			print '<td colspan="3">';
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 						$("#addreminder").prop("checked", true);
1949 1949
 
1950 1950
 						// Set period with default reminder period
1951
-						$("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset) . '\');
1951
+						$("[name=\"offsetvalue\"]").val(\'' . dol_escape_js((string) $reminderDefaultOffset).'\');
1952 1952
 						$("#select_offsetunittype_duration").select2("destroy");
1953 1953
 						$("#select_offsetunittype_duration").val(\''.dol_escape_js($reminderDefaultUnit).'\');
1954 1954
 						$("#select_offsetunittype_duration").select2();
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 									if (new_startdate > old_enddate) {
2107 2107
 										var timeDiff = old_enddate - old_startdate;
2108 2108
 										var new_enddate = new Date(new_startdate.getTime() + timeDiff);
2109
-										$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
2109
+										$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput').'"));
2110 2110
 										$("#p2day").val(new_enddate.getDate());
2111 2111
 										$("#p2month").val(new_enddate.getMonth() + 1);
2112 2112
 										$("#p2year").val(new_enddate.getFullYear());
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 		if ($backtopage) {
2132 2132
 			print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : '').'">';
2133 2133
 		}
2134
-		if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
2134
+		if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && !preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) {
2135 2135
 			print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
2136 2136
 		}
2137 2137
 
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
 					});
2581 2581
 			   })';
2582 2582
 			print '</script>'."\n";
2583
-			print '</div>';		// End of div for reminderparameters
2583
+			print '</div>'; // End of div for reminderparameters
2584 2584
 		}
2585 2585
 
2586 2586
 		print dol_get_fiche_end();
@@ -2861,7 +2861,7 @@  discard block
 block discarded – undo
2861 2861
 
2862 2862
 		// Priority
2863 2863
 		if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) {
2864
-			print '<tr><td class="nowrap" class="titlefield">' . $langs->trans("Priority") . '</td><td>';
2864
+			print '<tr><td class="nowrap" class="titlefield">'.$langs->trans("Priority").'</td><td>';
2865 2865
 			print($object->priority ? $object->priority : '');
2866 2866
 			print '</td></tr>';
2867 2867
 		}
Please login to merge, or discard this patch.
htdocs/blockedlog/admin/blockedlog.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 $block_static->loadTrackedEvents();
93 93
 
94 94
 $title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog');
95
-$help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
95
+$help_url = "EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
96 96
 
97 97
 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-blockedlog page-admin_blockedlog');
98 98
 
Please login to merge, or discard this patch.
htdocs/compta/facture/class/facture.class.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 			$this->mode_reglement_id = 0;
496 496
 		}
497 497
 		$this->status = self::STATUS_DRAFT;
498
-		$this->statut = self::STATUS_DRAFT;	// deprecated
498
+		$this->statut = self::STATUS_DRAFT; // deprecated
499 499
 
500 500
 		if (!empty($this->multicurrency_code)) {
501 501
 			// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 			}
585 585
 
586 586
 			// Define the entity
587
-			$this->entity            = $_facrec->entity; // Invoice created in same entity than template
587
+			$this->entity = $_facrec->entity; // Invoice created in same entity than template
588 588
 
589 589
 			// Fields coming from GUI.
590 590
 			// @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
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 				$this->mode_reglement_id = 0;
624 624
 			}
625 625
 			$this->status = self::STATUS_DRAFT;
626
-			$this->statut = self::STATUS_DRAFT;	// deprecated
626
+			$this->statut = self::STATUS_DRAFT; // deprecated
627 627
 
628 628
 			$this->linked_objects = $_facrec->linkedObjectsIds;
629 629
 			// We do not add link to template invoice or next invoice will be linked to all generated invoices
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 
875 875
 						// Complete vat rate with code
876 876
 						$vatrate = $newinvoiceline->tva_tx;
877
-						if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', (string) $vatrate)) {
877
+						if ($newinvoiceline->vat_src_code && !preg_match('/\(.*\)/', (string) $vatrate)) {
878 878
 							$vatrate .= ' ('.$newinvoiceline->vat_src_code.')';
879 879
 						}
880 880
 
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 						($_facrec->lines[$i]->date_end_fill == 1 && $previousdaynextdatewhen) ? $previousdaynextdatewhen : '',
1087 1087
 						0,
1088 1088
 						$tva_npr,
1089
-						0,  // fk_remise_except
1089
+						0, // fk_remise_except
1090 1090
 						'HT',
1091 1091
 						0,
1092 1092
 						$_facrec->lines[$i]->product_type,
@@ -1096,11 +1096,11 @@  discard block
 block discarded – undo
1096 1096
 						0,
1097 1097
 						$fk_parent_line,
1098 1098
 						$fk_product_fournisseur_price,
1099
-						is_null($buyprice) ? '' : $buyprice,	// do not use (float) here, it may be ''
1099
+						is_null($buyprice) ? '' : $buyprice, // do not use (float) here, it may be ''
1100 1100
 						$_facrec->lines[$i]->label,
1101 1101
 						empty($_facrec->lines[$i]->array_options) ? null : $_facrec->lines[$i]->array_options,
1102
-						100,	// situation percent is undefined on recurring invoice lines
1103
-						0,  // fk_prev_id
1102
+						100, // situation percent is undefined on recurring invoice lines
1103
+						0, // fk_prev_id
1104 1104
 						$_facrec->lines[$i]->fk_unit,
1105 1105
 						$_facrec->lines[$i]->multicurrency_subprice,
1106 1106
 						$_facrec->lines[$i]->ref_ext,
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
 
1196 1196
 		$facture->fk_facture_source = $this->fk_facture_source;
1197 1197
 		$facture->type 			    = $this->type;
1198
-		$facture->subtype 			= $this->subtype;
1198
+		$facture->subtype = $this->subtype;
1199 1199
 		$facture->socid 		    = $this->socid;
1200 1200
 		$facture->date              = $this->date;
1201 1201
 		$facture->date_pointoftax   = $this->date_pointoftax;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 		$facture->origin            = $this->origin;
1214 1214
 		$facture->origin_id         = $this->origin_id;
1215
-		$facture->fk_account         = $this->fk_account;
1215
+		$facture->fk_account = $this->fk_account;
1216 1216
 
1217 1217
 		$facture->lines = $this->lines; // Array of lines of invoice
1218 1218
 		$facture->situation_counter = $this->situation_counter;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
 		$object->date_modification = '';
1318 1318
 		$object->date_validation    = '';
1319 1319
 		$object->ref_client         = '';
1320
-		$object->ref_customer         = '';
1320
+		$object->ref_customer = '';
1321 1321
 		$object->close_code         = '';
1322 1322
 		$object->close_note         = '';
1323 1323
 		if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) {
@@ -1479,8 +1479,8 @@  discard block
 block discarded – undo
1479 1479
 		$this->fk_account = $object->fk_account;
1480 1480
 		$this->cond_reglement_id    = $object->cond_reglement_id;
1481 1481
 		$this->mode_reglement_id    = $object->mode_reglement_id;
1482
-		$this->fk_incoterms    		= $object->fk_incoterms;
1483
-		$this->location_incoterms	= $object->location_incoterms;
1482
+		$this->fk_incoterms = $object->fk_incoterms;
1483
+		$this->location_incoterms = $object->location_incoterms;
1484 1484
 		$this->availability_id      = $object->availability_id;
1485 1485
 		$this->demand_reason_id     = $object->demand_reason_id;
1486 1486
 		$this->delivery_date        = $object->delivery_date;
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 	{
1693 1693
 		global $conf, $langs, $hookmanager, $action;
1694 1694
 
1695
-		if (! in_array($origin->element, array('propal', 'commande'))) {
1695
+		if (!in_array($origin->element, array('propal', 'commande'))) {
1696 1696
 			$origin->error = 'ErrorCanOnlyAutomaticallyGenerateADepositFromProposalOrOrder';
1697 1697
 			return null;
1698 1698
 		}
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
 			return null;
1703 1703
 		}
1704 1704
 
1705
-		require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
1705
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
1706 1706
 
1707 1707
 		if ($date > (dol_get_last_hour(dol_now('tzuserrel')) + getDolGlobalInt('INVOICE_MAX_FUTURE_DELAY'))) {
1708 1708
 			$origin->error = 'ErrorDateIsInFuture';
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 		$deposit->pos_source = $origin->pos_source;
1748 1748
 		$deposit->model_pdf = 'crabe';
1749 1749
 
1750
-		$modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type;
1750
+		$modelByTypeConfName = 'FACTURE_ADDON_PDF_'.$deposit->type;
1751 1751
 
1752 1752
 		if (getDolGlobalString($modelByTypeConfName)) {
1753 1753
 			$deposit->model_pdf = getDolGlobalString($modelByTypeConfName);
@@ -1807,10 +1807,10 @@  discard block
 block discarded – undo
1807 1807
 					$descriptions[$key] = '';
1808 1808
 				}
1809 1809
 				$TTotalByTva[$key] += $line->total_ttc;
1810
-				$descriptions[$key] .= '<li>' . (!empty($line->product_ref) ? $line->product_ref . ' - ' : '');
1811
-				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label . ' - ' : '');
1812
-				$descriptions[$key] .= $langs->trans('Qty') . ' : ' . $line->qty;
1813
-				$descriptions[$key] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '</li>';
1810
+				$descriptions[$key] .= '<li>'.(!empty($line->product_ref) ? $line->product_ref.' - ' : '');
1811
+				$descriptions[$key] .= (!empty($line->product_label) ? $line->product_label.' - ' : '');
1812
+				$descriptions[$key] .= $langs->trans('Qty').' : '.$line->qty;
1813
+				$descriptions[$key] .= ' - '.$langs->trans('TotalHT').' : '.price($line->total_ht).'</li>';
1814 1814
 			}
1815 1815
 
1816 1816
 			foreach ($TTotalByTva as $tva => &$total) {
@@ -1834,10 +1834,10 @@  discard block
 block discarded – undo
1834 1834
 				$totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ?
1835 1835
 				$tva_tx = $lines[$i]->tva_tx;
1836 1836
 				$amountdeposit[$tva_tx] += ((float) $lines[$i]->total_ht * (float) $origin->deposit_percent) / 100;
1837
-				$descriptions[$tva_tx] .= '<li>' . (!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : '');
1838
-				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : '');
1839
-				$descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty;
1840
-				$descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '</li>';
1837
+				$descriptions[$tva_tx] .= '<li>'.(!empty($lines[$i]->product_ref) ? $lines[$i]->product_ref.' - ' : '');
1838
+				$descriptions[$tva_tx] .= (!empty($lines[$i]->product_label) ? $lines[$i]->product_label.' - ' : '');
1839
+				$descriptions[$tva_tx] .= $langs->trans('Qty').' : '.$lines[$i]->qty;
1840
+				$descriptions[$tva_tx] .= ' - '.$langs->trans('TotalHT').' : '.price($lines[$i]->total_ht).'</li>';
1841 1841
 			}
1842 1842
 
1843 1843
 			if ($totalamount == 0) {
@@ -1852,11 +1852,11 @@  discard block
 block discarded – undo
1852 1852
 				continue;
1853 1853
 			}
1854 1854
 
1855
-			$descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref;
1855
+			$descline = '(DEPOSIT) ('.$origin->deposit_percent.'%) - '.$origin->ref;
1856 1856
 
1857 1857
 			// Hidden conf
1858 1858
 			if (getDolGlobalString('INVOICE_DEPOSIT_VARIABLE_MODE_DETAIL_LINES_IN_DESCRIPTION') && !empty($descriptions[$tva])) {
1859
-				$descline .= '<ul>' . $descriptions[$tva] . '</ul>';
1859
+				$descline .= '<ul>'.$descriptions[$tva].'</ul>';
1860 1860
 			}
1861 1861
 
1862 1862
 			$addlineResult = $deposit->addline(
@@ -2243,7 +2243,7 @@  discard block
 block discarded – undo
2243 2243
 					: '';
2244 2244
 
2245 2245
 				if ($type !== 'separate') {
2246
-					if (in_array($type, array('point','multipts','linestrg','polygon'))) {
2246
+					if (in_array($type, array('point', 'multipts', 'linestrg', 'polygon'))) {
2247 2247
 						$sql .= ", ST_AsWKT(ef.".$key.") as ".$key;
2248 2248
 					} else {
2249 2249
 						$sql .= ", ef.".$key;
@@ -2286,9 +2286,9 @@  discard block
 block discarded – undo
2286 2286
 				$this->id = $obj->rowid;
2287 2287
 				$this->entity = $obj->entity;
2288 2288
 
2289
-				$this->ref					= $obj->ref;
2290
-				$this->ref_client			= $obj->ref_client;
2291
-				$this->ref_customer			= $obj->ref_client;
2289
+				$this->ref = $obj->ref;
2290
+				$this->ref_client = $obj->ref_client;
2291
+				$this->ref_customer = $obj->ref_client;
2292 2292
 				$this->ref_ext				= $obj->ref_ext;
2293 2293
 				$this->type					= $obj->type;
2294 2294
 				$this->subtype				= $obj->subtype;
@@ -2314,7 +2314,7 @@  discard block
 block discarded – undo
2314 2314
 				$this->fk_project = $obj->fk_project;
2315 2315
 				$this->project = null; // Clear if another value was already set by fetch_projet
2316 2316
 
2317
-				$this->statut = $obj->status;	// deprecated
2317
+				$this->statut = $obj->status; // deprecated
2318 2318
 				$this->status = $obj->status;
2319 2319
 
2320 2320
 				$this->date_lim_reglement = $this->db->jdate($obj->dlr);
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
 				$this->fk_fac_rec_source	= $obj->fk_fac_rec_source;
2331 2331
 				$this->note = $obj->note_private; // deprecated
2332 2332
 				$this->note_private = $obj->note_private;
2333
-				$this->note_public			= $obj->note_public;
2333
+				$this->note_public = $obj->note_public;
2334 2334
 				$this->user_creation_id     = $obj->fk_user_author;
2335 2335
 				$this->user_validation_id   = $obj->fk_user_valid;
2336 2336
 				$this->user_modification_id = $obj->fk_user_modif;
@@ -2383,15 +2383,15 @@  discard block
 block discarded – undo
2383 2383
 
2384 2384
 							// date/datetime
2385 2385
 							if (in_array($type, array('date', 'datetime'))) {
2386
-								$this->array_options['options_' . $key] = $this->db->jdate($rawval);
2386
+								$this->array_options['options_'.$key] = $this->db->jdate($rawval);
2387 2387
 							} elseif ($type == 'password') {
2388 2388
 								if (!empty($rawval) && preg_match('/^dolcrypt:/', $rawval)) {
2389
-									$this->array_options['options_' . $key] = dolDecrypt($rawval);
2389
+									$this->array_options['options_'.$key] = dolDecrypt($rawval);
2390 2390
 								} else {
2391
-									$this->array_options['options_' . $key] = $rawval;
2391
+									$this->array_options['options_'.$key] = $rawval;
2392 2392
 								}
2393 2393
 							} else {
2394
-								$this->array_options['options_' . $key] = $rawval;
2394
+								$this->array_options['options_'.$key] = $rawval;
2395 2395
 							}
2396 2396
 						}
2397 2397
 					}
@@ -2402,7 +2402,7 @@  discard block
 block discarded – undo
2402 2402
 							if (empty($conf->disable_compute)) {
2403 2403
 								global $objectoffield;
2404 2404
 								$objectoffield = $this;
2405
-								$this->array_options['options_' . $key] = dol_eval((string) $extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
2405
+								$this->array_options['options_'.$key] = dol_eval((string) $extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
2406 2406
 							}
2407 2407
 						}
2408 2408
 					}
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
 					: '';
2499 2499
 
2500 2500
 				if ($type !== 'separate') {
2501
-					if (in_array($type, array('point','multipts','linestrg','polygon'))) {
2501
+					if (in_array($type, array('point', 'multipts', 'linestrg', 'polygon'))) {
2502 2502
 						$sql .= ", ST_AsWKT(ef.".$key.") as ".$key;
2503 2503
 					} else {
2504 2504
 						$sql .= ", ef.".$key;
@@ -2538,7 +2538,7 @@  discard block
 block discarded – undo
2538 2538
 				$line->ref              = $objp->product_ref; // Ref product
2539 2539
 				$line->product_ref      = $objp->product_ref; // Ref product
2540 2540
 				$line->libelle          = $objp->product_label; // deprecated
2541
-				$line->product_label 	= $objp->product_label; // Label product
2541
+				$line->product_label = $objp->product_label; // Label product
2542 2542
 				$line->product_barcode  = $objp->product_barcode; // Barcode number product
2543 2543
 				$line->product_desc     = $objp->product_desc; // Description product
2544 2544
 				$line->fk_product_type  = $objp->fk_product_type; // Type of product
@@ -2604,15 +2604,15 @@  discard block
 block discarded – undo
2604 2604
 
2605 2605
 							// date/datetime
2606 2606
 							if (in_array($type, array('date', 'datetime'))) {
2607
-								$line->array_options['options_' . $key] = $this->db->jdate($rawval);
2607
+								$line->array_options['options_'.$key] = $this->db->jdate($rawval);
2608 2608
 							} elseif ($type == 'password') {
2609 2609
 								if (!empty($rawval) && preg_match('/^dolcrypt:/', $rawval)) {
2610
-									$line->array_options['options_' . $key] = dolDecrypt($rawval);
2610
+									$line->array_options['options_'.$key] = dolDecrypt($rawval);
2611 2611
 								} else {
2612
-									$line->array_options['options_' . $key] = $rawval;
2612
+									$line->array_options['options_'.$key] = $rawval;
2613 2613
 								}
2614 2614
 							} else {
2615
-								$line->array_options['options_' . $key] = $rawval;
2615
+								$line->array_options['options_'.$key] = $rawval;
2616 2616
 							}
2617 2617
 						}
2618 2618
 					}
@@ -2623,7 +2623,7 @@  discard block
 block discarded – undo
2623 2623
 							if (empty($conf->disable_compute)) {
2624 2624
 								global $objectoffield;
2625 2625
 								$objectoffield = $line;
2626
-								$line->array_options['options_' . $key] = dol_eval((string) $extrafields->attributes[$this->table_element_line]['computed'][$key], 1, 0, '2');
2626
+								$line->array_options['options_'.$key] = dol_eval((string) $extrafields->attributes[$this->table_element_line]['computed'][$key], 1, 0, '2');
2627 2627
 							}
2628 2628
 						}
2629 2629
 					}
@@ -3544,10 +3544,10 @@  discard block
 block discarded – undo
3544 3544
 		if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'creer'))
3545 3545
 		|| (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
3546 3546
 			$this->error = 'Permission denied';
3547
-			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3547
+			dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
3548 3548
 			return -1;
3549 3549
 		}
3550
-		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) &&	// empty should not happened, but when it occurs, the test save life
3550
+		if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
3551 3551
 			getDolGlobalString('FAC_FORCE_DATE_VALIDATION')						// If option enabled, we force invoice date
3552 3552
 		) {
3553 3553
 			$this->date = dol_now();
@@ -3731,7 +3731,7 @@  discard block
 block discarded – undo
3731 3731
 				for ($i = 0; $i < $cpt; $i++) {
3732 3732
 					if ($this->lines[$i]->fk_product > 0) {
3733 3733
 						$mouvP = new MouvementStock($this->db);
3734
-						$mouvP->origin = &$this;	// deprecated
3734
+						$mouvP->origin = &$this; // deprecated
3735 3735
 						$mouvP->setOrigin($this->element, $this->id);
3736 3736
 
3737 3737
 						// We decrease stock for product
@@ -3897,7 +3897,7 @@  discard block
 block discarded – undo
3897 3897
 			// Set new ref and define current status
3898 3898
 			if (!$error) {
3899 3899
 				$this->ref = $num;
3900
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
3900
+				$this->statut = self::STATUS_VALIDATED; // deprecated
3901 3901
 				$this->status = self::STATUS_VALIDATED;
3902 3902
 				$this->date_validation = $now;
3903 3903
 				$i = 0;
@@ -3923,13 +3923,13 @@  discard block
 block discarded – undo
3923 3923
 						if ($this->situation_final) {
3924 3924
 							// If we must change situation_final
3925 3925
 							$this->situation_final = 0;
3926
-							$this->setFinal($user, 1);		// Trigger is disabled, already run by the validate
3926
+							$this->setFinal($user, 1); // Trigger is disabled, already run by the validate
3927 3927
 						}
3928 3928
 					} else {
3929 3929
 						if (!$this->situation_final) {
3930 3930
 							// If we must change situation_final
3931 3931
 							$this->situation_final = 1;
3932
-							$this->setFinal($user, 1);		// Trigger is disabled, already run by the validate
3932
+							$this->setFinal($user, 1); // Trigger is disabled, already run by the validate
3933 3933
 						}
3934 3934
 					}
3935 3935
 				}
@@ -4082,7 +4082,7 @@  discard block
 block discarded – undo
4082 4082
 
4083 4083
 			if ($error == 0) {
4084 4084
 				$old_statut = $this->status;
4085
-				$this->statut = self::STATUS_DRAFT;	// deprecated
4085
+				$this->statut = self::STATUS_DRAFT; // deprecated
4086 4086
 				$this->status = self::STATUS_DRAFT;
4087 4087
 
4088 4088
 				// Call trigger
@@ -4680,7 +4680,7 @@  discard block
 block discarded – undo
4680 4680
 				$this->line->rang = $rangmax + 1;
4681 4681
 			}
4682 4682
 			$apply_abs_price_on_credit_note = false;
4683
-			if ($this->type == self::TYPE_CREDIT_NOTE  && !getDolGlobalInt('FACTURE_ENABLE_NEGATIVE_LINES') && !getDolGlobalInt('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
4683
+			if ($this->type == self::TYPE_CREDIT_NOTE && !getDolGlobalInt('FACTURE_ENABLE_NEGATIVE_LINES') && !getDolGlobalInt('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
4684 4684
 				$apply_abs_price_on_credit_note = true;
4685 4685
 			}
4686 4686
 
@@ -5116,7 +5116,7 @@  discard block
 block discarded – undo
5116 5116
 		}
5117 5117
 
5118 5118
 		if (!empty($addon)) {
5119
-			dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
5119
+			dol_syslog("Call getNextNumRef with ".$addonConstName." = ".getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
5120 5120
 
5121 5121
 			$mybool = false;
5122 5122
 
@@ -5588,14 +5588,14 @@  discard block
 block discarded – undo
5588 5588
 		$this->fk_incoterms = 0;
5589 5589
 		$this->location_incoterms = '';
5590 5590
 
5591
-		$this->pos_print_counter = 0;	// Already printed 0 times
5592
-		$this->email_sent_counter = 0;	// Already sent by email 0 times
5591
+		$this->pos_print_counter = 0; // Already printed 0 times
5592
+		$this->email_sent_counter = 0; // Already sent by email 0 times
5593 5593
 
5594 5594
 		$this->status = 0;
5595 5595
 
5596 5596
 		if (empty($option) || $option != 'nolines') {
5597 5597
 			// Lines
5598
-			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5);	// We can force the nb of lines to test from command line (but not more than 1000)
5598
+			$nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000)
5599 5599
 			$xnbp = 0;
5600 5600
 			while ($xnbp < $nbp) {
5601 5601
 				$line = new FactureLigne($this->db);
@@ -6223,14 +6223,14 @@  discard block
 block discarded – undo
6223 6223
 		if (!empty($paymentmode) && $paymentmode != 'all') {
6224 6224
 			$sql .= ", ".MAIN_DB_PREFIX."c_paiement as cp";
6225 6225
 		}
6226
-		$sql .= " WHERE f.paye = 0";	// Only unpaid
6227
-		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;	// Only validated status
6226
+		$sql .= " WHERE f.paye = 0"; // Only unpaid
6227
+		$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED; // Only validated status
6228 6228
 		if ($datetouse == 'invoicedate') {
6229 6229
 			$sql .= " AND f.datef = '".$this->db->idate($tmpidate, 'gmt')."'";
6230 6230
 		} else {
6231 6231
 			$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
6232 6232
 		}
6233
-		$sql .= " AND f.entity IN (".getEntity('facture', 0).")";	// One batch processes only one company (no sharing)
6233
+		$sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch processes only one company (no sharing)
6234 6234
 		if (!empty($paymentmode) && $paymentmode != 'all') {
6235 6235
 			$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
6236 6236
 		}
@@ -6456,7 +6456,7 @@  discard block
 block discarded – undo
6456 6456
 							$actioncomm->create($user);
6457 6457
 						}
6458 6458
 
6459
-						$this->db->commit();	// We always commit
6459
+						$this->db->commit(); // We always commit
6460 6460
 					}
6461 6461
 
6462 6462
 					if ($errormesg) {
@@ -6499,7 +6499,7 @@  discard block
 block discarded – undo
6499 6499
 		// get date of last validated invoices of same type
6500 6500
 		$sql  = "SELECT datef";
6501 6501
 		$sql .= " FROM ".MAIN_DB_PREFIX."facture";
6502
-		$sql .= " WHERE type = " . (int) $this->type ;
6502
+		$sql .= " WHERE type = ".(int) $this->type;
6503 6503
 		$sql .= " AND date_valid IS NOT NULL";
6504 6504
 		$sql .= " AND entity IN (".getEntity('invoice').")";
6505 6505
 		$sql .= " ORDER BY datef DESC LIMIT 1";
Please login to merge, or discard this patch.
htdocs/asset/class/asset.class.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 	);
71 71
 
72 72
 
73
-	const STATUS_DRAFT = 0; 	// Draft
74
-	const STATUS_VALIDATED = 1; 	// In progress
75
-	const STATUS_DISPOSED = 9;	// Disposed
73
+	const STATUS_DRAFT = 0; // Draft
74
+	const STATUS_VALIDATED = 1; // In progress
75
+	const STATUS_DISPOSED = 9; // Disposed
76 76
 
77 77
 	/**
78 78
 	 *  'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
 		// Check parameters
632 632
 		$error = 0;
633 633
 		if (empty($this->id)) {
634
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
634
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
635 635
 			$error++;
636 636
 		}
637 637
 		if (empty($this->fk_asset_model)) {
638
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
638
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
639 639
 			$error++;
640 640
 		}
641 641
 		if ($error) {
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 
647 647
 		// Get depreciation options
648 648
 		//---------------------------
649
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
649
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
650 650
 		$options_model = new AssetDepreciationOptions($this->db);
651 651
 		$result = $options_model->fetchDeprecationOptions(0, $this->fk_asset_model);
652 652
 		if ($result < 0) {
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		// Get accountancy codes
682 682
 		//---------------------------
683 683
 		if (!$error) {
684
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
684
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
685 685
 			$accountancy_codes_model = new AssetAccountancyCodes($this->db);
686 686
 			$result = $accountancy_codes_model->fetchAccountancyCodes(0, $this->fk_asset_model);
687 687
 			if ($result < 0) {
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 		// Check parameters
741 741
 		$error = 0;
742 742
 		if (empty($this->id)) {
743
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
743
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
744 744
 			$error++;
745 745
 		}
746 746
 		if ($error) {
@@ -748,14 +748,14 @@  discard block
 block discarded – undo
748 748
 		}
749 749
 
750 750
 		$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht,";
751
-		$sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping";
752
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
753
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
751
+		$sql .= " ".$this->db->ifsql('EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0')." AS bookkeeping";
752
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
753
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
754 754
 		$sql .= " ORDER BY ad.depreciation_date ASC";
755 755
 
756 756
 		$resql = $this->db->query($sql);
757 757
 		if (!$resql) {
758
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
758
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
759 759
 			return -1;
760 760
 		}
761 761
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 		// Check parameters
793 793
 		$error = 0;
794 794
 		if (empty($this->id)) {
795
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
795
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
796 796
 			$error++;
797 797
 		}
798 798
 		if ($error) {
@@ -814,14 +814,14 @@  discard block
 block discarded – undo
814 814
 		*/
815 815
 
816 816
 		$sql = "SELECT COUNT(*) AS has_bookkeeping";
817
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
818
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
819
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
817
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
818
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
819
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
820 820
 		$sql .= " AND iab.fk_docdet IS NOT NULL";
821 821
 
822 822
 		$resql = $this->db->query($sql);
823 823
 		if (!$resql) {
824
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
824
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
825 825
 			return -1;
826 826
 		}
827 827
 
@@ -859,28 +859,28 @@  discard block
 block discarded – undo
859 859
 		// Check parameters
860 860
 		$error = 0;
861 861
 		if (empty($this->id)) {
862
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
862
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
863 863
 			$error++;
864 864
 		}
865 865
 		if ($error) {
866 866
 			return -1;
867 867
 		}
868 868
 
869
-		$sql = "INSERT INTO " . MAIN_DB_PREFIX . "asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
869
+		$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
870 870
 		$sql .= " VALUES ( ";
871
-		$sql .= " " . (int) $this->id;
872
-		$sql .= ", '" . $this->db->escape($mode) . "'";
873
-		$sql .= ", '" . $this->db->escape($ref) . "'";
874
-		$sql .= ", '" . $this->db->idate($depreciation_date) . "'";
875
-		$sql .= ", " . (float) $depreciation_ht;
876
-		$sql .= ", " . (float) $cumulative_depreciation_ht;
877
-		$sql .= ", '" . $this->db->escape($accountancy_code_debit) . "'";
878
-		$sql .= ", '" . $this->db->escape($accountancy_code_credit) . "'";
871
+		$sql .= " ".(int) $this->id;
872
+		$sql .= ", '".$this->db->escape($mode)."'";
873
+		$sql .= ", '".$this->db->escape($ref)."'";
874
+		$sql .= ", '".$this->db->idate($depreciation_date)."'";
875
+		$sql .= ", ".(float) $depreciation_ht;
876
+		$sql .= ", ".(float) $cumulative_depreciation_ht;
877
+		$sql .= ", '".$this->db->escape($accountancy_code_debit)."'";
878
+		$sql .= ", '".$this->db->escape($accountancy_code_credit)."'";
879 879
 		$sql .= ")";
880 880
 
881 881
 		$resql = $this->db->query($sql);
882 882
 		if (!$resql) {
883
-			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine') . ': ' . $this->db->lasterror();
883
+			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine').': '.$this->db->lasterror();
884 884
 			return -1;
885 885
 		}
886 886
 
@@ -903,20 +903,20 @@  discard block
 block discarded – undo
903 903
 		// Check parameters
904 904
 		$error = 0;
905 905
 		if (empty($this->id)) {
906
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
906
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
907 907
 			$error++;
908 908
 		}
909 909
 		if ($error) {
910 910
 			return -1;
911 911
 		}
912 912
 
913
-		if (! empty($this->not_depreciated)) {
913
+		if (!empty($this->not_depreciated)) {
914 914
 			return 1;
915 915
 		}
916 916
 
917 917
 		// Get depreciation options
918 918
 		//---------------------------
919
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
919
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
920 920
 		$options = new AssetDepreciationOptions($this->db);
921 921
 		$result = $options->fetchDeprecationOptions($this->id);
922 922
 		if ($result < 0) {
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
 
928 928
 		// Get accountancy codes
929 929
 		//---------------------------
930
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
930
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
931 931
 		$accountancy_codes = new AssetAccountancyCodes($this->db);
932 932
 		$result = $accountancy_codes->fetchAccountancyCodes($this->id);
933 933
 		if ($result < 0) {
@@ -943,20 +943,20 @@  discard block
 block discarded – undo
943 943
 		foreach ($options->deprecation_options as $mode_key => $fields) {
944 944
 			$modes[$mode_key] = $this->db->escape($mode_key);
945 945
 		}
946
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
947
-		$sql .= " WHERE fk_asset = " . (int) $this->id;
948
-		$sql .= " AND depreciation_mode NOT IN ('" . $this->db->sanitize(implode("', '", $modes)) . "')";
946
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation";
947
+		$sql .= " WHERE fk_asset = ".(int) $this->id;
948
+		$sql .= " AND depreciation_mode NOT IN ('".$this->db->sanitize(implode("', '", $modes))."')";
949 949
 
950 950
 		$resql = $this->db->query($sql);
951 951
 		if (!$resql) {
952
-			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
952
+			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
953 953
 			$error++;
954 954
 		}
955 955
 
956 956
 		if (!$error) {
957 957
 			// Get fiscal period
958
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
959
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
958
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
959
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
960 960
 
961 961
 			// @FIXME getCurrentPeriodOfFiscalYear return the first period found. What if there is several ? And what if not closed ? And what if end date not yet defined.
962 962
 			$dates = getCurrentPeriodOfFiscalYear($this->db, $conf, $this->date_start > $this->date_acquisition ? $this->date_start : $this->date_acquisition);
@@ -993,17 +993,17 @@  discard block
 block discarded – undo
993 993
 				*/
994 994
 
995 995
 				$sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht";
996
-				$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
997
-				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
998
-				$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
999
-				$sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
996
+				$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
997
+				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
998
+				$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
999
+				$sql .= " AND ad.depreciation_mode = '".$this->db->escape($mode_key)."'";
1000 1000
 				$sql .= " AND iab.fk_docdet IS NOT NULL";
1001 1001
 				$sql .= " ORDER BY ad.depreciation_date DESC";
1002 1002
 				$sql .= " LIMIT 1";
1003 1003
 
1004 1004
 				$resql = $this->db->query($sql);
1005 1005
 				if (!$resql) {
1006
-					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror();
1006
+					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key).': '.$this->db->lasterror();
1007 1007
 					$error++;
1008 1008
 					break;
1009 1009
 				}
@@ -1015,27 +1015,27 @@  discard block
 block discarded – undo
1015 1015
 				}
1016 1016
 
1017 1017
 				// Set last cumulative depreciation
1018
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1019
-				$sql .= " SET total_amount_last_depreciation_ht = " . (empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1020
-				$sql .= " WHERE fk_asset = " . (int) $this->id;
1018
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1019
+				$sql .= " SET total_amount_last_depreciation_ht = ".(empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
1020
+				$sql .= " WHERE fk_asset = ".(int) $this->id;
1021 1021
 				$resql = $this->db->query($sql);
1022 1022
 				if (!$resql) {
1023
-					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1023
+					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1024 1024
 					$error++;
1025 1025
 					break;
1026 1026
 				}
1027 1027
 
1028 1028
 				// Delete old lines
1029
-				$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1030
-				$sql .= " WHERE fk_asset = " . (int) $this->id;
1031
-				$sql .= " AND depreciation_mode = '" . $this->db->escape($mode_key) . "'";
1032
-				$sql .= " AND NOT EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset' AND fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid)";
1029
+				$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation";
1030
+				$sql .= " WHERE fk_asset = ".(int) $this->id;
1031
+				$sql .= " AND depreciation_mode = '".$this->db->escape($mode_key)."'";
1032
+				$sql .= " AND NOT EXISTS (SELECT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset' AND fk_docdet = ".MAIN_DB_PREFIX."asset_depreciation.rowid)";
1033 1033
 				if ($last_depreciation_date !== "") {
1034 1034
 					$sql .= " AND ref <> ''";
1035 1035
 				}
1036 1036
 				$resql = $this->db->query($sql);
1037 1037
 				if (!$resql) {
1038
-					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
1038
+					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
1039 1039
 					$error++;
1040 1040
 					break;
1041 1041
 				}
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 				//$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
1105 1105
 				$first_period_date = $fiscal_period_start;
1106 1106
 
1107
-				$ref_date_format = "%Y" . ($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '') . ($fields['duration_type'] == 2 ? '-%d' : '');
1107
+				$ref_date_format = "%Y".($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '').($fields['duration_type'] == 2 ? '-%d' : '');
1108 1108
 
1109 1109
 				// Loop security
1110 1110
 				$idx_loop = 0;
@@ -1126,9 +1126,9 @@  discard block
 block discarded – undo
1126 1126
 
1127 1127
 						$period_begin = dol_print_date($fiscal_period_start, $ref_date_format);
1128 1128
 						$period_end = dol_print_date($fiscal_period_end, $ref_date_format);
1129
-						$ref = $period_begin . ($period_begin != $period_end ? ' - ' . $period_end : '');
1129
+						$ref = $period_begin.($period_begin != $period_end ? ' - '.$period_end : '');
1130 1130
 						if ($fiscal_period_start <= $disposal_date && $disposal_date <= $fiscal_period_end) {
1131
-							$ref .= ' - ' . $langs->transnoentitiesnoconv('AssetDisposal');
1131
+							$ref .= ' - '.$langs->transnoentitiesnoconv('AssetDisposal');
1132 1132
 						}
1133 1133
 
1134 1134
 						$begin_date = $fiscal_period_start < $start_date && $start_date <= $fiscal_period_end ? $start_date : $fiscal_period_start;
@@ -1218,7 +1218,7 @@  discard block
 block discarded – undo
1218 1218
 		// Check parameters
1219 1219
 		$error = 0;
1220 1220
 		if (empty($asset_depreciation_id)) {
1221
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
1221
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
1222 1222
 			$error++;
1223 1223
 		}
1224 1224
 		if ($error) {
@@ -1227,28 +1227,28 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 		$this->db->begin();
1229 1229
 
1230
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
1230
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
1231 1231
 		$options = new AssetDepreciationOptions($this->db);
1232 1232
 
1233 1233
 		// Get last depreciation lines save in bookkeeping
1234 1234
 		//-----------------------------------------------------
1235 1235
 		$sql = "SELECT fk_asset, depreciation_mode, cumulative_depreciation_ht";
1236
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1237
-		$sql .= " WHERE rowid = " . (int) $asset_depreciation_id;
1236
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation";
1237
+		$sql .= " WHERE rowid = ".(int) $asset_depreciation_id;
1238 1238
 		$resql = $this->db->query($sql);
1239 1239
 		if (!$resql) {
1240
-			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation') . ': ' . $this->db->lasterror();
1240
+			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation').': '.$this->db->lasterror();
1241 1241
 			$error++;
1242 1242
 		} else {
1243 1243
 			if ($obj = $this->db->fetch_object($resql)) {
1244 1244
 				$mode_key = $obj->depreciation_mode;
1245 1245
 				if (!empty($options->deprecation_options_fields[$mode_key])) {
1246
-					$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1247
-					$sql .= " SET total_amount_last_depreciation_ht = " . $obj->cumulative_depreciation_ht;
1248
-					$sql .= " WHERE fk_asset = " . (int) $obj->fk_asset;
1246
+					$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1247
+					$sql .= " SET total_amount_last_depreciation_ht = ".$obj->cumulative_depreciation_ht;
1248
+					$sql .= " WHERE fk_asset = ".(int) $obj->fk_asset;
1249 1249
 					$resql = $this->db->query($sql);
1250 1250
 					if (!$resql) {
1251
-						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1251
+						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1252 1252
 						$error++;
1253 1253
 					}
1254 1254
 				}
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 			if ($option == 'label') {
1502 1502
 				$name = $this->label;
1503 1503
 			} elseif ($option == 'with_label') {
1504
-				$name .= ' - ' . $this->label;
1504
+				$name .= ' - '.$this->label;
1505 1505
 			}
1506 1506
 			$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
1507 1507
 		}
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
1511 1511
 
1512 1512
 		global $action;
1513
-		$hookmanager->initHooks(array($this->element . 'dao'));
1513
+		$hookmanager->initHooks(array($this->element.'dao'));
1514 1514
 		$parameters = array('id' => $this->id, 'getnomurl' => &$result);
1515 1515
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1516 1516
 		if ($reshook > 0) {
@@ -1595,12 +1595,12 @@  discard block
 block discarded – undo
1595 1595
 				$obj = $this->db->fetch_object($result);
1596 1596
 				$this->id = $obj->rowid;
1597 1597
 
1598
-				$this->user_creation_id		= $obj->fk_user_creat;
1599
-				$this->user_modification_id	= $obj->fk_user_modif;
1600
-				$this->user_validation_id	= $obj->fk_user_valid;
1601
-				$this->date_creation		= $this->db->jdate($obj->datec);
1602
-				$this->date_modification	= $this->db->jdate($obj->datem);
1603
-				$this->date_validation		= $this->db->jdate($obj->datev);
1598
+				$this->user_creation_id = $obj->fk_user_creat;
1599
+				$this->user_modification_id = $obj->fk_user_modif;
1600
+				$this->user_validation_id = $obj->fk_user_valid;
1601
+				$this->date_creation = $this->db->jdate($obj->datec);
1602
+				$this->date_modification = $this->db->jdate($obj->datem);
1603
+				$this->date_validation = $this->db->jdate($obj->datev);
1604 1604
 			}
1605 1605
 
1606 1606
 			$this->db->free($result);
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 		if (getDolGlobalString('ASSET_ASSET_ADDON')) {
1642 1642
 			$mybool = false;
1643 1643
 
1644
-			$file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php";
1644
+			$file = getDolGlobalString('ASSET_ASSET_ADDON').".php";
1645 1645
 			$classname = getDolGlobalString('ASSET_ASSET_ADDON');
1646 1646
 
1647 1647
 			// Include file with class
Please login to merge, or discard this patch.
htdocs/main.inc.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 //@ini_set('memory_limit', '128M');	// This may be useless if memory is hard limited by your PHP
43 43
 
44 44
 // For optional tuning. Enabled if environment variable MAIN_SHOW_TUNING_INFO is defined.
45
-$micro_start_time = 0;	// Used as global var into printCommonFooter()
45
+$micro_start_time = 0; // Used as global var into printCommonFooter()
46 46
 if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) {
47 47
 	list($usec, $sec) = explode(" ", microtime());
48 48
 	$micro_start_time = ((float) $usec + (float) $sec);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		session_set_cookie_params($sessioncookieparams);
132 132
 	}
133 133
 	session_name($sessionname);
134
-	dol_session_start();	// This call the open and read of session handler
134
+	dol_session_start(); // This call the open and read of session handler
135 135
 	//exit;	// this exist generates a call to write and close
136 136
 }
137 137
 
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	if (!$ok) {
177 177
 		if (session_id() && isset($_SESSION["dol_login"]) && !in_array($_SESSION["dol_login"], explode(';', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')))) {
178 178
 			print 'Sorry, your application is offline.'."\n";
179
-			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
180
-			$nexturl = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);
179
+			print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
180
+			$nexturl = dolBuildUrl(DOL_URL_ROOT.'/user/logout.php', [], true);
181 181
 			print 'Please try later or <a href="'.$nexturl.'">click here to disconnect and change login user</a>...'."\n";
182 182
 		} else {
183
-			print 'Sorry, your application is offline. Only administrator users (' . str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
184
-			$nexturl = dolBuildUrl(DOL_URL_ROOT . '/');
183
+			print 'Sorry, your application is offline. Only administrator users ('.str_replace(';', ', ', getDolGlobalString('MAIN_ONLY_LOGIN_ALLOWED')).') is allowed to connect for the moment.'."\n";
184
+			$nexturl = dolBuildUrl(DOL_URL_ROOT.'/');
185 185
 			print 'Please try later or <a href="'.$nexturl.'">click here to change login user</a>...'."\n";
186 186
 		}
187 187
 		exit;
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 					print "Access to this page this way (POST method or GET with a sensible value for 'action' parameter) is refused by CSRF protection in main.inc.php. Token not provided.\n";
397 397
 					print "If you access your server behind a proxy using url rewriting and the parameter is provided by caller, you might check that all HTTP header are propagated (or add the line \$dolibarr_nocsrfcheck=1 into your conf.php file or MAIN_SECURITY_CSRF_WITH_TOKEN to 0";
398 398
 					if (getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
399
-						print " instead of " . getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN');
399
+						print " instead of ".getDolGlobalString('MAIN_SECURITY_CSRF_WITH_TOKEN');
400 400
 					}
401 401
 					print " into setup).\n";
402 402
 				}
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		unset($_GET['action']);
425 425
 		unset($_GET['confirmmassaction']);
426 426
 		unset($_GET['massaction']);
427
-		unset($_GET['token']);			// TODO Make a redirect if we have a token in url to remove it ?
427
+		unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ?
428 428
 		if (isset($savid)) {
429 429
 			$_POST['id'] = ((int) $savid);
430 430
 		}
@@ -446,18 +446,18 @@  discard block
 block discarded – undo
446 446
 	foreach ($disabled_modules as $module) {
447 447
 		if ($module) {
448 448
 			if (empty($conf->$module)) {
449
-				$conf->$module = new stdClass(); 	// To avoid warnings
449
+				$conf->$module = new stdClass(); // To avoid warnings
450 450
 			}
451 451
 
452
-			$conf->$module->enabled = false;		// Old usage
452
+			$conf->$module->enabled = false; // Old usage
453 453
 			unset($conf->modules[$module]);
454 454
 
455 455
 			foreach ($modulepartkeys as $modulepartkey) {
456 456
 				unset($conf->modules_parts[$modulepartkey][$module]);
457 457
 			}
458 458
 			if ($module == 'fournisseur') {		// Special case
459
-				$conf->supplier_order->enabled = 0;		// Old usage
460
-				$conf->supplier_invoice->enabled = 0;	// Old usage
459
+				$conf->supplier_order->enabled = 0; // Old usage
460
+				$conf->supplier_invoice->enabled = 0; // Old usage
461 461
 				unset($conf->modules['supplier_order']);
462 462
 				unset($conf->modules['supplier_invoice']);
463 463
 			}
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 				if ($dol_use_jmobile) {
555 555
 					$query += ['dol_use_jmobile='.$dol_use_jmobile];
556 556
 				}
557
-				header("Location: " . dolBuildUrl(DOL_URL_ROOT . '/public/demo/index.php', $query));
557
+				header("Location: ".dolBuildUrl(DOL_URL_ROOT.'/public/demo/index.php', $query));
558 558
 				exit;
559 559
 			}
560 560
 		}
@@ -602,12 +602,12 @@  discard block
 block discarded – undo
602 602
 					if (is_object($captchaobj) && method_exists($captchaobj, 'validateCodeAfterLoginSubmit')) {
603 603
 						$ok = $captchaobj->validateCodeAfterLoginSubmit(); // @phan-suppress-current-line PhanUndeclaredMethod
604 604
 					} else {
605
-						$_SESSION["dol_loginmesg"] =  'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
605
+						$_SESSION["dol_loginmesg"] = 'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
606 606
 						$test = false;
607 607
 						$error++;
608 608
 					}
609 609
 				} else {
610
-					$_SESSION["dol_loginmesg"] =  'Error, the captcha handler class '.$classname.' was not found after the include';
610
+					$_SESSION["dol_loginmesg"] = 'Error, the captcha handler class '.$classname.' was not found after the include';
611 611
 					$test = false;
612 612
 					$error++;
613 613
 				}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 
652 652
 		$allowedmethodtopostusername = 3;
653 653
 		if (defined('MAIN_AUTHENTICATION_POST_METHOD')) {
654
-			$allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');	// Note a value of 2 is not compatible with some authentication methods that put username as GET parameter
654
+			$allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); // Note a value of 2 is not compatible with some authentication methods that put username as GET parameter
655 655
 		}
656 656
 		// TODO Remove use of $_COOKIE['login_dolibarr'] by replacing line with $usertotest = GETPOST("username", "alpha", $allowedmethodtopostusername); ?
657 657
 		$usertotest = (!empty($_COOKIE['login_dolibarr']) ? preg_replace('/[^a-zA-Z0-9_@\-\.]/', '', $_COOKIE['login_dolibarr']) : GETPOST("username", "alpha", $allowedmethodtopostusername));
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 				}
801 801
 
802 802
 				// Show login form
803
-				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));	// This include http headers
803
+				dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers
804 804
 			}
805 805
 			exit;
806 806
 		}
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 			if (GETPOST('lang', 'aZ09')) {
862 862
 				$paramsurl += ['lang' => (string) GETPOST('lang', 'aZ09')];
863 863
 			}
864
-			header('Location: '.dolBuildUrl(DOL_URL_ROOT . '/index.php', $paramsurl));
864
+			header('Location: '.dolBuildUrl(DOL_URL_ROOT.'/index.php', $paramsurl));
865 865
 			exit;
866 866
 		} else {
867 867
 			// User is loaded, we may need to change language for him according to its choice
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 } else {
1159 1159
 	// We may have NOLOGIN set, but NOREQUIREUSER not
1160 1160
 	if (!empty($user) && method_exists($user, 'loadDefaultValues') && !defined('NODEFAULTVALUES')) {
1161
-		$user->loadDefaultValues();		// Load default values for everybody (works even if $user->id = 0
1161
+		$user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0
1162 1162
 	}
1163 1163
 }
1164 1164
 
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 	$conf->dol_optimize_smallscreen = 1;
1222 1222
 
1223 1223
 	if (getDolGlobalInt('PRODUIT_DESC_IN_FORM') == 1) {
1224
-		$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0;	// This was set to PRODUIT_DESC_IN_FORM and is forced to 0 if smartphone in this case
1224
+		$conf->global->PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE = 0; // This was set to PRODUIT_DESC_IN_FORM and is forced to 0 if smartphone in this case
1225 1225
 	}
1226 1226
 }
1227 1227
 // Replace themes bugged with jmobile with eldy
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 	define('ROWS_9', 8);
1327 1327
 }
1328 1328
 
1329
-$heightforframes = 52;	// Used by frames.php page
1329
+$heightforframes = 52; // Used by frames.php page
1330 1330
 
1331 1331
 // Init menu manager
1332 1332
 if (!defined('NOREQUIREMENU')) {
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 
1367 1367
 if (!empty(GETPOST('seteventmessages', 'alpha'))) {
1368 1368
 	$message = GETPOST('seteventmessages', 'alpha');
1369
-	$messages  = explode(',', $message);
1369
+	$messages = explode(',', $message);
1370 1370
 	foreach ($messages as $key => $msg) {
1371 1371
 		$tmp = explode(':', $msg);
1372 1372
 		setEventMessages($tmp[0], null, !empty($tmp[1]) ? $tmp[1] : 'mesgs');
@@ -1705,7 +1705,7 @@  discard block
 block discarded – undo
1705 1705
 		}
1706 1706
 
1707 1707
 		if (getDolGlobalString('THEME_ELDY_TOPMENU_BACK1')) {
1708
-			print '<meta name="theme-color" content="rgb(' . getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n";
1708
+			print '<meta name="theme-color" content="rgb('.getDolGlobalString('THEME_ELDY_TOPMENU_BACK1').')">'."\n";
1709 1709
 		}
1710 1710
 
1711 1711
 		// Auto refresh page
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
 
1755 1755
 		$themeparam = '?lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&amp;optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').(empty($user->id) ? '' : ('&amp;userid='.$user->id)).'&amp;entity='.$conf->entity;
1756 1756
 
1757
-		$themeparam .= '&' .$ext . '&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV");
1757
+		$themeparam .= '&'.$ext.'&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV");
1758 1758
 		if (GETPOSTISSET('dol_hide_topmenu')) {
1759 1759
 			$themeparam .= '&amp;dol_hide_topmenu='.GETPOSTINT('dol_hide_topmenu');
1760 1760
 		}
@@ -1794,24 +1794,24 @@  discard block
 block discarded – undo
1794 1794
 					$jquerytheme = getDolGlobalString('MAIN_USE_JQUERY_THEME');
1795 1795
 				}
1796 1796
 				if (constant('JS_JQUERY_UI')) {
1797
-					print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css?' . $ext . '">' . "\n"; // Forced JQuery
1797
+					print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css?'.$ext.'">'."\n"; // Forced JQuery
1798 1798
 				} else {
1799
-					print '<link rel="stylesheet" type="text/css" href="' . DOL_URL_ROOT . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css?' . $ext . '">' . "\n"; // JQuery
1799
+					print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css?'.$ext.'">'."\n"; // JQuery
1800 1800
 				}
1801 1801
 			}
1802 1802
 			if (!defined('DISABLE_JQUERY_JNOTIFY')) {
1803
-				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css?' . $ext . '">'."\n"; // JNotify
1803
+				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css?'.$ext.'">'."\n"; // JNotify
1804 1804
 			}
1805 1805
 			if (!defined('DISABLE_SELECT2') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1806 1806
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT');
1807
-				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css?' . $ext . '">'."\n";
1807
+				print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css?'.$ext.'">'."\n";
1808 1808
 			}
1809 1809
 		}
1810 1810
 
1811 1811
 		if (!defined('DISABLE_FONT_AWSOME')) {
1812 1812
 			print '<!-- Includes CSS for font awesome -->'."\n";
1813 1813
 			$fontawesome_directory = getDolGlobalString('MAIN_FONTAWESOME_DIRECTORY', '/theme/common/fontawesome-5');
1814
-			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$fontawesome_directory.'/css/all.min.css?' . $ext . '">'."\n";
1814
+			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$fontawesome_directory.'/css/all.min.css?'.$ext.'">'."\n";
1815 1815
 		}
1816 1816
 
1817 1817
 		// Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
@@ -1829,7 +1829,7 @@  discard block
 block discarded – undo
1829 1829
 
1830 1830
 		if (!defined('DISABLE_CSS_DEFAULT_THEME')) {
1831 1831
 			print '<!-- Includes CSS for Dolibarr theme -->'."\n";
1832
-			print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1832
+			print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
1833 1833
 		}
1834 1834
 
1835 1835
 		// To fix old chrome bug
@@ -1841,8 +1841,8 @@  discard block
 block discarded – undo
1841 1841
 
1842 1842
 		// LEAFLET AND GEOMAN
1843 1843
 		if (getDolGlobalString('MAIN_USE_GEOPHP')) {
1844
-			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.css?' . $ext . "\">\n";
1845
-			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.css?' . $ext . "\">\n";
1844
+			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.css?'.$ext."\">\n";
1845
+			print '<link rel="stylesheet" href="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.css?'.$ext."\">\n";
1846 1846
 		}
1847 1847
 
1848 1848
 		// CSS forced by modules (relative url starting with /)
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 		// Custom CSS
1890 1890
 		if (getDolGlobalString('MAIN_IHM_CUSTOM_CSS')) {
1891 1891
 			// If a custom CSS was set, we add link to the custom css php file
1892
-			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/custom.css.php?' . $ext . '&amp;revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV").'">'."\n";
1892
+			print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/custom.css.php?'.$ext.'&amp;revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV").'">'."\n";
1893 1893
 		}
1894 1894
 
1895 1895
 		// Output standard javascript links
@@ -1897,36 +1897,36 @@  discard block
 block discarded – undo
1897 1897
 			// JQuery. Must be before other includes
1898 1898
 			print '<!-- Includes JS for JQuery -->'."\n";
1899 1899
 			if (defined('JS_JQUERY') && constant('JS_JQUERY')) {
1900
-				print '<script nonce="'.getNonce().'" src="'.JS_JQUERY.'jquery.min.js?' . $ext . '"></script>'."\n";
1900
+				print '<script nonce="'.getNonce().'" src="'.JS_JQUERY.'jquery.min.js?'.$ext.'"></script>'."\n";
1901 1901
 			} else {
1902
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js?' . $ext . '"></script>'."\n";
1902
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery.min.js?'.$ext.'"></script>'."\n";
1903 1903
 			}
1904 1904
 			if (!defined('DISABLE_JQUERY_UI')) {
1905 1905
 				if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1906
-					print '<script nonce="' . getNonce() . '" src="' . JS_JQUERY_UI . 'jquery-ui.min.js?' . $ext . '"></script>' . "\n";
1906
+					print '<script nonce="'.getNonce().'" src="'.JS_JQUERY_UI.'jquery-ui.min.js?'.$ext.'"></script>'."\n";
1907 1907
 				} else {
1908
-					print '<script nonce="' . getNonce() . '" src="' . DOL_URL_ROOT . '/includes/jquery/js/jquery-ui.min.js?' . $ext . '"></script>' . "\n";
1908
+					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui.min.js?'.$ext.'"></script>'."\n";
1909 1909
 				}
1910 1910
 			}
1911 1911
 			// jQuery jnotify
1912 1912
 			if (!getDolGlobalString('MAIN_DISABLE_JQUERY_JNOTIFY') && !defined('DISABLE_JQUERY_JNOTIFY')) {
1913
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js?' . $ext . '"></script>'."\n";
1913
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js?'.$ext.'"></script>'."\n";
1914 1914
 			}
1915 1915
 			// Table drag and drop lines
1916 1916
 			if (empty($disableforlogin) && !defined('DISABLE_JQUERY_TABLEDND')) {
1917
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js?' . $ext . '"></script>'."\n";
1917
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js?'.$ext.'"></script>'."\n";
1918 1918
 			}
1919 1919
 			// Chart
1920 1920
 			if (empty($disableforlogin) && (!getDolGlobalString('MAIN_JS_GRAPH') || getDolGlobalString('MAIN_JS_GRAPH') == 'chart') && !defined('DISABLE_JS_GRAPH')) {
1921
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/nnnick/chartjs/dist/chart.min.js?' . $ext . '"></script>'."\n";
1921
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/nnnick/chartjs/dist/chart.min.js?'.$ext.'"></script>'."\n";
1922 1922
 			}
1923 1923
 
1924 1924
 			// jQuery jeditable for Edit In Place features
1925 1925
 			if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !defined('DISABLE_JQUERY_JEDITABLE')) {
1926 1926
 				print '<!-- JS to manage editInPlace feature -->'."\n";
1927
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js?' . $ext . '"></script>'."\n";
1928
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js?' . $ext . '"></script>'."\n";
1929
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js?' . $ext . '"></script>'."\n";
1927
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.js?'.$ext.'"></script>'."\n";
1928
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js?'.$ext.'"></script>'."\n";
1929
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js?'.$ext.'"></script>'."\n";
1930 1930
 				print '<script nonce="'.getNonce().'" >'."\n";
1931 1931
 				print 'var urlSaveInPlace = \''.DOL_URL_ROOT.'/core/ajax/saveinplace.php\';'."\n";
1932 1932
 				print 'var urlLoadInPlace = \''.DOL_URL_ROOT.'/core/ajax/loadinplace.php\';'."\n";
@@ -1937,16 +1937,16 @@  discard block
 block discarded – undo
1937 1937
 				print 'var indicatorInPlace = \'<img src="'.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
1938 1938
 				print 'var withInPlace = 300;'; // width in pixel for default string edit
1939 1939
 				print '</script>'."\n";
1940
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/editinplace.js?' . $ext . '"></script>'."\n";
1941
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js?' . $ext . '"></script>'."\n";
1940
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/editinplace.js?'.$ext.'"></script>'."\n";
1941
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js?'.$ext.'"></script>'."\n";
1942 1942
 			}
1943 1943
 			if (!defined('DISABLE_SELECT2') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
1944 1944
 				// jQuery plugin "mutiselect", "multiple-select", "select2", ...
1945 1945
 				$tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ? constant('REQUIRE_JQUERY_MULTISELECT') : getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT');
1946
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js?' . $ext . '"></script>'."\n"; // We include full because we need the support of containerCssClass
1946
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js?'.$ext.'"></script>'."\n"; // We include full because we need the support of containerCssClass
1947 1947
 			}
1948 1948
 			if (!defined('DISABLE_MULTISELECT')) {     // jQuery plugin "mutiselect" to select with checkboxes. Can be removed once we have an enhanced search tool
1949
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiselect/jquery.multi-select.js?' . $ext . '"></script>'."\n";
1949
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/multiselect/jquery.multi-select.js?'.$ext.'"></script>'."\n";
1950 1950
 			}
1951 1951
 		}
1952 1952
 
@@ -1963,11 +1963,11 @@  discard block
 block discarded – undo
1963 1963
 				print '<script nonce="'.getNonce().'">';
1964 1964
 				print '/* enable ckeditor by main.inc.php */';
1965 1965
 				print 'var CKEDITOR_BASEPATH = \''.dol_escape_js($pathckeditor).'\';'."\n";
1966
-				print 'var ckeditorConfig = \''.dol_escape_js(dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js?' . $ext, 1)).'\';'."\n"; // $themesubdir='' in standard usage
1966
+				print 'var ckeditorConfig = \''.dol_escape_js(dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js?'.$ext, 1)).'\';'."\n"; // $themesubdir='' in standard usage
1967 1967
 				print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1968 1968
 				print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_URL_ROOT.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_URL_ROOT.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1969 1969
 				print '</script>'."\n";
1970
-				print '<script src="'.$pathckeditor.$jsckeditor. '?' . $ext . '"></script>'."\n";
1970
+				print '<script src="'.$pathckeditor.$jsckeditor.'?'.$ext.'"></script>'."\n";
1971 1971
 				print '<script>';
1972 1972
 				if (GETPOST('mode', 'aZ09') == 'Full_inline') {
1973 1973
 					print 'CKEDITOR.disableAutoInline = false;'."\n";
@@ -1988,20 +1988,20 @@  discard block
 block discarded – undo
1988 1988
 				}
1989 1989
 				if ($enablebrowsernotif) {
1990 1990
 					print '<!-- Includes JS of Dolibarr (browser layout = '.$conf->browser->layout.')-->'."\n";
1991
-					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_notification.js.php?lang='.$langs->defaultlang. '&' . $ext . '"></script>'."\n";
1991
+					print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_notification.js.php?lang='.$langs->defaultlang.'&'.$ext.'"></script>'."\n";
1992 1992
 				}
1993 1993
 			}
1994 1994
 
1995 1995
 			// Global js function
1996 1996
 			print '<!-- Includes JS of Dolibarr -->'."\n";
1997 1997
 			if (!defined('DISABLE_LIB_HEAD_JS')) {
1998
-				print '<script nonce="' . getNonce() . '" src="' . DOL_URL_ROOT . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . '&' . $ext . '"></script>' . "\n";
1998
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/core/js/lib_head.js.php?lang='.$langs->defaultlang.'&'.$ext.'"></script>'."\n";
1999 1999
 			}
2000 2000
 
2001 2001
 			// Leaflet
2002 2002
 			if (getDolGlobalString('MAIN_USE_GEOPHP')) {
2003
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.js?' . $ext . '"></script>'."\n";
2004
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.min.js?' . $ext . '"></script>'."\n";
2003
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet.js?'.$ext.'"></script>'."\n";
2004
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/includes/leaflet/leaflet-geoman.min.js?'.$ext.'"></script>'."\n";
2005 2005
 			}
2006 2006
 
2007 2007
 			// JS forced by modules (relative url starting with /)
@@ -2038,7 +2038,7 @@  discard block
 block discarded – undo
2038 2038
 		if (getDolGlobalString('ALLOW_THEME_JS')) {
2039 2039
 			$theme_js = dol_buildpath('/theme/'.$conf->theme.'/'.$conf->theme.'.js', 0);
2040 2040
 			if (file_exists($theme_js)) {
2041
-				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/'.$conf->theme.'.js?' . $ext . '"></script>'."\n";
2041
+				print '<script nonce="'.getNonce().'" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/'.$conf->theme.'.js?'.$ext.'"></script>'."\n";
2042 2042
 			}
2043 2043
 		}
2044 2044
 
@@ -2046,7 +2046,7 @@  discard block
 block discarded – undo
2046 2046
 			print $head."\n";
2047 2047
 		}
2048 2048
 		if (getDolGlobalString('MAIN_HTML_HEADER')) {
2049
-			print getDolGlobalString('MAIN_HTML_HEADER') . "\n";
2049
+			print getDolGlobalString('MAIN_HTML_HEADER')."\n";
2050 2050
 		}
2051 2051
 
2052 2052
 		$parameters = array();
@@ -2174,7 +2174,7 @@  discard block
 block discarded – undo
2174 2174
 
2175 2175
 		$toprightmenu .= '</div>';
2176 2176
 
2177
-		$toprightmenu .= '</div>'."\n";		 // end div class="login_block_tools"
2177
+		$toprightmenu .= '</div>'."\n"; // end div class="login_block_tools"
2178 2178
 
2179 2179
 
2180 2180
 		// Add block for other tools
@@ -2195,7 +2195,7 @@  discard block
 block discarded – undo
2195 2195
 
2196 2196
 		// Link to module builder
2197 2197
 		if (isModEnabled('modulebuilder')) {
2198
-			$text = '<a href="' . dolBuildUrl(DOL_URL_ROOT . '/modulebuilder/index.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']) .'" target="modulebuilder">';
2198
+			$text = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/modulebuilder/index.php', ['mainmenu' => 'home', 'leftmenu' => 'admintools']).'" target="modulebuilder">';
2199 2199
 			//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
2200 2200
 			$text .= '<span class="fa fa-bug atoplogin valignmiddle"></span>';
2201 2201
 			$text .= '</a>';
@@ -2475,7 +2475,7 @@  discard block
 block discarded – undo
2475 2475
 	}
2476 2476
 
2477 2477
 	if (empty($urllogout)) {
2478
-		$urllogout = dolBuildUrl(DOL_URL_ROOT . '/user/logout.php', [], true);
2478
+		$urllogout = dolBuildUrl(DOL_URL_ROOT.'/user/logout.php', [], true);
2479 2479
 	}
2480 2480
 
2481 2481
 	// Defined the links for bottom of card
@@ -2884,7 +2884,7 @@  discard block
 block discarded – undo
2884 2884
 		$langs->load(explode('@', $item['name'])[1]);
2885 2885
 		$dropDownQuickAddHtml .= '
2886 2886
 			<a class="dropdown-item quickadd-item" href="'.DOL_URL_ROOT.$item['url'].'" title="'.$langs->trans(explode('@', $item['title'])[0]).'">
2887
-			'. img_picto('', $item['picto'], 'style="width:18px;"') . ' ' . $langs->trans(explode('@', $item['name'])[0]) . '</a>
2887
+			'. img_picto('', $item['picto'], 'style="width:18px;"').' '.$langs->trans(explode('@', $item['name'])[0]).'</a>
2888 2888
 		';
2889 2889
 	}
2890 2890
 
@@ -2989,7 +2989,7 @@  discard block
 block discarded – undo
2989 2989
  */
2990 2990
 function top_menu_search()
2991 2991
 {
2992
-	global $langs, $conf, $db, $user, $hookmanager;	// used by htdocs/core/ajax/selectsearchbox.php
2992
+	global $langs, $conf, $db, $user, $hookmanager; // used by htdocs/core/ajax/selectsearchbox.php
2993 2993
 
2994 2994
 	$html = '';
2995 2995
 
@@ -3677,7 +3677,7 @@  discard block
 block discarded – undo
3677 3677
 
3678 3678
 		if (!empty($conf->use_javascript_ajax)) {
3679 3679
 			print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
3680
-			print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang . '&' . $ext .'"></script>'."\n";
3680
+			print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'&'.$ext.'"></script>'."\n";
3681 3681
 		}
3682 3682
 
3683 3683
 		// JS wrapper to add an unalterable log when clicking on Download or Preview
@@ -3771,7 +3771,7 @@  discard block
 block discarded – undo
3771 3771
 			} elseif (!isRegistrationDataSaved()) {
3772 3772
 				print "\n<!-- NO JS CODE TO ENABLE the registration. Registration data not saved -->\n";
3773 3773
 			} else {
3774
-				$hash_unique_id_registration = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256', 1);	// Same than getHashUniqueIdOfRegistration()
3774
+				$hash_unique_id_registration = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256', 1); // Same than getHashUniqueIdOfRegistration()
3775 3775
 				$constanttosavelastko = 'MAIN_LAST_REGISTRATION_KO_DATE';
3776 3776
 				$constanttosavefirstok = 'MAIN_FIRST_REGISTRATION_OK_DATE';
3777 3777
 				$constanttosavefirstokid = 'MAIN_FIRST_REGISTRATION_OK_ID';
Please login to merge, or discard this patch.