@@ -1221,8 +1221,11 @@ discard block |
||
| 1221 | 1221 | $this->fk_facture_source = trim($this->fk_facture_source); |
| 1222 | 1222 | } |
| 1223 | 1223 | if (isset($this->fk_project)) { |
| 1224 | - if (empty($this->fk_project)) $this->fk_project = null; |
|
| 1225 | - else $this->fk_project = intval($this->fk_project); |
|
| 1224 | + if (empty($this->fk_project)) { |
|
| 1225 | + $this->fk_project = null; |
|
| 1226 | + } else { |
|
| 1227 | + $this->fk_project = intval($this->fk_project); |
|
| 1228 | + } |
|
| 1226 | 1229 | } |
| 1227 | 1230 | if (isset($this->cond_reglement_id)) { |
| 1228 | 1231 | $this->cond_reglement_id = trim($this->cond_reglement_id); |
@@ -1804,7 +1807,9 @@ discard block |
||
| 1804 | 1807 | $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'ACCOUNTANCY_CODE_SUPPLIER'); |
| 1805 | 1808 | foreach ($array_to_check as $key) { |
| 1806 | 1809 | $keymin = strtolower($key); |
| 1807 | - if ($keymin == 'accountancy_code_supplier') $keymin = 'code_compta_fournisseur'; |
|
| 1810 | + if ($keymin == 'accountancy_code_supplier') { |
|
| 1811 | + $keymin = 'code_compta_fournisseur'; |
|
| 1812 | + } |
|
| 1808 | 1813 | if (!property_exists($this->thirdparty, $keymin)) { |
| 1809 | 1814 | continue; |
| 1810 | 1815 | } |
@@ -3856,8 +3861,11 @@ discard block |
||
| 3856 | 3861 | $sql .= ", pu_ttc = ".price2num($this->pu_ttc); |
| 3857 | 3862 | $sql .= ", qty = ".price2num($this->qty); |
| 3858 | 3863 | $sql .= ", remise_percent = ".price2num($this->remise_percent); |
| 3859 | - if ($this->fk_remise_except > 0) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
| 3860 | - else $sql .= ", fk_remise_except=null"; |
|
| 3864 | + if ($this->fk_remise_except > 0) { |
|
| 3865 | + $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
| 3866 | + } else { |
|
| 3867 | + $sql .= ", fk_remise_except=null"; |
|
| 3868 | + } |
|
| 3861 | 3869 | $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; |
| 3862 | 3870 | $sql .= ", tva_tx = ".price2num($this->tva_tx); |
| 3863 | 3871 | $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); |
@@ -1196,8 +1196,11 @@ |
||
| 1196 | 1196 | $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA', 'ACCOUNTANCY_CODE_CUSTOMER', 'ACCOUNTANCY_CODE_SUPPLIER'); |
| 1197 | 1197 | foreach ($array_to_check as $key) { |
| 1198 | 1198 | $keymin = strtolower($key); |
| 1199 | - if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') $keymin = 'code_compta'; |
|
| 1200 | - elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') $keymin = 'code_compta_fournisseur'; |
|
| 1199 | + if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') { |
|
| 1200 | + $keymin = 'code_compta'; |
|
| 1201 | + } elseif ($key == 'ACCOUNTANCY_CODE_SUPPLIER') { |
|
| 1202 | + $keymin = 'code_compta_fournisseur'; |
|
| 1203 | + } |
|
| 1201 | 1204 | $i = (int) preg_replace('/[^0-9]/', '', $key); |
| 1202 | 1205 | $vallabel = $this->$keymin; |
| 1203 | 1206 | |
@@ -177,8 +177,12 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $this->db = $db; |
| 179 | 179 | |
| 180 | - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; |
|
| 181 | - if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; |
|
| 180 | + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { |
|
| 181 | + $this->fields['rowid']['visible'] = 0; |
|
| 182 | + } |
|
| 183 | + if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { |
|
| 184 | + $this->fields['entity']['enabled'] = 0; |
|
| 185 | + } |
|
| 182 | 186 | |
| 183 | 187 | // Unset fields that are disabled |
| 184 | 188 | foreach ($this->fields as $key => $val) { |
@@ -220,7 +224,9 @@ discard block |
||
| 220 | 224 | |
| 221 | 225 | // Load source object |
| 222 | 226 | $result = $object->fetchCommon($fromid); |
| 223 | - if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); |
|
| 227 | + if ($result > 0 && !empty($object->table_element_line)) { |
|
| 228 | + $object->fetchLines(); |
|
| 229 | + } |
|
| 224 | 230 | |
| 225 | 231 | // get lines so they will be clone |
| 226 | 232 | //foreach($this->lines as $line) |
@@ -232,8 +238,12 @@ discard block |
||
| 232 | 238 | unset($object->import_key); |
| 233 | 239 | |
| 234 | 240 | // Clear fields |
| 235 | - if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
| 236 | - if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
| 241 | + if (property_exists($object, 'ref')) { |
|
| 242 | + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
| 243 | + } |
|
| 244 | + if (property_exists($object, 'label')) { |
|
| 245 | + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
| 246 | + } |
|
| 237 | 247 | if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; } |
| 238 | 248 | if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); } |
| 239 | 249 | if (property_exists($object, 'date_modification')) { $object->date_modification = null; } |
@@ -270,8 +280,9 @@ discard block |
||
| 270 | 280 | if (!$error) { |
| 271 | 281 | // copy external contacts if same company |
| 272 | 282 | if (property_exists($this, 'socid') && $this->socid == $object->socid) { |
| 273 | - if ($this->copy_linked_contact($object, 'external') < 0) |
|
| 274 | - $error++; |
|
| 283 | + if ($this->copy_linked_contact($object, 'external') < 0) { |
|
| 284 | + $error++; |
|
| 285 | + } |
|
| 275 | 286 | } |
| 276 | 287 | } |
| 277 | 288 | |
@@ -320,8 +331,11 @@ discard block |
||
| 320 | 331 | $sql = "SELECT "; |
| 321 | 332 | $sql .= $this->getFieldList(); |
| 322 | 333 | $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; |
| 323 | - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($this->element).")"; |
|
| 324 | - else $sql .= " WHERE 1 = 1"; |
|
| 334 | + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
|
| 335 | + $sql .= " WHERE t.entity IN (".getEntity($this->element).")"; |
|
| 336 | + } else { |
|
| 337 | + $sql .= " WHERE 1 = 1"; |
|
| 338 | + } |
|
| 325 | 339 | // Manage filter |
| 326 | 340 | $sqlwhere = array(); |
| 327 | 341 | if (count($filter) > 0) { |
@@ -437,8 +451,12 @@ discard block |
||
| 437 | 451 | $sql = "UPDATE ".$this->db->prefix().$this->table_element; |
| 438 | 452 | $sql .= " SET ref = '".$this->db->escape($num)."',"; |
| 439 | 453 | $sql .= " status = ".self::STATUS_VALIDATED; |
| 440 | - if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
| 441 | - if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".$user->id; |
|
| 454 | + if (!empty($this->fields['date_validation'])) { |
|
| 455 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
| 456 | + } |
|
| 457 | + if (!empty($this->fields['fk_user_valid'])) { |
|
| 458 | + $sql .= ", fk_user_valid = ".$user->id; |
|
| 459 | + } |
|
| 442 | 460 | $sql .= " WHERE rowid = ".((int) $this->id); |
| 443 | 461 | |
| 444 | 462 | dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
@@ -452,7 +470,9 @@ discard block |
||
| 452 | 470 | if (!$error && !$notrigger) { |
| 453 | 471 | // Call trigger |
| 454 | 472 | $result = $this->call_trigger('PRODUCTFOURNISSEURPRICE_VALIDATE', $user); |
| 455 | - if ($result < 0) $error++; |
|
| 473 | + if ($result < 0) { |
|
| 474 | + $error++; |
|
| 475 | + } |
|
| 456 | 476 | // End call triggers |
| 457 | 477 | } |
| 458 | 478 | } |
@@ -573,7 +593,10 @@ discard block |
||
| 573 | 593 | { |
| 574 | 594 | global $conf, $langs, $hookmanager; |
| 575 | 595 | |
| 576 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
| 596 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 597 | + $notooltip = 1; |
|
| 598 | + } |
|
| 599 | + // Force disable tooltips |
|
| 577 | 600 | |
| 578 | 601 | $result = ''; |
| 579 | 602 | |
@@ -605,7 +628,9 @@ discard block |
||
| 605 | 628 | } |
| 606 | 629 | $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
| 607 | 630 | $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
| 608 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 631 | + } else { |
|
| 632 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 633 | + } |
|
| 609 | 634 | |
| 610 | 635 | $linkstart = '<a href="'.$url.'"'; |
| 611 | 636 | $linkstart .= $linkclose.'>'; |
@@ -614,7 +639,9 @@ discard block |
||
| 614 | 639 | $result .= $linkstart; |
| 615 | 640 | |
| 616 | 641 | if (empty($this->showphoto_on_popup)) { |
| 617 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 642 | + if ($withpicto) { |
|
| 643 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 644 | + } |
|
| 618 | 645 | } else { |
| 619 | 646 | if ($withpicto) { |
| 620 | 647 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -640,7 +667,9 @@ discard block |
||
| 640 | 667 | } |
| 641 | 668 | } |
| 642 | 669 | |
| 643 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 670 | + if ($withpicto != 2) { |
|
| 671 | + $result .= $this->ref; |
|
| 672 | + } |
|
| 644 | 673 | |
| 645 | 674 | $result .= $linkend; |
| 646 | 675 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
@@ -649,8 +678,11 @@ discard block |
||
| 649 | 678 | $hookmanager->initHooks(array('productfournisseurpricedao')); |
| 650 | 679 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
| 651 | 680 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 652 | - if ($reshook > 0) $result = $hookmanager->resPrint; |
|
| 653 | - else $result .= $hookmanager->resPrint; |
|
| 681 | + if ($reshook > 0) { |
|
| 682 | + $result = $hookmanager->resPrint; |
|
| 683 | + } else { |
|
| 684 | + $result .= $hookmanager->resPrint; |
|
| 685 | + } |
|
| 654 | 686 | |
| 655 | 687 | return $result; |
| 656 | 688 | } |
@@ -690,7 +722,9 @@ discard block |
||
| 690 | 722 | |
| 691 | 723 | $statusType = 'status'.$status; |
| 692 | 724 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
| 693 | - if ($status == self::STATUS_CANCELED) $statusType = 'status6'; |
|
| 725 | + if ($status == self::STATUS_CANCELED) { |
|
| 726 | + $statusType = 'status6'; |
|
| 727 | + } |
|
| 694 | 728 | |
| 695 | 729 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
| 696 | 730 | } |
@@ -183,8 +183,12 @@ discard block |
||
| 183 | 183 | $this->db = $db; |
| 184 | 184 | $this->origin_type = 'StockTransfer@product/stock/stocktransfer'; |
| 185 | 185 | |
| 186 | - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; |
|
| 187 | - if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; |
|
| 186 | + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { |
|
| 187 | + $this->fields['rowid']['visible'] = 0; |
|
| 188 | + } |
|
| 189 | + if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { |
|
| 190 | + $this->fields['entity']['enabled'] = 0; |
|
| 191 | + } |
|
| 188 | 192 | |
| 189 | 193 | // Example to show how to set values of fields definition dynamically |
| 190 | 194 | /*if ($user->rights->stocktransfer->stocktransfer->read) { |
@@ -221,10 +225,16 @@ discard block |
||
| 221 | 225 | public function create(User $user, $notrigger = false) |
| 222 | 226 | { |
| 223 | 227 | $model_pdf = GETPOST('model'); |
| 224 | - if (!empty($model_pdf)) $this->model_pdf = $model_pdf; |
|
| 228 | + if (!empty($model_pdf)) { |
|
| 229 | + $this->model_pdf = $model_pdf; |
|
| 230 | + } |
|
| 225 | 231 | $this->status = (int) $this->status; |
| 226 | - if ($this->fk_warehouse_source <= 0) $this->fk_warehouse_source = 0; |
|
| 227 | - if ($this->fk_warehouse_destination <= 0) $this->fk_warehouse_destination = 0; |
|
| 232 | + if ($this->fk_warehouse_source <= 0) { |
|
| 233 | + $this->fk_warehouse_source = 0; |
|
| 234 | + } |
|
| 235 | + if ($this->fk_warehouse_destination <= 0) { |
|
| 236 | + $this->fk_warehouse_destination = 0; |
|
| 237 | + } |
|
| 228 | 238 | return $this->createCommon($user, $notrigger); |
| 229 | 239 | } |
| 230 | 240 | |
@@ -248,7 +258,9 @@ discard block |
||
| 248 | 258 | |
| 249 | 259 | // Load source object |
| 250 | 260 | $result = $object->fetchCommon($fromid); |
| 251 | - if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); |
|
| 261 | + if ($result > 0 && !empty($object->table_element_line)) { |
|
| 262 | + $object->fetchLines(); |
|
| 263 | + } |
|
| 252 | 264 | |
| 253 | 265 | // get lines so they will be clone |
| 254 | 266 | //foreach($this->lines as $line) |
@@ -300,8 +312,9 @@ discard block |
||
| 300 | 312 | if (!$error) { |
| 301 | 313 | // copy external contacts if same company |
| 302 | 314 | if (property_exists($this, 'socid') && $this->socid == $object->socid) { |
| 303 | - if ($this->copy_linked_contact($object, 'external') < 0) |
|
| 304 | - $error++; |
|
| 315 | + if ($this->copy_linked_contact($object, 'external') < 0) { |
|
| 316 | + $error++; |
|
| 317 | + } |
|
| 305 | 318 | } |
| 306 | 319 | } |
| 307 | 320 | |
@@ -327,7 +340,9 @@ discard block |
||
| 327 | 340 | public function fetch($id, $ref = null) |
| 328 | 341 | { |
| 329 | 342 | $result = $this->fetchCommon($id, $ref); |
| 330 | - if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); |
|
| 343 | + if ($result > 0 && !empty($this->table_element_line)) { |
|
| 344 | + $this->fetchLines(); |
|
| 345 | + } |
|
| 331 | 346 | return $result; |
| 332 | 347 | } |
| 333 | 348 | |
@@ -371,9 +386,13 @@ discard block |
||
| 371 | 386 | |
| 372 | 387 | $total_pmp = 0; |
| 373 | 388 | |
| 374 | - if (empty($this->lines)) $this->fetchLines(); |
|
| 389 | + if (empty($this->lines)) { |
|
| 390 | + $this->fetchLines(); |
|
| 391 | + } |
|
| 375 | 392 | if (!empty($this->lines)) { |
| 376 | - foreach ($this->lines as $l) $total_pmp+= ($l->pmp * $l->qty); |
|
| 393 | + foreach ($this->lines as $l) { |
|
| 394 | + $total_pmp+= ($l->pmp * $l->qty); |
|
| 395 | + } |
|
| 377 | 396 | } |
| 378 | 397 | |
| 379 | 398 | return $total_pmp; |
@@ -401,8 +420,11 @@ discard block |
||
| 401 | 420 | $sql = 'SELECT '; |
| 402 | 421 | $sql .= $this->getFieldList(); |
| 403 | 422 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
| 404 | - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
| 405 | - else $sql .= ' WHERE 1 = 1'; |
|
| 423 | + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
|
| 424 | + $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
| 425 | + } else { |
|
| 426 | + $sql .= ' WHERE 1 = 1'; |
|
| 427 | + } |
|
| 406 | 428 | // Manage filter |
| 407 | 429 | $sqlwhere = array(); |
| 408 | 430 | if (count($filter) > 0) { |
@@ -465,8 +487,12 @@ discard block |
||
| 465 | 487 | { |
| 466 | 488 | $this->tms = ''; // Will be done automatically because tms field is on update cascade |
| 467 | 489 | $res = $this->updateCommon($user, $notrigger); |
| 468 | - if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) $this->fetch_thirdparty(); |
|
| 469 | - if (empty($this->socid) && empty($this->fk_soc)) unset($this->thirdparty); |
|
| 490 | + if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) { |
|
| 491 | + $this->fetch_thirdparty(); |
|
| 492 | + } |
|
| 493 | + if (empty($this->socid) && empty($this->fk_soc)) { |
|
| 494 | + unset($this->thirdparty); |
|
| 495 | + } |
|
| 470 | 496 | return $res; |
| 471 | 497 | } |
| 472 | 498 | |
@@ -553,8 +579,12 @@ discard block |
||
| 553 | 579 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 554 | 580 | $sql .= " SET ref = '".$this->db->escape($num)."',"; |
| 555 | 581 | $sql .= " status = ".self::STATUS_VALIDATED; |
| 556 | - if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',"; |
|
| 557 | - if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id); |
|
| 582 | + if (!empty($this->fields['date_validation'])) { |
|
| 583 | + $sql .= ", date_validation = '".$this->db->idate($now)."',"; |
|
| 584 | + } |
|
| 585 | + if (!empty($this->fields['fk_user_valid'])) { |
|
| 586 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
| 587 | + } |
|
| 558 | 588 | $sql .= " WHERE rowid = ".((int) $this->id); |
| 559 | 589 | |
| 560 | 590 | dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
@@ -568,7 +598,9 @@ discard block |
||
| 568 | 598 | if (!$error && !$notrigger) { |
| 569 | 599 | // Call trigger |
| 570 | 600 | $result = $this->call_trigger('STOCKTRANSFER_VALIDATE', $user); |
| 571 | - if ($result < 0) $error++; |
|
| 601 | + if ($result < 0) { |
|
| 602 | + $error++; |
|
| 603 | + } |
|
| 572 | 604 | // End call triggers |
| 573 | 605 | } |
| 574 | 606 | } |
@@ -710,7 +742,10 @@ discard block |
||
| 710 | 742 | { |
| 711 | 743 | global $conf, $langs, $hookmanager; |
| 712 | 744 | |
| 713 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
| 745 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 746 | + $notooltip = 1; |
|
| 747 | + } |
|
| 748 | + // Force disable tooltips |
|
| 714 | 749 | |
| 715 | 750 | $result = ''; |
| 716 | 751 | |
@@ -742,7 +777,9 @@ discard block |
||
| 742 | 777 | } |
| 743 | 778 | $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
| 744 | 779 | $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
| 745 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 780 | + } else { |
|
| 781 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 782 | + } |
|
| 746 | 783 | |
| 747 | 784 | $linkstart = '<a href="'.$url.'"'; |
| 748 | 785 | $linkstart .= $linkclose.'>'; |
@@ -751,7 +788,9 @@ discard block |
||
| 751 | 788 | $result .= $linkstart; |
| 752 | 789 | |
| 753 | 790 | if (empty($this->showphoto_on_popup)) { |
| 754 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 791 | + if ($withpicto) { |
|
| 792 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 793 | + } |
|
| 755 | 794 | } else { |
| 756 | 795 | if ($withpicto) { |
| 757 | 796 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -777,7 +816,9 @@ discard block |
||
| 777 | 816 | } |
| 778 | 817 | } |
| 779 | 818 | |
| 780 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 819 | + if ($withpicto != 2) { |
|
| 820 | + $result .= $this->ref; |
|
| 821 | + } |
|
| 781 | 822 | |
| 782 | 823 | $result .= $linkend; |
| 783 | 824 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
@@ -786,8 +827,11 @@ discard block |
||
| 786 | 827 | $hookmanager->initHooks(array('stocktransferdao')); |
| 787 | 828 | $parameters = array('id'=>$this->id, 'getnomurl'=>$result); |
| 788 | 829 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 789 | - if ($reshook > 0) $result = $hookmanager->resPrint; |
|
| 790 | - else $result .= $hookmanager->resPrint; |
|
| 830 | + if ($reshook > 0) { |
|
| 831 | + $result = $hookmanager->resPrint; |
|
| 832 | + } else { |
|
| 833 | + $result .= $hookmanager->resPrint; |
|
| 834 | + } |
|
| 791 | 835 | |
| 792 | 836 | return $result; |
| 793 | 837 | } |
@@ -829,7 +873,9 @@ discard block |
||
| 829 | 873 | |
| 830 | 874 | $statusType = 'status'.$status; |
| 831 | 875 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
| 832 | - if ($status == self::STATUS_CLOSED) $statusType = 'status6'; |
|
| 876 | + if ($status == self::STATUS_CLOSED) { |
|
| 877 | + $statusType = 'status6'; |
|
| 878 | + } |
|
| 833 | 879 | |
| 834 | 880 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
| 835 | 881 | } |
@@ -128,8 +128,12 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $this->db = $db; |
| 130 | 130 | |
| 131 | - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; |
|
| 132 | - if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; |
|
| 131 | + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { |
|
| 132 | + $this->fields['rowid']['visible'] = 0; |
|
| 133 | + } |
|
| 134 | + if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { |
|
| 135 | + $this->fields['entity']['enabled'] = 0; |
|
| 136 | + } |
|
| 133 | 137 | |
| 134 | 138 | // Example to show how to set values of fields definition dynamically |
| 135 | 139 | /*if ($user->rights->stocktransfer->stocktransferline->read) { |
@@ -188,7 +192,9 @@ discard block |
||
| 188 | 192 | |
| 189 | 193 | // Load source object |
| 190 | 194 | $result = $object->fetchCommon($fromid); |
| 191 | - if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); |
|
| 195 | + if ($result > 0 && !empty($object->table_element_line)) { |
|
| 196 | + $object->fetchLines(); |
|
| 197 | + } |
|
| 192 | 198 | |
| 193 | 199 | // get lines so they will be clone |
| 194 | 200 | //foreach($this->lines as $line) |
@@ -235,8 +241,9 @@ discard block |
||
| 235 | 241 | if (!$error) { |
| 236 | 242 | // copy external contacts if same company |
| 237 | 243 | if (property_exists($this, 'socid') && $this->socid == $object->socid) { |
| 238 | - if ($this->copy_linked_contact($object, 'external') < 0) |
|
| 239 | - $error++; |
|
| 244 | + if ($this->copy_linked_contact($object, 'external') < 0) { |
|
| 245 | + $error++; |
|
| 246 | + } |
|
| 240 | 247 | } |
| 241 | 248 | } |
| 242 | 249 | |
@@ -262,7 +269,9 @@ discard block |
||
| 262 | 269 | public function fetch($id, $ref = null) |
| 263 | 270 | { |
| 264 | 271 | $result = $this->fetchCommon($id, $ref); |
| 265 | - if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); |
|
| 272 | + if ($result > 0 && !empty($this->table_element_line)) { |
|
| 273 | + $this->fetchLines(); |
|
| 274 | + } |
|
| 266 | 275 | return $result; |
| 267 | 276 | } |
| 268 | 277 | |
@@ -300,8 +309,11 @@ discard block |
||
| 300 | 309 | $sql = 'SELECT '; |
| 301 | 310 | $sql .= $this->getFieldList(); |
| 302 | 311 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
| 303 | - if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
| 304 | - else $sql .= ' WHERE 1 = 1'; |
|
| 312 | + if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
|
| 313 | + $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
| 314 | + } else { |
|
| 315 | + $sql .= ' WHERE 1 = 1'; |
|
| 316 | + } |
|
| 305 | 317 | // Manage filter |
| 306 | 318 | $sqlwhere = array(); |
| 307 | 319 | if (count($filter) > 0) { |
@@ -548,8 +560,12 @@ discard block |
||
| 548 | 560 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
| 549 | 561 | $sql .= " SET ref = '".$this->db->escape($num)."',"; |
| 550 | 562 | $sql .= " status = ".self::STATUS_VALIDATED; |
| 551 | - if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',"; |
|
| 552 | - if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id); |
|
| 563 | + if (!empty($this->fields['date_validation'])) { |
|
| 564 | + $sql .= ", date_validation = '".$this->db->idate($now)."',"; |
|
| 565 | + } |
|
| 566 | + if (!empty($this->fields['fk_user_valid'])) { |
|
| 567 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
| 568 | + } |
|
| 553 | 569 | $sql .= " WHERE rowid = ".((int) $this->id); |
| 554 | 570 | |
| 555 | 571 | dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
@@ -563,7 +579,9 @@ discard block |
||
| 563 | 579 | if (!$error && !$notrigger) { |
| 564 | 580 | // Call trigger |
| 565 | 581 | $result = $this->call_trigger('STOCKTRANSFERLINE_VALIDATE', $user); |
| 566 | - if ($result < 0) $error++; |
|
| 582 | + if ($result < 0) { |
|
| 583 | + $error++; |
|
| 584 | + } |
|
| 567 | 585 | // End call triggers |
| 568 | 586 | } |
| 569 | 587 | } |
@@ -705,7 +723,10 @@ discard block |
||
| 705 | 723 | { |
| 706 | 724 | global $conf, $langs, $hookmanager; |
| 707 | 725 | |
| 708 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
| 726 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
| 727 | + $notooltip = 1; |
|
| 728 | + } |
|
| 729 | + // Force disable tooltips |
|
| 709 | 730 | |
| 710 | 731 | $result = ''; |
| 711 | 732 | |
@@ -737,7 +758,9 @@ discard block |
||
| 737 | 758 | } |
| 738 | 759 | $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
| 739 | 760 | $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
| 740 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 761 | + } else { |
|
| 762 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 763 | + } |
|
| 741 | 764 | |
| 742 | 765 | $linkstart = '<a href="'.$url.'"'; |
| 743 | 766 | $linkstart .= $linkclose.'>'; |
@@ -746,7 +769,9 @@ discard block |
||
| 746 | 769 | $result .= $linkstart; |
| 747 | 770 | |
| 748 | 771 | if (empty($this->showphoto_on_popup)) { |
| 749 | - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 772 | + if ($withpicto) { |
|
| 773 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 774 | + } |
|
| 750 | 775 | } else { |
| 751 | 776 | if ($withpicto) { |
| 752 | 777 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -772,7 +797,9 @@ discard block |
||
| 772 | 797 | } |
| 773 | 798 | } |
| 774 | 799 | |
| 775 | - if ($withpicto != 2) $result .= $this->ref; |
|
| 800 | + if ($withpicto != 2) { |
|
| 801 | + $result .= $this->ref; |
|
| 802 | + } |
|
| 776 | 803 | |
| 777 | 804 | $result .= $linkend; |
| 778 | 805 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
@@ -781,8 +808,11 @@ discard block |
||
| 781 | 808 | $hookmanager->initHooks(array('stocktransferlinedao')); |
| 782 | 809 | $parameters = array('id'=>$this->id, 'getnomurl'=>$result); |
| 783 | 810 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 784 | - if ($reshook > 0) $result = $hookmanager->resPrint; |
|
| 785 | - else $result .= $hookmanager->resPrint; |
|
| 811 | + if ($reshook > 0) { |
|
| 812 | + $result = $hookmanager->resPrint; |
|
| 813 | + } else { |
|
| 814 | + $result .= $hookmanager->resPrint; |
|
| 815 | + } |
|
| 786 | 816 | |
| 787 | 817 | return $result; |
| 788 | 818 | } |
@@ -822,7 +852,9 @@ discard block |
||
| 822 | 852 | |
| 823 | 853 | $statusType = 'status'.$status; |
| 824 | 854 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
| 825 | - if ($status == self::STATUS_CANCELED) $statusType = 'status6'; |
|
| 855 | + if ($status == self::STATUS_CANCELED) { |
|
| 856 | + $statusType = 'status6'; |
|
| 857 | + } |
|
| 826 | 858 | |
| 827 | 859 | return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); |
| 828 | 860 | } |
@@ -105,7 +105,10 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // Get source company |
| 107 | 107 | $this->emetteur = $mysoc; |
| 108 | - if (!$this->emetteur->country_code) $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined |
|
| 108 | + if (!$this->emetteur->country_code) { |
|
| 109 | + $this->emetteur->country_code = substr($langs->defaultlang, -2); |
|
| 110 | + } |
|
| 111 | + // By default if not defined |
|
| 109 | 112 | |
| 110 | 113 | // Define position of columns |
| 111 | 114 | $this->posxdesc = $this->marge_gauche + 1; |
@@ -124,7 +127,9 @@ discard block |
||
| 124 | 127 | $this->posxtotalht = $this->page_largeur - $this->marge_droite - 20; |
| 125 | 128 | }*/ |
| 126 | 129 | |
| 127 | - if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) $this->posxweightvol = $this->posxqty; |
|
| 130 | + if (!empty($conf->global->STOCKTRANSFER_PDF_HIDE_WEIGHT_AND_VOLUME)) { |
|
| 131 | + $this->posxweightvol = $this->posxqty; |
|
| 132 | + } |
|
| 128 | 133 | |
| 129 | 134 | $this->posxpicture = $this->posxweightvol - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
| 130 | 135 | //var_dump($this->posxpicture, $this->posxweightvol);exit; |
@@ -165,9 +170,13 @@ discard block |
||
| 165 | 170 | |
| 166 | 171 | $this->atLeastOneBatch = $this->atLeastOneBatch($object); |
| 167 | 172 | |
| 168 | - if (!is_object($outputlangs)) $outputlangs = $langs; |
|
| 173 | + if (!is_object($outputlangs)) { |
|
| 174 | + $outputlangs = $langs; |
|
| 175 | + } |
|
| 169 | 176 | // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO |
| 170 | - if (!empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output = 'ISO-8859-1'; |
|
| 177 | + if (!empty($conf->global->MAIN_USE_FPDF)) { |
|
| 178 | + $outputlangs->charset_output = 'ISO-8859-1'; |
|
| 179 | + } |
|
| 171 | 180 | |
| 172 | 181 | // Load traductions files required by page |
| 173 | 182 | $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies", "propal", "deliveries", "sendings", "productbatch", "stocks", "stocktransfer@stocktransfer")); |
@@ -180,7 +189,9 @@ discard block |
||
| 180 | 189 | $objphoto = new Product($this->db); |
| 181 | 190 | |
| 182 | 191 | for ($i = 0; $i < $nblines; $i++) { |
| 183 | - if (empty($object->lines[$i]->fk_product)) continue; |
|
| 192 | + if (empty($object->lines[$i]->fk_product)) { |
|
| 193 | + continue; |
|
| 194 | + } |
|
| 184 | 195 | |
| 185 | 196 | $objphoto = new Product($this->db); |
| 186 | 197 | $objphoto->fetch($object->lines[$i]->fk_product); |
@@ -210,16 +221,23 @@ discard block |
||
| 210 | 221 | break; |
| 211 | 222 | } |
| 212 | 223 | |
| 213 | - if ($realpath) $realpatharray[$i] = $realpath; |
|
| 224 | + if ($realpath) { |
|
| 225 | + $realpatharray[$i] = $realpath; |
|
| 226 | + } |
|
| 214 | 227 | } |
| 215 | 228 | } |
| 216 | 229 | |
| 217 | - if (count($realpatharray) == 0) $this->posxpicture = $this->posxweightvol; |
|
| 230 | + if (count($realpatharray) == 0) { |
|
| 231 | + $this->posxpicture = $this->posxweightvol; |
|
| 232 | + } |
|
| 218 | 233 | |
| 219 | 234 | |
| 220 | 235 | if (!empty($this->atLeastOneBatch)) { |
| 221 | 236 | $this->posxpicture = $this->posxlot; |
| 222 | - if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) $this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images |
|
| 237 | + if (!empty($conf->global->MAIN_GENERATE_STOCKTRANSFER_WITH_PICTURE)) { |
|
| 238 | + $this->posxpicture -= (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); |
|
| 239 | + } |
|
| 240 | + // width of images |
|
| 223 | 241 | } |
| 224 | 242 | |
| 225 | 243 | if ($conf->stocktransfer->dir_output) { |
@@ -259,7 +277,9 @@ discard block |
||
| 259 | 277 | $heightforinfotot = 8; // Height reserved to output the info and total part |
| 260 | 278 | $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page |
| 261 | 279 | $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) |
| 262 | - if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; |
|
| 280 | + if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) { |
|
| 281 | + $heightforfooter += 6; |
|
| 282 | + } |
|
| 263 | 283 | $pdf->SetAutoPageBreak(1, 0); |
| 264 | 284 | |
| 265 | 285 | if (class_exists('TCPDF')) { |
@@ -277,7 +297,9 @@ discard block |
||
| 277 | 297 | $pagenb = 0; |
| 278 | 298 | $pdf->SetDrawColor(128, 128, 128); |
| 279 | 299 | |
| 280 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 300 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
| 301 | + $pdf->AliasNbPages(); |
|
| 302 | + } |
|
| 281 | 303 | |
| 282 | 304 | $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); |
| 283 | 305 | $pdf->SetSubject($outputlangs->transnoentities("Shipment")); |
@@ -292,7 +314,9 @@ discard block |
||
| 292 | 314 | |
| 293 | 315 | // New page |
| 294 | 316 | $pdf->AddPage(); |
| 295 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 317 | + if (!empty($tplidx)) { |
|
| 318 | + $pdf->useTemplate($tplidx); |
|
| 319 | + } |
|
| 296 | 320 | $pagenb++; |
| 297 | 321 | $this->_pagehead($pdf, $object, 1, $outputlangs); |
| 298 | 322 | $pdf->SetFont('', '', $default_font_size - 1); |
@@ -344,7 +368,9 @@ discard block |
||
| 344 | 368 | // Get code using getLabelFromKey |
| 345 | 369 | $code = $outputlangs->getLabelFromKey($this->db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); |
| 346 | 370 | $label = ''; |
| 347 | - if ($object->tracking_url != $object->tracking_number) $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; |
|
| 371 | + if ($object->tracking_url != $object->tracking_number) { |
|
| 372 | + $label .= $outputlangs->trans("LinkToTrackYourPackage")."<br>"; |
|
| 373 | + } |
|
| 348 | 374 | $label .= $outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); |
| 349 | 375 | //var_dump($object->tracking_url != $object->tracking_number);exit; |
| 350 | 376 | if ($object->tracking_url != $object->tracking_number) { |
@@ -391,7 +417,9 @@ discard block |
||
| 391 | 417 | |
| 392 | 418 | // Define size of image if we need it |
| 393 | 419 | $imglinesize = array(); |
| 394 | - if (!empty($realpatharray[$i])) $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
| 420 | + if (!empty($realpatharray[$i])) { |
|
| 421 | + $imglinesize = pdf_getSizeForImage($realpatharray[$i]); |
|
| 422 | + } |
|
| 395 | 423 | |
| 396 | 424 | $pdf->setTopMargin($tab_top_newpage); |
| 397 | 425 | $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. |
@@ -404,16 +432,22 @@ discard block |
||
| 404 | 432 | // We start with Photo of product line |
| 405 | 433 | if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // If photo too high, we moved completely on new page |
| 406 | 434 | $pdf->AddPage('', '', true); |
| 407 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 408 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 435 | + if (!empty($tplidx)) { |
|
| 436 | + $pdf->useTemplate($tplidx); |
|
| 437 | + } |
|
| 438 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
| 439 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 440 | + } |
|
| 409 | 441 | $pdf->setPage($pageposbefore + 1); |
| 410 | 442 | |
| 411 | 443 | $curY = $tab_top_newpage; |
| 412 | 444 | |
| 413 | 445 | // Allows data in the first page if description is long enough to break in multiples pages |
| 414 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
| 415 | - $showpricebeforepagebreak = 1; |
|
| 416 | - else $showpricebeforepagebreak = 0; |
|
| 446 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
| 447 | + $showpricebeforepagebreak = 1; |
|
| 448 | + } else { |
|
| 449 | + $showpricebeforepagebreak = 0; |
|
| 450 | + } |
|
| 417 | 451 | } |
| 418 | 452 | |
| 419 | 453 | if (isset($imglinesize['width']) && isset($imglinesize['height'])) { |
@@ -460,17 +494,23 @@ discard block |
||
| 460 | 494 | if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text |
| 461 | 495 | if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page |
| 462 | 496 | $pdf->AddPage('', '', true); |
| 463 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 464 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 497 | + if (!empty($tplidx)) { |
|
| 498 | + $pdf->useTemplate($tplidx); |
|
| 499 | + } |
|
| 500 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
| 501 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 502 | + } |
|
| 465 | 503 | $pdf->setPage($pageposafter + 1); |
| 466 | 504 | } |
| 467 | 505 | } else { |
| 468 | 506 | // We found a page break |
| 469 | 507 | |
| 470 | 508 | // Allows data in the first page if description is long enough to break in multiples pages |
| 471 | - if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) |
|
| 472 | - $showpricebeforepagebreak = 1; |
|
| 473 | - else $showpricebeforepagebreak = 0; |
|
| 509 | + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) { |
|
| 510 | + $showpricebeforepagebreak = 1; |
|
| 511 | + } else { |
|
| 512 | + $showpricebeforepagebreak = 0; |
|
| 513 | + } |
|
| 474 | 514 | } |
| 475 | 515 | } else // No pagebreak |
| 476 | 516 | { |
@@ -527,8 +567,9 @@ discard block |
||
| 527 | 567 | |
| 528 | 568 | // Warehouse source |
| 529 | 569 | $wh_source = new Entrepot($db); |
| 530 | - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; |
|
| 531 | - else { |
|
| 570 | + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_source])) { |
|
| 571 | + $wh_source = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source]; |
|
| 572 | + } else { |
|
| 532 | 573 | $wh_source->fetch($object->lines[$i]->fk_warehouse_source); |
| 533 | 574 | $TCacheEntrepots[$object->lines[$i]->fk_warehouse_source] = $wh_source; |
| 534 | 575 | } |
@@ -537,8 +578,9 @@ discard block |
||
| 537 | 578 | |
| 538 | 579 | // Warehouse destination |
| 539 | 580 | $wh_destination = new Entrepot($db); |
| 540 | - if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; |
|
| 541 | - else { |
|
| 581 | + if (!empty($TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination])) { |
|
| 582 | + $wh_destination = $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination]; |
|
| 583 | + } else { |
|
| 542 | 584 | $wh_destination->fetch($object->lines[$i]->fk_warehouse_destination); |
| 543 | 585 | $TCacheEntrepots[$object->lines[$i]->fk_warehouse_destination] = $wh_destination; |
| 544 | 586 | } |
@@ -554,7 +596,9 @@ discard block |
||
| 554 | 596 | } |
| 555 | 597 | |
| 556 | 598 | $nexY += 3; |
| 557 | - if ($weighttxt && $voltxt) $nexY += 2; |
|
| 599 | + if ($weighttxt && $voltxt) { |
|
| 600 | + $nexY += 2; |
|
| 601 | + } |
|
| 558 | 602 | |
| 559 | 603 | // Add line |
| 560 | 604 | if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1)) { |
@@ -577,7 +621,9 @@ discard block |
||
| 577 | 621 | $pagenb++; |
| 578 | 622 | $pdf->setPage($pagenb); |
| 579 | 623 | $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. |
| 580 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 624 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
| 625 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 626 | + } |
|
| 581 | 627 | } |
| 582 | 628 | if (isset($object->lines[$i + 1]->pagebreak) && $object->lines[$i + 1]->pagebreak) { |
| 583 | 629 | if ($pagenb == 1) { |
@@ -588,9 +634,13 @@ discard block |
||
| 588 | 634 | $this->_pagefoot($pdf, $object, $outputlangs, 1); |
| 589 | 635 | // New page |
| 590 | 636 | $pdf->AddPage(); |
| 591 | - if (!empty($tplidx)) $pdf->useTemplate($tplidx); |
|
| 637 | + if (!empty($tplidx)) { |
|
| 638 | + $pdf->useTemplate($tplidx); |
|
| 639 | + } |
|
| 592 | 640 | $pagenb++; |
| 593 | - if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 641 | + if (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD')) { |
|
| 642 | + $this->_pagehead($pdf, $object, 0, $outputlangs); |
|
| 643 | + } |
|
| 594 | 644 | } |
| 595 | 645 | } |
| 596 | 646 | |
@@ -608,7 +658,9 @@ discard block |
||
| 608 | 658 | |
| 609 | 659 | // Pied de page |
| 610 | 660 | $this->_pagefoot($pdf, $object, $outputlangs); |
| 611 | - if (method_exists($pdf, 'AliasNbPages')) $pdf->AliasNbPages(); |
|
| 661 | + if (method_exists($pdf, 'AliasNbPages')) { |
|
| 662 | + $pdf->AliasNbPages(); |
|
| 663 | + } |
|
| 612 | 664 | |
| 613 | 665 | $pdf->Close(); |
| 614 | 666 | |
@@ -670,8 +722,11 @@ discard block |
||
| 670 | 722 | { |
| 671 | 723 | $col2x-=20; |
| 672 | 724 | }*/ |
| 673 | - if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) $largcol2 = ($this->posxwarehousesource - $this->posxqty); |
|
| 674 | - else $largcol2 = ($this->posxwarehousedestination - $this->posxqty); |
|
| 725 | + if (empty($conf->global->STOCKTRANSFER_PDF_HIDE_ORDERED)) { |
|
| 726 | + $largcol2 = ($this->posxwarehousesource - $this->posxqty); |
|
| 727 | + } else { |
|
| 728 | + $largcol2 = ($this->posxwarehousedestination - $this->posxqty); |
|
| 729 | + } |
|
| 675 | 730 | |
| 676 | 731 | $useborder = 0; |
| 677 | 732 | $index = 0; |
@@ -684,20 +739,29 @@ discard block |
||
| 684 | 739 | $totalWeight = $tmparray['weight']; |
| 685 | 740 | $totalVolume = $tmparray['volume']; |
| 686 | 741 | $totalQty = 0; |
| 687 | - if (!empty($object->lines)) |
|
| 688 | - foreach ($object->lines as $line) { |
|
| 742 | + if (!empty($object->lines)) { |
|
| 743 | + foreach ($object->lines as $line) { |
|
| 689 | 744 | $totalQty+=$line->qty; |
| 690 | 745 | } |
| 746 | + } |
|
| 691 | 747 | // Set trueVolume and volume_units not currently stored into database |
| 692 | 748 | if ($object->trueWidth && $object->trueHeight && $object->trueDepth) { |
| 693 | 749 | $object->trueVolume = price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); |
| 694 | 750 | $object->volume_units = $object->size_units * 3; |
| 695 | 751 | } |
| 696 | 752 | |
| 697 | - if ($totalWeight != '') $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); |
|
| 698 | - if ($totalVolume != '') $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); |
|
| 699 | - if ($object->trueWeight) $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); |
|
| 700 | - if ($object->trueVolume) $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); |
|
| 753 | + if ($totalWeight != '') { |
|
| 754 | + $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); |
|
| 755 | + } |
|
| 756 | + if ($totalVolume != '') { |
|
| 757 | + $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); |
|
| 758 | + } |
|
| 759 | + if ($object->trueWeight) { |
|
| 760 | + $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); |
|
| 761 | + } |
|
| 762 | + if ($object->trueVolume) { |
|
| 763 | + $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); |
|
| 764 | + } |
|
| 701 | 765 | |
| 702 | 766 | $pdf->SetFillColor(255, 255, 255); |
| 703 | 767 | $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); |
@@ -730,7 +794,9 @@ discard block |
||
| 730 | 794 | |
| 731 | 795 | $index++; |
| 732 | 796 | } |
| 733 | - if (!$totalWeighttoshow && !$totalVolumetoshow) $index++; |
|
| 797 | + if (!$totalWeighttoshow && !$totalVolumetoshow) { |
|
| 798 | + $index++; |
|
| 799 | + } |
|
| 734 | 800 | } |
| 735 | 801 | |
| 736 | 802 | $pdf->SetTextColor(0, 0, 0); |
@@ -758,7 +824,9 @@ discard block |
||
| 758 | 824 | |
| 759 | 825 | // Force to disable hidetop and hidebottom |
| 760 | 826 | $hidebottom = 0; |
| 761 | - if ($hidetop) $hidetop = -1; |
|
| 827 | + if ($hidetop) { |
|
| 828 | + $hidetop = -1; |
|
| 829 | + } |
|
| 762 | 830 | |
| 763 | 831 | $default_font_size = pdf_getPDFFontSize($outputlangs); |
| 764 | 832 | |
@@ -1002,7 +1070,9 @@ discard block |
||
| 1002 | 1070 | |
| 1003 | 1071 | $pdf->SetFont('', '', $default_font_size - 2); |
| 1004 | 1072 | $text = $linkedobject->ref; |
| 1005 | - if ($linkedobject->ref_client) $text .= ' ('.$linkedobject->ref_client.')'; |
|
| 1073 | + if ($linkedobject->ref_client) { |
|
| 1074 | + $text .= ' ('.$linkedobject->ref_client.')'; |
|
| 1075 | + } |
|
| 1006 | 1076 | $Yoff = $Yoff + 8; |
| 1007 | 1077 | $pdf->SetXY($this->page_largeur - $this->marge_droite - $w, $Yoff); |
| 1008 | 1078 | $pdf->MultiCell($w, 2, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), 0, 'R'); |
@@ -1027,18 +1097,28 @@ discard block |
||
| 1027 | 1097 | $result = $object->fetch_contact($arrayidcontact[0]); |
| 1028 | 1098 | } |
| 1029 | 1099 | |
| 1030 | - if ($usecontact) $thirdparty = $object->contact; |
|
| 1031 | - else $thirdparty = $this->emetteur; |
|
| 1100 | + if ($usecontact) { |
|
| 1101 | + $thirdparty = $object->contact; |
|
| 1102 | + } else { |
|
| 1103 | + $thirdparty = $this->emetteur; |
|
| 1104 | + } |
|
| 1032 | 1105 | |
| 1033 | - if (!empty($thirdparty)) $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
| 1106 | + if (!empty($thirdparty)) { |
|
| 1107 | + $carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
| 1108 | + } |
|
| 1034 | 1109 | |
| 1035 | - if ($usecontact) $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); |
|
| 1036 | - else $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
| 1110 | + if ($usecontact) { |
|
| 1111 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, $object->contact, 1, 'targetwithdetails', $object); |
|
| 1112 | + } else { |
|
| 1113 | + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'source', $object); |
|
| 1114 | + } |
|
| 1037 | 1115 | |
| 1038 | 1116 | // Show sender |
| 1039 | 1117 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
| 1040 | 1118 | $posx = $this->marge_gauche; |
| 1041 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->page_largeur - $this->marge_droite - 80; |
|
| 1119 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
| 1120 | + $posx = $this->page_largeur - $this->marge_droite - 80; |
|
| 1121 | + } |
|
| 1042 | 1122 | |
| 1043 | 1123 | $hautcadre = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 38 : 40; |
| 1044 | 1124 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 82; |
@@ -1082,16 +1162,23 @@ discard block |
||
| 1082 | 1162 | $thirdparty = $object->thirdparty; |
| 1083 | 1163 | } |
| 1084 | 1164 | |
| 1085 | - if (!empty($thirdparty)) $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
| 1165 | + if (!empty($thirdparty)) { |
|
| 1166 | + $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs); |
|
| 1167 | + } |
|
| 1086 | 1168 | |
| 1087 | 1169 | $carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (!empty($object->contact) ? $object->contact : null), $usecontact, 'targetwithdetails', $object); |
| 1088 | 1170 | |
| 1089 | 1171 | // Show recipient |
| 1090 | 1172 | $widthrecbox = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 92 : 100; |
| 1091 | - if ($this->page_largeur < 210) $widthrecbox = 84; // To work with US executive format |
|
| 1173 | + if ($this->page_largeur < 210) { |
|
| 1174 | + $widthrecbox = 84; |
|
| 1175 | + } |
|
| 1176 | + // To work with US executive format |
|
| 1092 | 1177 | $posy = !empty($conf->global->MAIN_PDF_USE_ISO_LOCATION) ? 40 : 42; |
| 1093 | 1178 | $posx = $this->page_largeur - $this->marge_droite - $widthrecbox; |
| 1094 | - if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx = $this->marge_gauche; |
|
| 1179 | + if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) { |
|
| 1180 | + $posx = $this->marge_gauche; |
|
| 1181 | + } |
|
| 1095 | 1182 | |
| 1096 | 1183 | // Show recipient frame |
| 1097 | 1184 | $pdf->SetTextColor(0, 0, 0); |
@@ -791,7 +791,9 @@ discard block |
||
| 791 | 791 | if ($action == 'confirm_generateinter') { |
| 792 | 792 | $langs->load('interventions'); |
| 793 | 793 | |
| 794 | - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); |
|
| 794 | + if (!empty($projectstatic->socid)) { |
|
| 795 | + $projectstatic->fetch_thirdparty(); |
|
| 796 | + } |
|
| 795 | 797 | |
| 796 | 798 | if (!($projectstatic->thirdparty->id > 0)) { |
| 797 | 799 | setEventMessages($langs->trans("ThirdPartyRequiredToGenerateIntervention"), null, 'errors'); |
@@ -1586,7 +1588,9 @@ discard block |
||
| 1586 | 1588 | if (empty($search_user)) { |
| 1587 | 1589 | $search_user = $user->id; |
| 1588 | 1590 | } |
| 1589 | - if ($search_user > 0) $sql .= " AND t.fk_user = " . ((int) $search_user); |
|
| 1591 | + if ($search_user > 0) { |
|
| 1592 | + $sql .= " AND t.fk_user = " . ((int) $search_user); |
|
| 1593 | + } |
|
| 1590 | 1594 | } |
| 1591 | 1595 | |
| 1592 | 1596 | if ($search_note) { |