@@ -86,12 +86,20 @@ |
||
| 86 | 86 | $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'model_advance', 'write'))); // Used by the include of actions_addupdatedelete.inc.php |
| 87 | 87 | |
| 88 | 88 | // Security check (enable the most restrictive one) |
| 89 | -if ($user->socid > 0) accessforbidden(); |
|
| 90 | -if ($user->socid > 0) $socid = $user->socid; |
|
| 89 | +if ($user->socid > 0) { |
|
| 90 | + accessforbidden(); |
|
| 91 | +} |
|
| 92 | +if ($user->socid > 0) { |
|
| 93 | + $socid = $user->socid; |
|
| 94 | +} |
|
| 91 | 95 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 92 | 96 | restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 93 | -if (!isModEnabled('asset')) accessforbidden(); |
|
| 94 | -if (!$permissiontoread) accessforbidden(); |
|
| 97 | +if (!isModEnabled('asset')) { |
|
| 98 | + accessforbidden(); |
|
| 99 | +} |
|
| 100 | +if (!$permissiontoread) { |
|
| 101 | + accessforbidden(); |
|
| 102 | +} |
|
| 95 | 103 | |
| 96 | 104 | |
| 97 | 105 | /* |
@@ -56,10 +56,14 @@ |
||
| 56 | 56 | $permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php |
| 57 | 57 | |
| 58 | 58 | // Security check (enable the most restrictive one) |
| 59 | -if ($user->socid > 0) accessforbidden(); |
|
| 59 | +if ($user->socid > 0) { |
|
| 60 | + accessforbidden(); |
|
| 61 | +} |
|
| 60 | 62 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 61 | 63 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 62 | -if (!isModEnabled('asset')) accessforbidden(); |
|
| 64 | +if (!isModEnabled('asset')) { |
|
| 65 | + accessforbidden(); |
|
| 66 | +} |
|
| 63 | 67 | |
| 64 | 68 | $result = $assetaccountancycodes->fetchAccountancyCodes($object->id); |
| 65 | 69 | if ($result < 0) { |
@@ -56,11 +56,17 @@ discard block |
||
| 56 | 56 | $permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php |
| 57 | 57 | |
| 58 | 58 | // Security check (enable the most restrictive one) |
| 59 | -if ($user->socid > 0) accessforbidden(); |
|
| 59 | +if ($user->socid > 0) { |
|
| 60 | + accessforbidden(); |
|
| 61 | +} |
|
| 60 | 62 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 61 | 63 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 62 | -if (!isModEnabled('asset')) accessforbidden(); |
|
| 63 | -if (!empty($object->not_depreciated)) accessforbidden(); |
|
| 64 | +if (!isModEnabled('asset')) { |
|
| 65 | + accessforbidden(); |
|
| 66 | +} |
|
| 67 | +if (!empty($object->not_depreciated)) { |
|
| 68 | + accessforbidden(); |
|
| 69 | +} |
|
| 64 | 70 | |
| 65 | 71 | $object->asset_depreciation_options = &$assetdepreciationoptions; |
| 66 | 72 | $result = $assetdepreciationoptions->fetchDeprecationOptions($object->id); |
@@ -105,7 +111,9 @@ discard block |
||
| 105 | 111 | |
| 106 | 112 | if ($action == "update") { |
| 107 | 113 | $result = $assetdepreciationoptions->setDeprecationOptionsFromPost(); |
| 108 | - if ($result > 0) $result = $assetdepreciationoptions->updateDeprecationOptions($user, $object->id); |
|
| 114 | + if ($result > 0) { |
|
| 115 | + $result = $assetdepreciationoptions->updateDeprecationOptions($user, $object->id); |
|
| 116 | + } |
|
| 109 | 117 | if ($result < 0) { |
| 110 | 118 | setEventMessages($assetdepreciationoptions->error, $assetdepreciationoptions->errors, 'errors'); |
| 111 | 119 | $action = 'edit'; |
@@ -55,11 +55,17 @@ |
||
| 55 | 55 | $permissiontoadd = $user->hasRight('asset', 'write'); // Used by the include of actions_addupdatedelete.inc.php |
| 56 | 56 | |
| 57 | 57 | // Security check (enable the most restrictive one) |
| 58 | -if ($user->socid > 0) accessforbidden(); |
|
| 58 | +if ($user->socid > 0) { |
|
| 59 | + accessforbidden(); |
|
| 60 | +} |
|
| 59 | 61 | $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 60 | 62 | restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 61 | -if (!isModEnabled('asset')) accessforbidden(); |
|
| 62 | -if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbidden(); |
|
| 63 | +if (!isModEnabled('asset')) { |
|
| 64 | + accessforbidden(); |
|
| 65 | +} |
|
| 66 | +if (!isset($object->disposal_date) || $object->disposal_date === "") { |
|
| 67 | + accessforbidden(); |
|
| 68 | +} |
|
| 63 | 69 | |
| 64 | 70 | |
| 65 | 71 | /* |
@@ -1294,7 +1294,9 @@ |
||
| 1294 | 1294 | $i = 0; |
| 1295 | 1295 | foreach ($tickets as $ticket) { |
| 1296 | 1296 | $i++; |
| 1297 | - if ($i > $limit) break; |
|
| 1297 | + if ($i > $limit) { |
|
| 1298 | + break; |
|
| 1299 | + } |
|
| 1298 | 1300 | |
| 1299 | 1301 | print "\t".'<tr class="oddeven">'."\n"; |
| 1300 | 1302 | print '<td class="nowrap tdtop">'; |
@@ -76,8 +76,12 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $data_type = 'view'; |
| 79 | -if ($action == 'writebookkeeping') $data_type = 'bookkeeping'; |
|
| 80 | -if ($action == 'exportcsv') $data_type = 'csv'; |
|
| 79 | +if ($action == 'writebookkeeping') { |
|
| 80 | + $data_type = 'bookkeeping'; |
|
| 81 | +} |
|
| 82 | +if ($action == 'exportcsv') { |
|
| 83 | + $data_type = 'csv'; |
|
| 84 | +} |
|
| 81 | 85 | $journal_data = $object->getData($user, $data_type, $date_start, $date_end, $in_bookkeeping); |
| 82 | 86 | if (!is_array($journal_data)) { |
| 83 | 87 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -228,8 +232,10 @@ discard block |
||
| 228 | 232 | print '<br>' . img_warning() . ' ' . $langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); |
| 229 | 233 | print ' : ' . $langs->trans("AccountancyAreaDescBank", 9, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("BankAccounts") . '</strong>'); |
| 230 | 234 | } |
| 231 | - } else dol_print_error($db); |
|
| 232 | -} |
|
| 235 | + } else { |
|
| 236 | + dol_print_error($db); |
|
| 237 | + } |
|
| 238 | + } |
|
| 233 | 239 | |
| 234 | 240 | // Button to write into Ledger |
| 235 | 241 | if ($some_mandatory_steps_of_setup_were_not_done) { |
@@ -269,8 +275,12 @@ discard block |
||
| 269 | 275 | </script>'; |
| 270 | 276 | |
| 271 | 277 | $object_label = $langs->trans("ObjectsRef"); |
| 272 | -if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef"); |
|
| 273 | -if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef"); |
|
| 278 | +if ($object->nature == 2 || $object->nature == 3) { |
|
| 279 | + $object_label = $langs->trans("InvoiceRef"); |
|
| 280 | +} |
|
| 281 | +if ($object->nature == 5) { |
|
| 282 | + $object_label = $langs->trans("ExpenseReportRef"); |
|
| 283 | +} |
|
| 274 | 284 | |
| 275 | 285 | |
| 276 | 286 | // Show result array |
@@ -286,7 +296,10 @@ discard block |
||
| 286 | 296 | print '<td>' . $langs->trans("AccountAccounting") . '</td>'; |
| 287 | 297 | print '<td>' . $langs->trans("SubledgerAccount") . '</td>'; |
| 288 | 298 | print '<td>' . $langs->trans("LabelOperation") . '</td>'; |
| 289 | -if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank |
|
| 299 | +if ($object->nature == 4) { |
|
| 300 | + print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; |
|
| 301 | +} |
|
| 302 | +// bank |
|
| 290 | 303 | print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>'; |
| 291 | 304 | print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>'; |
| 292 | 305 | print "</tr>\n"; |
@@ -301,7 +314,9 @@ discard block |
||
| 301 | 314 | print '<td>' . $line['account_accounting'] . '</td>'; |
| 302 | 315 | print '<td>' . $line['subledger_account'] . '</td>'; |
| 303 | 316 | print '<td>' . $line['label_operation'] . '</td>'; |
| 304 | - if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>'; |
|
| 317 | + if ($object->nature == 4) { |
|
| 318 | + print '<td class="center">' . $line['payment_mode'] . '</td>'; |
|
| 319 | + } |
|
| 305 | 320 | print '<td class="right nowraponall">' . $line['debit'] . '</td>'; |
| 306 | 321 | print '<td class="right nowraponall">' . $line['credit'] . '</td>'; |
| 307 | 322 | print '</tr>'; |
@@ -386,8 +386,12 @@ discard block |
||
| 386 | 386 | global $hookmanager; |
| 387 | 387 | |
| 388 | 388 | // Clean parameters |
| 389 | - if (empty($type)) $type = 'view'; |
|
| 390 | - if (empty($in_bookkeeping)) $in_bookkeeping = 'notyet'; |
|
| 389 | + if (empty($type)) { |
|
| 390 | + $type = 'view'; |
|
| 391 | + } |
|
| 392 | + if (empty($in_bookkeeping)) { |
|
| 393 | + $in_bookkeeping = 'notyet'; |
|
| 394 | + } |
|
| 391 | 395 | |
| 392 | 396 | $data = array(); |
| 393 | 397 | |
@@ -661,7 +665,9 @@ discard block |
||
| 661 | 665 | |
| 662 | 666 | $disposal_amount_vat = $disposal_subject_to_vat ? (double) price2num($disposal_amount * $disposal_vat / 100, 'MT') : 0; |
| 663 | 667 | $lines[1][$accountancy_code_receivable_on_assignment] = -($disposal_amount + $disposal_amount_vat); |
| 664 | - if ($disposal_subject_to_vat) $lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat; |
|
| 668 | + if ($disposal_subject_to_vat) { |
|
| 669 | + $lines[1][$accountancy_code_vat_collected] = $disposal_amount_vat; |
|
| 670 | + } |
|
| 665 | 671 | $lines[1][$accountancy_code_proceeds_from_sales] = $disposal_amount; |
| 666 | 672 | |
| 667 | 673 | foreach ($lines as $lines_block) { |
@@ -925,7 +931,9 @@ discard block |
||
| 925 | 931 | { |
| 926 | 932 | global $conf, $langs, $hookmanager; |
| 927 | 933 | |
| 928 | - if (empty($sep)) $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; |
|
| 934 | + if (empty($sep)) { |
|
| 935 | + $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; |
|
| 936 | + } |
|
| 929 | 937 | $out = ''; |
| 930 | 938 | |
| 931 | 939 | // Hook |
@@ -976,7 +984,9 @@ discard block |
||
| 976 | 984 | ); |
| 977 | 985 | } |
| 978 | 986 | |
| 979 | - if (!empty($header)) $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n"; |
|
| 987 | + if (!empty($header)) { |
|
| 988 | + $out .= '"' . implode('"' . $sep . '"', $header) . '"' . "\n"; |
|
| 989 | + } |
|
| 980 | 990 | foreach ($journal_data as $element_id => $element) { |
| 981 | 991 | foreach ($element['blocks'] as $lines) { |
| 982 | 992 | foreach ($lines as $line) { |
@@ -468,9 +468,15 @@ discard block |
||
| 468 | 468 | $group_error++; |
| 469 | 469 | break; |
| 470 | 470 | } |
| 471 | - if (!isset($lettering_code)) $lettering_code = (string) $line_infos['lettering_code']; |
|
| 472 | - if (!empty($line_infos['lettering_code'])) $do_it = true; |
|
| 473 | - } elseif (!empty($line_infos['lettering_code'])) $do_it = false; |
|
| 471 | + if (!isset($lettering_code)) { |
|
| 472 | + $lettering_code = (string) $line_infos['lettering_code']; |
|
| 473 | + } |
|
| 474 | + if (!empty($line_infos['lettering_code'])) { |
|
| 475 | + $do_it = true; |
|
| 476 | + } |
|
| 477 | + } elseif (!empty($line_infos['lettering_code'])) { |
|
| 478 | + $do_it = false; |
|
| 479 | + } |
|
| 474 | 480 | } |
| 475 | 481 | |
| 476 | 482 | // Check balance amount |
@@ -481,8 +487,11 @@ discard block |
||
| 481 | 487 | |
| 482 | 488 | // Lettering/Unlettering the group of bookkeeping lines |
| 483 | 489 | if (!$group_error && $do_it) { |
| 484 | - if ($unlettering) $result = $this->deleteLettering($bookkeeping_lines); |
|
| 485 | - else $result = $this->updateLettering($bookkeeping_lines); |
|
| 490 | + if ($unlettering) { |
|
| 491 | + $result = $this->deleteLettering($bookkeeping_lines); |
|
| 492 | + } else { |
|
| 493 | + $result = $this->updateLettering($bookkeeping_lines); |
|
| 494 | + } |
|
| 486 | 495 | if ($result < 0) { |
| 487 | 496 | $group_error++; |
| 488 | 497 | } elseif ($result > 0) { |
@@ -533,7 +542,9 @@ discard block |
||
| 533 | 542 | $sql .= " AND pn.piece_num = ab.piece_num"; |
| 534 | 543 | $sql .= " )"; |
| 535 | 544 | } |
| 536 | - if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
|
| 545 | + if ($only_has_subledger_account) { |
|
| 546 | + $sql .= " AND ab.subledger_account != ''"; |
|
| 547 | + } |
|
| 537 | 548 | |
| 538 | 549 | dol_syslog(__METHOD__ . " - Get all bookkeeping lines", LOG_DEBUG); |
| 539 | 550 | $resql = $this->db->query($sql); |
@@ -607,7 +618,9 @@ discard block |
||
| 607 | 618 | $sql .= " AND dpn.piece_num = ab.piece_num"; |
| 608 | 619 | $sql .= " )"; |
| 609 | 620 | $sql .= ")"; |
| 610 | - if ($only_has_subledger_account) $sql .= " AND ab.subledger_account != ''"; |
|
| 621 | + if ($only_has_subledger_account) { |
|
| 622 | + $sql .= " AND ab.subledger_account != ''"; |
|
| 623 | + } |
|
| 611 | 624 | |
| 612 | 625 | dol_syslog(__METHOD__ . " - Get all bookkeeping lines linked", LOG_DEBUG); |
| 613 | 626 | $resql = $this->db->query($sql); |
@@ -628,7 +641,9 @@ discard block |
||
| 628 | 641 | } |
| 629 | 642 | $this->db->free($resql); |
| 630 | 643 | |
| 631 | - if (!empty($group)) $grouped_lines[] = $group; |
|
| 644 | + if (!empty($group)) { |
|
| 645 | + $grouped_lines[] = $group; |
|
| 646 | + } |
|
| 632 | 647 | } |
| 633 | 648 | } |
| 634 | 649 | |
@@ -830,7 +845,9 @@ discard block |
||
| 830 | 845 | |
| 831 | 846 | foreach ($element_ids as $element_id) { |
| 832 | 847 | // Continue if element id in not found |
| 833 | - if (!isset($link_by_element[$element_id])) continue; |
|
| 848 | + if (!isset($link_by_element[$element_id])) { |
|
| 849 | + continue; |
|
| 850 | + } |
|
| 834 | 851 | |
| 835 | 852 | // Set the element in the current group |
| 836 | 853 | $current_group[$element_id] = $element_id; |
@@ -512,8 +512,10 @@ |
||
| 512 | 512 | ); |
| 513 | 513 | if ($result > 0) { |
| 514 | 514 | $lineid = $result; |
| 515 | - if (!empty($createbills_onebythird)) //increment rang to keep order |
|
| 515 | + if (!empty($createbills_onebythird)) { |
|
| 516 | + //increment rang to keep order |
|
| 516 | 517 | $TFactThirdNbLines[$cmd->socid]++; |
| 518 | + } |
|
| 517 | 519 | } else { |
| 518 | 520 | $lineid = 0; |
| 519 | 521 | $error++; |