@@ -90,7 +90,9 @@ discard block |
||
90 | 90 | $this->accountancy_codes[$mode_key] = array(); |
91 | 91 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
92 | 92 | $accountancy_code = GETPOST($mode_key . '_' . $field_key, 'aZ09'); |
93 | - if (empty($accountancy_code) || $accountancy_code == '-1') $accountancy_code = ''; |
|
93 | + if (empty($accountancy_code) || $accountancy_code == '-1') { |
|
94 | + $accountancy_code = ''; |
|
95 | + } |
|
94 | 96 | $this->accountancy_codes[$mode_key][$field_key] = $accountancy_code; |
95 | 97 | } |
96 | 98 | } |
@@ -251,7 +253,9 @@ discard block |
||
251 | 253 | require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
252 | 254 | $asset = new Asset($this->db); |
253 | 255 | $result = $asset->fetch($asset_id); |
254 | - if ($result > 0) $result = $asset->calculationDepreciation(); |
|
256 | + if ($result > 0) { |
|
257 | + $result = $asset->calculationDepreciation(); |
|
258 | + } |
|
255 | 259 | if ($result < 0) { |
256 | 260 | $this->errors[] = $langs->trans('AssetErrorCalculationDepreciationLines'); |
257 | 261 | $this->errors[] = $asset->errorsToString(); |
@@ -352,7 +352,9 @@ discard block |
||
352 | 352 | $error++; |
353 | 353 | } elseif ($result > 0) { |
354 | 354 | foreach ($this->fields as $field_key => $field_info) { |
355 | - if (in_array($field_key, array('rowid', 'fk_asset', 'fk_asset_model', 'tms', 'fk_user_modif'))) continue; |
|
355 | + if (in_array($field_key, array('rowid', 'fk_asset', 'fk_asset_model', 'tms', 'fk_user_modif'))) { |
|
356 | + continue; |
|
357 | + } |
|
356 | 358 | $deprecation_options[$mode_key][$field_key] = $this->{$field_key}; |
357 | 359 | } |
358 | 360 | } |
@@ -504,7 +506,9 @@ discard block |
||
504 | 506 | require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
505 | 507 | $asset = new Asset($this->db); |
506 | 508 | $result = $asset->fetch($this->fk_asset); |
507 | - if ($result > 0) $result = $asset->calculationDepreciation(); |
|
509 | + if ($result > 0) { |
|
510 | + $result = $asset->calculationDepreciation(); |
|
511 | + } |
|
508 | 512 | if ($result < 0) { |
509 | 513 | $this->errors[] = $langs->trans('AssetErrorCalculationDepreciationLines'); |
510 | 514 | $this->errors[] = $asset->errorsToString(); |
@@ -196,7 +196,9 @@ discard block |
||
196 | 196 | // Unset all old modules values |
197 | 197 | if (!empty($this->modules)) { |
198 | 198 | foreach ($this->modules as $m) { |
199 | - if (isset($this->$m)) unset($this->$m); |
|
199 | + if (isset($this->$m)) { |
|
200 | + unset($this->$m); |
|
201 | + } |
|
200 | 202 | } |
201 | 203 | } |
202 | 204 | |
@@ -616,15 +618,23 @@ discard block |
||
616 | 618 | if (!empty($this->productbatch->enabled)) { |
617 | 619 | $this->global->STOCK_CALCULATE_ON_BILL = 0; |
618 | 620 | $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0; |
619 | - if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; |
|
620 | - if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1; |
|
621 | + if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { |
|
622 | + $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1; |
|
623 | + } |
|
624 | + if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) { |
|
625 | + $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1; |
|
626 | + } |
|
621 | 627 | $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0; |
622 | 628 | $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0; |
623 | 629 | if (empty($this->reception->enabled)) { |
624 | 630 | $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1; |
625 | 631 | } else { |
626 | - if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; |
|
627 | - if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1; |
|
632 | + if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { |
|
633 | + $this->global->STOCK_CALCULATE_ON_RECEPTION = 1; |
|
634 | + } |
|
635 | + if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) { |
|
636 | + $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1; |
|
637 | + } |
|
628 | 638 | } |
629 | 639 | } |
630 | 640 |
@@ -397,9 +397,15 @@ |
||
397 | 397 | ) { |
398 | 398 | $accountancy_category_asset = $conf->global->ASSET_ACCOUNTANCY_CATEGORY; |
399 | 399 | $filters = array(); |
400 | - if (!empty($product_static->accountancy_code_buy)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'"; |
|
401 | - if (!empty($product_static->accountancy_code_buy_intra)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'"; |
|
402 | - if (!empty($product_static->accountancy_code_buy_export)) $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'"; |
|
400 | + if (!empty($product_static->accountancy_code_buy)) { |
|
401 | + $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy) . "'"; |
|
402 | + } |
|
403 | + if (!empty($product_static->accountancy_code_buy_intra)) { |
|
404 | + $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_intra) . "'"; |
|
405 | + } |
|
406 | + if (!empty($product_static->accountancy_code_buy_export)) { |
|
407 | + $filters[] = "account_number = '" . $this->db->escape($product_static->accountancy_code_buy_export) . "'"; |
|
408 | + } |
|
403 | 409 | $sql = "SELECT COUNT(*) AS found"; |
404 | 410 | $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account"; |
405 | 411 | $sql .= " WHERE pcg_type = '" . $this->db->escape($conf->global->ASSET_ACCOUNTANCY_CATEGORY) . "'"; |
@@ -349,8 +349,9 @@ discard block |
||
349 | 349 | |
350 | 350 | $rang = $i; |
351 | 351 | //there may already be rows from previous receptions |
352 | - if (!empty($createbills_onebythird)) |
|
353 | - $rang = $TFactThirdNbLines[$rcp->socid]; |
|
352 | + if (!empty($createbills_onebythird)) { |
|
353 | + $rang = $TFactThirdNbLines[$rcp->socid]; |
|
354 | + } |
|
354 | 355 | |
355 | 356 | $result = $objecttmp->addline( |
356 | 357 | $desc, |
@@ -380,8 +381,10 @@ discard block |
||
380 | 381 | |
381 | 382 | if ($result > 0) { |
382 | 383 | $lineid = $result; |
383 | - if (!empty($createbills_onebythird)) //increment rang to keep order |
|
384 | + if (!empty($createbills_onebythird)) { |
|
385 | + //increment rang to keep order |
|
384 | 386 | $TFactThirdNbLines[$rcp->socid]++; |
387 | + } |
|
385 | 388 | } else { |
386 | 389 | $lineid = 0; |
387 | 390 | $error++; |
@@ -479,7 +479,9 @@ |
||
479 | 479 | $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ; |
480 | 480 | $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
481 | 481 | $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
482 | - if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
482 | + if ($this->fk_soc > 0) { |
|
483 | + $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
484 | + } |
|
483 | 485 | $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
484 | 486 | $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
485 | 487 | $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
@@ -1204,8 +1204,11 @@ discard block |
||
1204 | 1204 | $this->fk_facture_source = trim($this->fk_facture_source); |
1205 | 1205 | } |
1206 | 1206 | if (isset($this->fk_project)) { |
1207 | - if (empty($this->fk_project)) $this->fk_project = null; |
|
1208 | - else $this->fk_project = intval($this->fk_project); |
|
1207 | + if (empty($this->fk_project)) { |
|
1208 | + $this->fk_project = null; |
|
1209 | + } else { |
|
1210 | + $this->fk_project = intval($this->fk_project); |
|
1211 | + } |
|
1209 | 1212 | } |
1210 | 1213 | if (isset($this->cond_reglement_id)) { |
1211 | 1214 | $this->cond_reglement_id = trim($this->cond_reglement_id); |
@@ -3654,8 +3657,11 @@ discard block |
||
3654 | 3657 | $sql .= ", pu_ttc = ".price2num($this->pu_ttc); |
3655 | 3658 | $sql .= ", qty = ".price2num($this->qty); |
3656 | 3659 | $sql .= ", remise_percent = ".price2num($this->remise_percent); |
3657 | - if ($this->fk_remise_except > 0) $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
3658 | - else $sql .= ", fk_remise_except=null"; |
|
3660 | + if ($this->fk_remise_except > 0) { |
|
3661 | + $sql .= ", fk_remise_except=".((int) $this->fk_remise_except); |
|
3662 | + } else { |
|
3663 | + $sql .= ", fk_remise_except=null"; |
|
3664 | + } |
|
3659 | 3665 | $sql .= ", vat_src_code = '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'"; |
3660 | 3666 | $sql .= ", tva_tx = ".price2num($this->tva_tx); |
3661 | 3667 | $sql .= ", localtax1_tx = ".price2num($this->localtax1_tx); |
@@ -447,13 +447,17 @@ |
||
447 | 447 | $object->setContract($linked_contract->id); |
448 | 448 | // don't set '$contractid' so it is not used when creating an intervention. |
449 | 449 | } |
450 | - if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings'); |
|
450 | + if (empty(NOLOGIN)) { |
|
451 | + setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings'); |
|
452 | + } |
|
451 | 453 | break; |
452 | 454 | } |
453 | 455 | } |
454 | 456 | } |
455 | 457 | if ($number_contracts_found == 0) { |
456 | - if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs'); |
|
458 | + if (empty(NOLOGIN)) { |
|
459 | + setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs'); |
|
460 | + } |
|
457 | 461 | } |
458 | 462 | } |
459 | 463 | // Automatically create intervention |
@@ -144,7 +144,9 @@ |
||
144 | 144 | //$socid = $user->socid; |
145 | 145 | accessforbidden(); |
146 | 146 | } |
147 | -if (!$permissiontoread) accessforbidden(); |
|
147 | +if (!$permissiontoread) { |
|
148 | + accessforbidden(); |
|
149 | +} |
|
148 | 150 | |
149 | 151 | |
150 | 152 | /* |