@@ -25,7 +25,7 @@ discard block |
||
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'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function testNumBetweenDay() |
62 | 62 | { |
63 | - global $conf,$user,$langs,$db; |
|
63 | + global $conf, $user, $langs, $db; |
|
64 | 64 | $conf = $this->savconf; |
65 | 65 | $user = $this->savuser; |
66 | 66 | $langs = $this->savlangs; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function testNumPublicHoliday() |
120 | 120 | { |
121 | - global $conf,$user,$langs,$db; |
|
121 | + global $conf, $user, $langs, $db; |
|
122 | 122 | $conf = $this->savconf; |
123 | 123 | $user = $this->savuser; |
124 | 124 | $langs = $this->savlangs; |
@@ -131,16 +131,16 @@ discard block |
||
131 | 131 | |
132 | 132 | $result = num_public_holiday($date1, $date2, 'FR', 1); |
133 | 133 | print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for FR result=".$result."\n"; |
134 | - $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france) |
|
134 | + $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 closed days (country france) |
|
135 | 135 | |
136 | 136 | $result = num_public_holiday($date1, $date2, 'XX', 1); |
137 | 137 | print __METHOD__." for Tuesday 1 - Wednesday 2 jan 2013 for XX result=".$result."\n"; |
138 | - $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown) |
|
138 | + $this->assertEquals(1, $result, 'NumPublicHoliday for Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 closed days (country unknown) |
|
139 | 139 | |
140 | 140 | print '----'."\n"; |
141 | 141 | $result = num_public_holiday($date2, $date3, 'FR', 1); |
142 | 142 | print __METHOD__." for Wednesday 2 - Thursday 3 jan 2013 for FR result=".$result."\n"; |
143 | - $this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days |
|
143 | + $this->assertEquals(0, $result, 'NumPublicHoliday for Wednesday 2 - Thursday 3 jan 2013 for FR'); // no closed days |
|
144 | 144 | |
145 | 145 | // Check with easter monday |
146 | 146 | $date1 = dol_mktime(0, 0, 0, 4, 21, 2019, 'gmt'); |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | |
149 | 149 | $result = num_public_holiday($date1, $date2, 'XX', 1); |
150 | 150 | print __METHOD__." result=".$result."\n"; |
151 | - $this->assertEquals(1, $result, 'NumPublicHoliday including eastermonday for XX'); // 2 opened day, 1 closed days (sunday) |
|
151 | + $this->assertEquals(1, $result, 'NumPublicHoliday including eastermonday for XX'); // 2 opened day, 1 closed days (sunday) |
|
152 | 152 | |
153 | 153 | $result = num_public_holiday($date1, $date2, 'FR', 1); |
154 | 154 | print __METHOD__." result=".$result."\n"; |
155 | - $this->assertEquals(2, $result, 'NumPublicHoliday including eastermonday for FR'); // 1 opened day, 2 closed days (sunday + easter monday) |
|
155 | + $this->assertEquals(2, $result, 'NumPublicHoliday including eastermonday for FR'); // 1 opened day, 2 closed days (sunday + easter monday) |
|
156 | 156 | |
157 | 157 | // Check for sunday/saturday - Friday 4 - Sunday 6 jan 2013 |
158 | 158 | $date1 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); |
@@ -160,23 +160,23 @@ discard block |
||
160 | 160 | |
161 | 161 | $result = num_public_holiday($date1, $date2, 'FR', 1); |
162 | 162 | print __METHOD__." result=".$result."\n"; |
163 | - $this->assertEquals(2, $result, 'NumPublicHoliday for FR'); // 1 opened day, 2 closed days |
|
163 | + $this->assertEquals(2, $result, 'NumPublicHoliday for FR'); // 1 opened day, 2 closed days |
|
164 | 164 | |
165 | 165 | $result = num_public_holiday($date1, $date2, 'FR', 1, 1, 1); |
166 | 166 | print __METHOD__." result=".$result."\n"; |
167 | - $this->assertEquals(2, $result, 'NumPublicHoliday for FR'); // 1 opened day, 2 closed days |
|
167 | + $this->assertEquals(2, $result, 'NumPublicHoliday for FR'); // 1 opened day, 2 closed days |
|
168 | 168 | |
169 | 169 | $result = num_public_holiday($date1, $date2, 'FR', 1, 1, 0); |
170 | 170 | print __METHOD__." result=".$result."\n"; |
171 | - $this->assertEquals(1, $result, 'NumPublicHoliday for FR'); // 2 opened day, 1 closed days |
|
171 | + $this->assertEquals(1, $result, 'NumPublicHoliday for FR'); // 2 opened day, 1 closed days |
|
172 | 172 | |
173 | 173 | $result = num_public_holiday($date1, $date2, 'FR', 1, 0, 0); |
174 | 174 | print __METHOD__." result=".$result."\n"; |
175 | - $this->assertEquals(0, $result, 'NumPublicHoliday for FR'); // 3 opened day, 0 closed days |
|
175 | + $this->assertEquals(0, $result, 'NumPublicHoliday for FR'); // 3 opened day, 0 closed days |
|
176 | 176 | |
177 | 177 | $result = num_public_holiday($date1, $date2, 'XX', 1); |
178 | 178 | print __METHOD__." result=".$result."\n"; |
179 | - $this->assertEquals(2, $result, 'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown) |
|
179 | + $this->assertEquals(2, $result, 'NumPublicHoliday for XX'); // 1 opened day, 2 closed days (even if country unknown) |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -186,57 +186,57 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function testNumOpenDay() |
188 | 188 | { |
189 | - global $conf,$user,$langs,$db; |
|
189 | + global $conf, $user, $langs, $db; |
|
190 | 190 | $conf = $this->savconf; |
191 | 191 | $user = $this->savuser; |
192 | 192 | $langs = $this->savlangs; |
193 | 193 | $db = $this->savdb; |
194 | 194 | |
195 | 195 | // With same hours - Tuesday/Wednesday jan 2013 |
196 | - $date1 = dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt'); // tuesday |
|
197 | - $date2 = dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt'); // wednesday |
|
198 | - $date3 = dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt'); // thursday |
|
196 | + $date1 = dol_mktime(0, 0, 0, 1, 1, 2013, 'gmt'); // tuesday |
|
197 | + $date2 = dol_mktime(0, 0, 0, 1, 2, 2013, 'gmt'); // wednesday |
|
198 | + $date3 = dol_mktime(0, 0, 0, 1, 3, 2013, 'gmt'); // thursday |
|
199 | 199 | |
200 | 200 | $result = num_open_day($date1, $date2, 0, 1, 0, 'FR'); |
201 | 201 | print __METHOD__." result=".$result."\n"; |
202 | - $this->assertEquals(1, $result, 'NumOpenDay Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 opened days (country france) |
|
202 | + $this->assertEquals(1, $result, 'NumOpenDay Tuesday 1 - Wednesday 2 jan 2013 for FR'); // 1 opened days (country france) |
|
203 | 203 | |
204 | 204 | $result = num_open_day($date1, $date2, 0, 1, 0, 'XX'); |
205 | 205 | print __METHOD__." result=".$result."\n"; |
206 | - $this->assertEquals(1, $result, 'NumOpenDay Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 opened days (country unknown) |
|
206 | + $this->assertEquals(1, $result, 'NumOpenDay Tuesday 1 - Wednesday 2 jan 2013 for XX'); // 1 opened days (country unknown) |
|
207 | 207 | |
208 | 208 | $result = num_open_day($date2, $date3, 0, 1, 0, 'FR'); |
209 | 209 | print __METHOD__." result=".$result."\n"; |
210 | - $this->assertEquals(2, $result, 'NumOpenDay Wednesday 2 - Thursday 3 jan 2013 for FR'); // 2 opened days |
|
210 | + $this->assertEquals(2, $result, 'NumOpenDay Wednesday 2 - Thursday 3 jan 2013 for FR'); // 2 opened days |
|
211 | 211 | |
212 | 212 | // With same hours - Friday/Sunday jan 2013 |
213 | - $date1 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); // friday |
|
214 | - $date2 = dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt'); // sunday |
|
213 | + $date1 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); // friday |
|
214 | + $date2 = dol_mktime(0, 0, 0, 1, 6, 2013, 'gmt'); // sunday |
|
215 | 215 | |
216 | 216 | $result = num_open_day($date1, $date2, 0, 1, 0, 'FR'); |
217 | 217 | print __METHOD__." result=".$result."\n"; |
218 | - $this->assertEquals(1, $result, 'NumOpenDay for FR'); // 1 opened day, 2 closed |
|
218 | + $this->assertEquals(1, $result, 'NumOpenDay for FR'); // 1 opened day, 2 closed |
|
219 | 219 | |
220 | 220 | $result = num_open_day($date1, $date2, 'XX', 1); |
221 | 221 | print __METHOD__." result=".$result."\n"; |
222 | - $this->assertEquals(1, $result, 'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown) |
|
222 | + $this->assertEquals(1, $result, 'NumOpenDay for XX'); // 1 opened day, 2 closes (even if country unknown) |
|
223 | 223 | |
224 | 224 | // Test option MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY and MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY |
225 | 225 | $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY = 0; |
226 | 226 | $result = num_open_day($date1, $date2, 0, 1, 0, 'FR'); |
227 | 227 | print __METHOD__." result=".$result."\n"; |
228 | - $this->assertEquals(2, $result, 'NumOpenDay for FR when saturday is a working day'); //2 opened day, 1 closed |
|
228 | + $this->assertEquals(2, $result, 'NumOpenDay for FR when saturday is a working day'); //2 opened day, 1 closed |
|
229 | 229 | |
230 | 230 | $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY = 0; |
231 | 231 | $result = num_open_day($date1, $date2, 'XX', 1); |
232 | 232 | print __METHOD__." result=".$result."\n"; |
233 | - $this->assertEquals(3, $result, 'NumOpenDay for XX when saturday + sunday are working days'); // 3 opened day, 0 closes (even if country unknown) |
|
233 | + $this->assertEquals(3, $result, 'NumOpenDay for XX when saturday + sunday are working days'); // 3 opened day, 0 closes (even if country unknown) |
|
234 | 234 | |
235 | 235 | // Define specific dates for these tests |
236 | - $date_friday_4 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); // Friday |
|
236 | + $date_friday_4 = dol_mktime(0, 0, 0, 1, 4, 2013, 'gmt'); // Friday |
|
237 | 237 | $date_saturday_5 = dol_mktime(0, 0, 0, 1, 5, 2013, 'gmt'); // Saturday |
238 | - $date_monday_7 = dol_mktime(0, 0, 0, 1, 7, 2013, 'gmt'); // Monday |
|
239 | - $date_friday_11 = dol_mktime(0, 0, 0, 1, 11, 2013, 'gmt'); // Following Friday |
|
238 | + $date_monday_7 = dol_mktime(0, 0, 0, 1, 7, 2013, 'gmt'); // Monday |
|
239 | + $date_friday_11 = dol_mktime(0, 0, 0, 1, 11, 2013, 'gmt'); // Following Friday |
|
240 | 240 | |
241 | 241 | // Case 1: Weekend Boundary (Friday morning -> Saturday morning) |
242 | 242 | // Expected: 1 day. No half-day deduction for end date on a non-working day. |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function testConvertTime2Seconds() |
278 | 278 | { |
279 | - global $conf,$user,$langs,$db; |
|
279 | + global $conf, $user, $langs, $db; |
|
280 | 280 | $conf = $this->savconf; |
281 | 281 | $user = $this->savuser; |
282 | 282 | $langs = $this->savlangs; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function testConvertSecondToTime() |
298 | 298 | { |
299 | - global $conf,$user,$langs,$db; |
|
299 | + global $conf, $user, $langs, $db; |
|
300 | 300 | $conf = $this->savconf; |
301 | 301 | $user = $this->savuser; |
302 | 302 | $langs = $this->savlangs; |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function testDolPrintDate() |
322 | 322 | { |
323 | - global $conf,$user,$langs,$db; |
|
323 | + global $conf, $user, $langs, $db; |
|
324 | 324 | $conf = $this->savconf; |
325 | 325 | $user = $this->savuser; |
326 | 326 | $langs = $this->savlangs; |
327 | 327 | $db = $this->savdb; |
328 | 328 | |
329 | 329 | // Check %Y-%m-%d %H:%M:%S format |
330 | - $result = dol_print_date('1970-01-01', '%Y-%m-%d %H:%M:%S', true); // A case for compatibility check |
|
330 | + $result = dol_print_date('1970-01-01', '%Y-%m-%d %H:%M:%S', true); // A case for compatibility check |
|
331 | 331 | print __METHOD__." result=".$result."\n"; |
332 | 332 | $this->assertEquals('1970-01-01 00:00:00', $result); |
333 | 333 | |
@@ -343,22 +343,22 @@ discard block |
||
343 | 343 | $this->assertEquals('1970-01-01T00:00:00Z', $result); |
344 | 344 | |
345 | 345 | // Check %Y-%m-%d %H:%M:%S format |
346 | - $result = dol_print_date(16725225600, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
346 | + $result = dol_print_date(16725225600, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
347 | 347 | print __METHOD__." result=".$result."\n"; |
348 | 348 | $this->assertEquals('2500-01-01 00:00:00', $result); |
349 | 349 | |
350 | 350 | // Check %Y-%m-%d %H:%M:%S format |
351 | - $result = dol_print_date(-1830384000, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
351 | + $result = dol_print_date(-1830384000, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
352 | 352 | print __METHOD__." result=".$result."\n"; |
353 | - $this->assertEquals('1912-01-01 00:00:00', $result); // dol_print_date use TZ (good) but epoch converter does not use it. |
|
353 | + $this->assertEquals('1912-01-01 00:00:00', $result); // dol_print_date use TZ (good) but epoch converter does not use it. |
|
354 | 354 | |
355 | 355 | // Check %Y-%m-%d %H:%M:%S format |
356 | - $result = dol_print_date(-11676096000, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
356 | + $result = dol_print_date(-11676096000, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
357 | 357 | print __METHOD__." result=".$result."\n"; |
358 | 358 | $this->assertEquals('1600-01-01 00:00:00', $result); |
359 | 359 | |
360 | 360 | // test with negative timezone |
361 | - $result = dol_print_date(-1, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
361 | + $result = dol_print_date(-1, '%Y-%m-%d %H:%M:%S', true); // http://www.epochconverter.com/ |
|
362 | 362 | print __METHOD__." result=".$result."\n"; |
363 | 363 | $this->assertEquals('1969-12-31 23:59:59', $result); |
364 | 364 | |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public function testDolTimePlusDuree() |
413 | 413 | { |
414 | - global $conf,$user,$langs,$db; |
|
414 | + global $conf, $user, $langs, $db; |
|
415 | 415 | $conf = $this->savconf; |
416 | 416 | $user = $this->savuser; |
417 | 417 | $langs = $this->savlangs; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | */ |
437 | 437 | public function testDolStringToTime() |
438 | 438 | { |
439 | - global $conf,$user,$langs,$db; |
|
439 | + global $conf, $user, $langs, $db; |
|
440 | 440 | $conf = $this->savconf; |
441 | 441 | $user = $this->savuser; |
442 | 442 | $langs = $this->savlangs; |
@@ -482,16 +482,16 @@ discard block |
||
482 | 482 | $day = 3; |
483 | 483 | $month = 2; |
484 | 484 | $year = 2015; |
485 | - $conf->global->MAIN_START_WEEK = 1; // start on monday |
|
485 | + $conf->global->MAIN_START_WEEK = 1; // start on monday |
|
486 | 486 | $prev = dol_get_first_day_week($day, $month, $year); |
487 | - $this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2 |
|
487 | + $this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2 |
|
488 | 488 | |
489 | 489 | $day = 3; |
490 | 490 | $month = 2; |
491 | 491 | $year = 2015; |
492 | - $conf->global->MAIN_START_WEEK = 0; // start on sunday |
|
492 | + $conf->global->MAIN_START_WEEK = 0; // start on sunday |
|
493 | 493 | $prev = dol_get_first_day_week($day, $month, $year); |
494 | - $this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st |
|
494 | + $this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st |
|
495 | 495 | |
496 | 496 | return 1; |
497 | 497 | } |
@@ -506,15 +506,15 @@ discard block |
||
506 | 506 | { |
507 | 507 | global $conf; |
508 | 508 | |
509 | - $now = 1800 + (24 * 3600 * 10); // The 11th of january 1970 at 0:30 in UTC |
|
509 | + $now = 1800 + (24 * 3600 * 10); // The 11th of january 1970 at 0:30 in UTC |
|
510 | 510 | $result = dol_get_first_hour($now, 'gmt'); |
511 | 511 | print __METHOD__." now = ".$now.", dol_print_date(now, 'dayhourrfc', 'gmt') = ".dol_print_date($now, 'dayhourrfc', 'gmt').", result = ".$result.", dol_print_date(result, 'dayhourrfc', 'gmt') = ".dol_print_date($result, 'dayhourrfc', 'gmt')."\n"; |
512 | - $this->assertEquals('1970-01-11T00:00:00Z', dol_print_date($result, 'dayhourrfc', 'gmt')); // monday for month 2, year 2014 is the 2 |
|
512 | + $this->assertEquals('1970-01-11T00:00:00Z', dol_print_date($result, 'dayhourrfc', 'gmt')); // monday for month 2, year 2014 is the 2 |
|
513 | 513 | |
514 | - $now = 23.5 * 3600 + (24 * 3600 * 10); // The 11th of january 1970 at 23:30 in UTC |
|
514 | + $now = 23.5 * 3600 + (24 * 3600 * 10); // The 11th of january 1970 at 23:30 in UTC |
|
515 | 515 | $result = dol_get_first_hour($now, 'gmt'); |
516 | 516 | print __METHOD__." now = ".$now.", dol_print_date(now, 'dayhourrfc', 'gmt') = ".dol_print_date($now, 'dayhourrfc', 'gmt').", result = ".$result.", dol_print_date(result, 'dayhourrfc', 'gmt') = ".dol_print_date($result, 'dayhourrfc', 'gmt')."\n"; |
517 | - $this->assertEquals('1970-01-11T00:00:00Z', dol_print_date($result, 'dayhourrfc', 'gmt')); // monday for month 2, year 2014 is the 2 |
|
517 | + $this->assertEquals('1970-01-11T00:00:00Z', dol_print_date($result, 'dayhourrfc', 'gmt')); // monday for month 2, year 2014 is the 2 |
|
518 | 518 | |
519 | 519 | return 1; |
520 | 520 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | $arrayofcss[] = 'admin/tools/ui/css/documentation.css'; |
285 | 285 | |
286 | - top_htmlhead('', $title, 0, 0, $arrayofjs, $arrayofcss); |
|
286 | + top_htmlhead('', $title, 0, 0, $arrayofjs, $arrayofcss); |
|
287 | 287 | |
288 | 288 | print '<body class="dolibarr-doc'.($hidenavmenu ? "-bis" : "").'">'; |
289 | 289 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function showCode($lines = array(), $option = 'html') |
492 | 492 | { |
493 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
493 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
494 | 494 | print '<div class="documentation-code">'; |
495 | 495 | |
496 | 496 | if (isset($lines[0])) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
502 | - $content = implode("\n", $lines) . "\n"; |
|
502 | + $content = implode("\n", $lines)."\n"; |
|
503 | 503 | $doleditor = new DolEditor(md5($content), $content, '', 0, 'Basic', 'In', true, false, 'ace', 0, '99%', 1); |
504 | 504 | print $doleditor->Create(1, '', false, '', $option); |
505 | 505 | print '</div>'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $head[$h][1] = $langs->trans("ExtraFields"); |
52 | 52 | $nbExtrafields = (isset($extrafields->attributes['bom_bom']['label']) && is_countable($extrafields->attributes['bom_bom']['label'])) ? count($extrafields->attributes['bom_bom']['label']) : 0; |
53 | 53 | if ($nbExtrafields > 0) { |
54 | - $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>'; |
|
54 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>'; |
|
55 | 55 | } |
56 | 56 | $head[$h][2] = 'bom_extrafields'; |
57 | 57 | $h++; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $head[$h][1] = $langs->trans("ExtraFieldsLines"); |
61 | 61 | $nbExtrafields = (isset($extrafields->attributes['bom_bomline']['label']) && is_countable($extrafields->attributes['bom_bomline']['label'])) ? count($extrafields->attributes['bom_bomline']['label']) : 0; |
62 | 62 | if ($nbExtrafields > 0) { |
63 | - $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>'; |
|
63 | + $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>'; |
|
64 | 64 | } |
65 | 65 | $head[$h][2] = 'bomline_extrafields'; |
66 | 66 | $h++; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
129 | 129 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
130 | - $upload_dir = getMultidirOutput($object) . "/".dol_sanitizeFileName($object->ref); |
|
130 | + $upload_dir = getMultidirOutput($object)."/".dol_sanitizeFileName($object->ref); |
|
131 | 131 | $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
132 | 132 | $nbLinks = Link::count($db, $object->element, $object->id); |
133 | 133 | $head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array |
62 | 62 | |
63 | 63 | // Massaction |
64 | -$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; |
|
64 | +$diroutputmassaction = getMultidirOutput($object).'/temp/massgeneration/'.$user->id; |
|
65 | 65 | |
66 | 66 | // Fetch optionals attributes and labels |
67 | 67 | $extrafields->fetch_name_optionals_label($object->table_element); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | print "<thead>\n"; |
243 | 243 | print '<tr class="liste_titre nodrag nodrop">'; |
244 | 244 | print '<td class="linecoldescription">'.$langs->trans('Product'); |
245 | - if (getDolGlobalString('BOM_SUB_BOM') && $action == 'treeview') { |
|
245 | + if (getDolGlobalString('BOM_SUB_BOM') && $action == 'treeview') { |
|
246 | 246 | print ' <a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a> '; |
247 | 247 | print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> '; |
248 | 248 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | print '<td class="left">'.$langs->trans('ProducedBy').'</td>'; |
252 | 252 | } |
253 | 253 | print '<td class="linecolqty right">'.$langs->trans('Quantity').'</td>'; |
254 | - print '<td></td>'; // For unit |
|
254 | + print '<td></td>'; // For unit |
|
255 | 255 | print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>'; |
256 | 256 | print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>'; |
257 | 257 | print '</tr>'; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $sql .= " FROM ".$this->db->prefix().$objectline->table_element." as l"; |
453 | 453 | $sql .= " LEFT JOIN ".$this->db->prefix()."product as p ON p.rowid = l.fk_product"; |
454 | 454 | $sql .= " WHERE l.fk_".$this->db->escape($this->element)." = ".((int) $this->id); |
455 | - $sql .= " AND p.fk_product_type = ". ((int) $typeproduct); |
|
455 | + $sql .= " AND p.fk_product_type = ".((int) $typeproduct); |
|
456 | 456 | if (isset($objectline->fields['position'])) { |
457 | 457 | $sql .= $this->db->order('position', 'ASC'); |
458 | 458 | } |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | if (getDolGlobalString('BOM_ADDON')) { |
871 | 871 | $mybool = false; |
872 | 872 | |
873 | - $file = getDolGlobalString('BOM_ADDON') . ".php"; |
|
873 | + $file = getDolGlobalString('BOM_ADDON').".php"; |
|
874 | 874 | $classname = getDolGlobalString('BOM_ADDON'); |
875 | 875 | |
876 | 876 | // Include file with class |
@@ -987,15 +987,15 @@ discard block |
||
987 | 987 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
988 | 988 | $oldref = dol_sanitizeFileName($this->ref); |
989 | 989 | $newref = dol_sanitizeFileName($num); |
990 | - $dirsource = getMultidirOutput($this) . '/'.$oldref; |
|
991 | - $dirdest = getMultidirOutput($this) . '/'.$newref; |
|
990 | + $dirsource = getMultidirOutput($this).'/'.$oldref; |
|
991 | + $dirdest = getMultidirOutput($this).'/'.$newref; |
|
992 | 992 | if (!$error && file_exists($dirsource)) { |
993 | 993 | dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
994 | 994 | |
995 | 995 | if (@rename($dirsource, $dirdest)) { |
996 | 996 | dol_syslog("Rename ok"); |
997 | 997 | // Rename docs starting with $oldref with $newref |
998 | - $listoffiles = dol_dir_list(getMultidirOutput($this) . '/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
998 | + $listoffiles = dol_dir_list(getMultidirOutput($this).'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
999 | 999 | foreach ($listoffiles as $fileentry) { |
1000 | 1000 | $dirsource = $fileentry['name']; |
1001 | 1001 | $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
@@ -1434,7 +1434,7 @@ discard block |
||
1434 | 1434 | foreach ($this->lines as &$line) { |
1435 | 1435 | $tmpproduct->cost_price = 0; |
1436 | 1436 | $tmpproduct->pmp = 0; |
1437 | - $result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading |
|
1437 | + $result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading |
|
1438 | 1438 | |
1439 | 1439 | if ($tmpproduct->type == $tmpproduct::TYPE_PRODUCT) { |
1440 | 1440 | if (empty($line->fk_bom_child)) { |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | */ |
1656 | 1656 | public function getKanbanView($option = '', $arraydata = null) |
1657 | 1657 | { |
1658 | - global $db,$langs; |
|
1658 | + global $db, $langs; |
|
1659 | 1659 | |
1660 | 1660 | $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); |
1661 | 1661 |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search |
53 | 53 | $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page |
54 | 54 | $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') |
55 | -$mode = GETPOST('mode', 'aZ'); // mode view (kanban or common) |
|
55 | +$mode = GETPOST('mode', 'aZ'); // mode view (kanban or common) |
|
56 | 56 | |
57 | -$id = GETPOSTINT('id'); |
|
57 | +$id = GETPOSTINT('id'); |
|
58 | 58 | |
59 | 59 | // Load variable for pagination |
60 | 60 | $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | // Initialize a technical objects |
75 | 75 | $object = new BOM($db); |
76 | 76 | $extrafields = new ExtraFields($db); |
77 | -$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; |
|
77 | +$diroutputmassaction = getMultidirOutput($object).'/temp/massgeneration/'.$user->id; |
|
78 | 78 | $hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array |
79 | 79 | |
80 | 80 | // Fetch optionals attributes and labels |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | // Default sort order (if not yet defined by previous GETPOST) |
86 | 86 | if (!$sortfield) { |
87 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
87 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
88 | 88 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
89 | 89 | } |
90 | 90 | if (!$sortorder) { |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | } |
552 | 552 | |
553 | 553 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
554 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
554 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
555 | 555 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
556 | 556 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
557 | 557 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
647 | 647 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
648 | 648 | } |
649 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
649 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
650 | 650 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
651 | 651 | if ($key == "fk_product") { |
652 | 652 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 'p.ref', '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | // Initialize a technical objects |
86 | 86 | $object = new BOM($db); |
87 | 87 | $extrafields = new ExtraFields($db); |
88 | -$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; |
|
88 | +$diroutputmassaction = getMultidirOutput($object).'/temp/massgeneration/'.$user->id; |
|
89 | 89 | $hookmanager->initHooks(array('bomagenda', 'globalcard')); // Note that conf->hooks_modules contains array |
90 | 90 | |
91 | 91 | // Fetch optionals attributes and labels |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Initialize a technical objects |
65 | 65 | $object = new BOM($db); |
66 | 66 | $extrafields = new ExtraFields($db); |
67 | -$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; |
|
67 | +$diroutputmassaction = getMultidirOutput($object).'/temp/massgeneration/'.$user->id; |
|
68 | 68 | $hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array |
69 | 69 | |
70 | 70 | // Fetch optionals attributes and labels |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $bomline->fetch($lineid); |
288 | 288 | |
289 | 289 | $fk_default_workstation = $bomline->fk_default_workstation; |
290 | - if (isModEnabled('workstation') && GETPOSTISSET('idworkstations')) { |
|
290 | + if (isModEnabled('workstation') && GETPOSTISSET('idworkstations')) { |
|
291 | 291 | $fk_default_workstation = GETPOSTINT('idworkstations'); |
292 | 292 | } |
293 | 293 | |
@@ -607,17 +607,17 @@ discard block |
||
607 | 607 | if (!empty($object->table_element_line)) { |
608 | 608 | // Products |
609 | 609 | |
610 | - $res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines |
|
610 | + $res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines |
|
611 | 611 | $object->calculateCosts(); |
612 | 612 | |
613 | 613 | print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); |
614 | 614 | |
615 | - print ' <form name="addproduct" id="listbomproducts" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST"> |
|
616 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
617 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
615 | + print ' <form name="addproduct" id="listbomproducts" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST"> |
|
616 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
617 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
618 | 618 | <input type="hidden" name="mode" value=""> |
619 | 619 | <input type="hidden" name="page_y" value=""> |
620 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
620 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
621 | 621 | '; |
622 | 622 | |
623 | 623 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
@@ -661,21 +661,21 @@ discard block |
||
661 | 661 | // Services |
662 | 662 | |
663 | 663 | $filtertype = 1; |
664 | - $res = $object->fetchLinesbytypeproduct($filtertype); // Load all lines services into ->lines |
|
664 | + $res = $object->fetchLinesbytypeproduct($filtertype); // Load all lines services into ->lines |
|
665 | 665 | $object->calculateCosts(); |
666 | 666 | |
667 | 667 | print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); |
668 | 668 | |
669 | - print ' <form name="addservice" id="listbomservices" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST"> |
|
670 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
671 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
669 | + print ' <form name="addservice" id="listbomservices" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST"> |
|
670 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
671 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
672 | 672 | <input type="hidden" name="mode" value=""> |
673 | - <input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id . '"> |
|
673 | + <input type="hidden" name="page_y" value=""> <input type="hidden" name="id" value="' . $object->id.'"> |
|
674 | 674 | '; |
675 | 675 | |
676 | 676 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
677 | 677 | $tagidfortablednd = 'tablelinesservice'; |
678 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
678 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | print '<div class="div-table-responsive-no-min">'; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | // Documents |
812 | 812 | $objref = dol_sanitizeFileName($object->ref); |
813 | 813 | $relativepath = $objref.'/'.$objref.'.pdf'; |
814 | - $filedir = getMultidirOutput($object) . '/'.$objref; |
|
814 | + $filedir = getMultidirOutput($object).'/'.$objref; |
|
815 | 815 | $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; |
816 | 816 | $genallowed = $user->hasRight('bom', 'read'); // If you can read, you can build the PDF to read content |
817 | 817 | $delallowed = $user->hasRight('bom', 'write'); // If you can create/edit, you can remove a file on card |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hooks_modules contains array |
54 | 54 | |
55 | 55 | // Massactions |
56 | -$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id; |
|
56 | +$diroutputmassaction = getMultidirOutput($object).'/temp/massgeneration/'.$user->id; |
|
57 | 57 | |
58 | 58 | // Fetch optionals attributes and labels |
59 | 59 | $extrafields->fetch_name_optionals_label($object->table_element); |