@@ -223,7 +223,9 @@ |
||
| 223 | 223 | print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">'; |
| 224 | 224 | |
| 225 | 225 | $line->qty = (float) $line->qty; |
| 226 | -if ($tmpbom->id > 0) $line->qty /= $tmpbom->qty; |
|
| 226 | +if ($tmpbom->id > 0) { |
|
| 227 | + $line->qty /= $tmpbom->qty; |
|
| 228 | +} |
|
| 227 | 229 | |
| 228 | 230 | $coldisplay++; |
| 229 | 231 | if (!empty($line->fk_bom_child)) { |
@@ -79,17 +79,22 @@ discard block |
||
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if ($this->page <= 0) |
|
| 83 | - $this->error("You have to add a page to fpdf first!"); |
|
| 82 | + if ($this->page <= 0) { |
|
| 83 | + $this->error("You have to add a page to fpdf first!"); |
|
| 84 | + } |
|
| 84 | 85 | |
| 85 | - if ($x == null) |
|
| 86 | - $x = 0; |
|
| 87 | - if ($y == null) |
|
| 88 | - $y = 0; |
|
| 89 | - if ($w == null) |
|
| 90 | - $w = $this->w; |
|
| 91 | - if ($h == null) |
|
| 92 | - $h = $this->h; |
|
| 86 | + if ($x == null) { |
|
| 87 | + $x = 0; |
|
| 88 | + } |
|
| 89 | + if ($y == null) { |
|
| 90 | + $y = 0; |
|
| 91 | + } |
|
| 92 | + if ($w == null) { |
|
| 93 | + $w = $this->w; |
|
| 94 | + } |
|
| 95 | + if ($h == null) { |
|
| 96 | + $h = $this->h; |
|
| 97 | + } |
|
| 93 | 98 | |
| 94 | 99 | // Save settings |
| 95 | 100 | $this->tpl++; |
@@ -165,8 +170,9 @@ discard block |
||
| 165 | 170 | $this->FontSize = $tpl['o_FontSize']; |
| 166 | 171 | |
| 167 | 172 | $fontkey = $this->FontFamily . $this->FontStyle; |
| 168 | - if ($fontkey) |
|
| 169 | - $this->CurrentFont =& $this->fonts[$fontkey]; |
|
| 173 | + if ($fontkey) { |
|
| 174 | + $this->CurrentFont =& $this->fonts[$fontkey]; |
|
| 175 | + } |
|
| 170 | 176 | |
| 171 | 177 | return $this->tpl; |
| 172 | 178 | } else { |
@@ -192,11 +198,13 @@ discard block |
||
| 192 | 198 | * @retrun array The height and width of the template |
| 193 | 199 | */ |
| 194 | 200 | function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) { |
| 195 | - if ($this->page <= 0) |
|
| 196 | - $this->error('You have to add a page first!'); |
|
| 201 | + if ($this->page <= 0) { |
|
| 202 | + $this->error('You have to add a page first!'); |
|
| 203 | + } |
|
| 197 | 204 | |
| 198 | - if (!isset($this->tpls[$tplidx])) |
|
| 199 | - $this->error('Template does not exist!'); |
|
| 205 | + if (!isset($this->tpls[$tplidx])) { |
|
| 206 | + $this->error('Template does not exist!'); |
|
| 207 | + } |
|
| 200 | 208 | |
| 201 | 209 | if ($this->_intpl) { |
| 202 | 210 | $this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx]; |
@@ -206,10 +214,12 @@ discard block |
||
| 206 | 214 | $w = $tpl['w']; |
| 207 | 215 | $h = $tpl['h']; |
| 208 | 216 | |
| 209 | - if ($_x == null) |
|
| 210 | - $_x = 0; |
|
| 211 | - if ($_y == null) |
|
| 212 | - $_y = 0; |
|
| 217 | + if ($_x == null) { |
|
| 218 | + $_x = 0; |
|
| 219 | + } |
|
| 220 | + if ($_y == null) { |
|
| 221 | + $_y = 0; |
|
| 222 | + } |
|
| 213 | 223 | |
| 214 | 224 | $_x += $tpl['x']; |
| 215 | 225 | $_y += $tpl['y']; |
@@ -249,8 +259,9 @@ discard block |
||
| 249 | 259 | * @return array The height and width of the template |
| 250 | 260 | */ |
| 251 | 261 | function getTemplateSize($tplidx, $_w = 0, $_h = 0) { |
| 252 | - if (!isset($this->tpls[$tplidx])) |
|
| 253 | - return false; |
|
| 262 | + if (!isset($this->tpls[$tplidx])) { |
|
| 263 | + return false; |
|
| 264 | + } |
|
| 254 | 265 | |
| 255 | 266 | $tpl =& $this->tpls[$tplidx]; |
| 256 | 267 | $w = $tpl['w']; |
@@ -261,10 +272,12 @@ discard block |
||
| 261 | 272 | $_h = $h; |
| 262 | 273 | } |
| 263 | 274 | |
| 264 | - if($_w == 0) |
|
| 265 | - $_w = $_h * $w / $h; |
|
| 266 | - if($_h == 0) |
|
| 267 | - $_h = $_w * $h / $w; |
|
| 275 | + if($_w == 0) { |
|
| 276 | + $_w = $_h * $w / $h; |
|
| 277 | + } |
|
| 278 | + if($_h == 0) { |
|
| 279 | + $_h = $_w * $h / $w; |
|
| 280 | + } |
|
| 268 | 281 | |
| 269 | 282 | return array("w" => $_w, "h" => $_h); |
| 270 | 283 | } |
@@ -323,8 +336,9 @@ discard block |
||
| 323 | 336 | return parent::AddPage(...$args); |
| 324 | 337 | } |
| 325 | 338 | |
| 326 | - if ($this->_intpl) |
|
| 327 | - $this->Error('Adding pages in templates isn\'t possible!'); |
|
| 339 | + if ($this->_intpl) { |
|
| 340 | + $this->Error('Adding pages in templates isn\'t possible!'); |
|
| 341 | + } |
|
| 328 | 342 | |
| 329 | 343 | parent::AddPage($orientation, $format); |
| 330 | 344 | } |
@@ -338,8 +352,9 @@ discard block |
||
| 338 | 352 | return parent::Link(...$args); |
| 339 | 353 | } |
| 340 | 354 | |
| 341 | - if ($this->_intpl) |
|
| 342 | - $this->Error('Using links in templates aren\'t possible!'); |
|
| 355 | + if ($this->_intpl) { |
|
| 356 | + $this->Error('Using links in templates aren\'t possible!'); |
|
| 357 | + } |
|
| 343 | 358 | |
| 344 | 359 | parent::Link($x, $y, $w, $h, $link); |
| 345 | 360 | } |
@@ -351,8 +366,9 @@ discard block |
||
| 351 | 366 | |
| 352 | 367 | } |
| 353 | 368 | |
| 354 | - if ($this->_intpl) |
|
| 355 | - $this->Error('Adding links in templates aren\'t possible!'); |
|
| 369 | + if ($this->_intpl) { |
|
| 370 | + $this->Error('Adding links in templates aren\'t possible!'); |
|
| 371 | + } |
|
| 356 | 372 | return parent::AddLink(); |
| 357 | 373 | } |
| 358 | 374 | |
@@ -362,8 +378,9 @@ discard block |
||
| 362 | 378 | return parent::SetLink(...$args); |
| 363 | 379 | } |
| 364 | 380 | |
| 365 | - if ($this->_intpl) |
|
| 366 | - $this->Error('Setting links in templates aren\'t possible!'); |
|
| 381 | + if ($this->_intpl) { |
|
| 382 | + $this->Error('Setting links in templates aren\'t possible!'); |
|
| 383 | + } |
|
| 367 | 384 | parent::SetLink($link, $y, $page); |
| 368 | 385 | } |
| 369 | 386 | |
@@ -403,8 +420,9 @@ discard block |
||
| 403 | 420 | $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); |
| 404 | 421 | if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) { |
| 405 | 422 | $this->_out('/Font <<'); |
| 406 | - foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) |
|
| 407 | - $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 423 | + foreach($this->_res['tpl'][$tplidx]['fonts'] as $font) { |
|
| 424 | + $this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R'); |
|
| 425 | + } |
|
| 408 | 426 | $this->_out('>>'); |
| 409 | 427 | } |
| 410 | 428 | if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) || |
@@ -412,12 +430,14 @@ discard block |
||
| 412 | 430 | { |
| 413 | 431 | $this->_out('/XObject <<'); |
| 414 | 432 | if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) { |
| 415 | - foreach($this->_res['tpl'][$tplidx]['images'] as $image) |
|
| 416 | - $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 433 | + foreach($this->_res['tpl'][$tplidx]['images'] as $image) { |
|
| 434 | + $this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R'); |
|
| 435 | + } |
|
| 417 | 436 | } |
| 418 | 437 | if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) { |
| 419 | - foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) |
|
| 420 | - $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 438 | + foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl) { |
|
| 439 | + $this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R'); |
|
| 440 | + } |
|
| 421 | 441 | } |
| 422 | 442 | $this->_out('>>'); |
| 423 | 443 | } |
@@ -175,7 +175,10 @@ |
||
| 175 | 175 | { |
| 176 | 176 | global $conf; |
| 177 | 177 | |
| 178 | - if (empty($auxiliary_account)) return true; // No check needed if no auxiliary account used |
|
| 178 | + if (empty($auxiliary_account)) { |
|
| 179 | + return true; |
|
| 180 | + } |
|
| 181 | + // No check needed if no auxiliary account used |
|
| 179 | 182 | |
| 180 | 183 | // Build SQL to get general account info based on rowid or account number |
| 181 | 184 | $sql = "SELECT rowid, account_number, centralized"; |
@@ -657,7 +657,10 @@ |
||
| 657 | 657 | if (in_array($key, array('__NEWREF__', '__REFCLIENT__', '__REFSUPPLIER__', '__SUPPLIER_ORDER_DATE_DELIVERY__', '__SUPPLIER_ORDER_DELAY_DELIVERY__'))) { |
| 658 | 658 | continue; |
| 659 | 659 | } |
| 660 | - if (is_array($val)) $val = implode(', ', $val); // key __MULTICURRENCY_CODE__ is an array and crashes dolGetFirstLineOfText function which accept only text |
|
| 660 | + if (is_array($val)) { |
|
| 661 | + $val = implode(', ', $val); |
|
| 662 | + } |
|
| 663 | + // key __MULTICURRENCY_CODE__ is an array and crashes dolGetFirstLineOfText function which accept only text |
|
| 661 | 664 | $helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'<br>'; |
| 662 | 665 | $helpforsubstitution .= '</span>'; |
| 663 | 666 | } |
@@ -608,8 +608,9 @@ |
||
| 608 | 608 | $this->task->timespent_duration = $duration; |
| 609 | 609 | $this->task->timespent_fk_user = $uid; |
| 610 | 610 | $this->task->timespent_note = $note; |
| 611 | - if (!empty($this->task->progress)) |
|
| 612 | - $this->task->progress = $progress; |
|
| 611 | + if (!empty($this->task->progress)) { |
|
| 612 | + $this->task->progress = $progress; |
|
| 613 | + } |
|
| 613 | 614 | |
| 614 | 615 | $result = $this->task->addTimeSpent(DolibarrApiAccess::$user, 0); |
| 615 | 616 | if ($result == 0) { |
@@ -1075,7 +1075,9 @@ discard block |
||
| 1075 | 1075 | $sql .= " AND (sc.fk_user = ".((int) $user->id); |
| 1076 | 1076 | if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) { |
| 1077 | 1077 | $userschilds = $user->getAllChildIds(); |
| 1078 | - if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; |
|
| 1078 | + if (!empty($userschilds)) { |
|
| 1079 | + $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; |
|
| 1080 | + } |
|
| 1079 | 1081 | } |
| 1080 | 1082 | $sql .= ")"; |
| 1081 | 1083 | $sql .= " AND sc.fk_soc = s.rowid"; |
@@ -1185,7 +1187,9 @@ discard block |
||
| 1185 | 1187 | $sql .= " AND (sc.fk_user = ".((int) $user->id); |
| 1186 | 1188 | if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) { |
| 1187 | 1189 | $userschilds = $user->getAllChildIds(); |
| 1188 | - if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; |
|
| 1190 | + if (!empty($userschilds)) { |
|
| 1191 | + $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")"; |
|
| 1192 | + } |
|
| 1189 | 1193 | } |
| 1190 | 1194 | $sql .= ')'; |
| 1191 | 1195 | } else { |
@@ -2431,14 +2431,17 @@ |
||
| 2431 | 2431 | $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; |
| 2432 | 2432 | $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; |
| 2433 | 2433 | } |
| 2434 | - if ($active != -1) |
|
| 2435 | - $sql .= " AND active = ".((int) $active); |
|
| 2434 | + if ($active != -1) { |
|
| 2435 | + $sql .= " AND active = ".((int) $active); |
|
| 2436 | + } |
|
| 2436 | 2437 | |
| 2437 | - if ($fk_country == -1) |
|
| 2438 | - $sql .= " AND fk_pays =".((int) $mysoc->country_id); |
|
| 2438 | + if ($fk_country == -1) { |
|
| 2439 | + $sql .= " AND fk_pays =".((int) $mysoc->country_id); |
|
| 2440 | + } |
|
| 2439 | 2441 | |
| 2440 | - if ($fk_country >0) |
|
| 2441 | - $sql .= " AND fk_pays =".((int) $fk_country); |
|
| 2442 | + if ($fk_country >0) { |
|
| 2443 | + $sql .= " AND fk_pays =".((int) $fk_country); |
|
| 2444 | + } |
|
| 2442 | 2445 | |
| 2443 | 2446 | $sql .= $this->db->order($sortfield, $sortorder); |
| 2444 | 2447 | |