@@ -17,15 +17,30 @@ |
||
17 | 17 | |
18 | 18 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language |
19 | 19 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language |
20 | -if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
|
20 | +if (!defined('NOREQUIRESOC')) { |
|
21 | + define('NOREQUIRESOC', '1'); |
|
22 | +} |
|
21 | 23 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
22 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
23 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
24 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
25 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
26 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
24 | +if (!defined('NOCSRFCHECK')) { |
|
25 | + define('NOCSRFCHECK', '1'); |
|
26 | +} |
|
27 | +if (!defined('NOTOKENRENEWAL')) { |
|
28 | + define('NOTOKENRENEWAL', '1'); |
|
29 | +} |
|
30 | +if (!defined('NOREQUIREMENU')) { |
|
31 | + define('NOREQUIREMENU', '1'); |
|
32 | +} |
|
33 | +if (!defined('NOREQUIREHTML')) { |
|
34 | + define('NOREQUIREHTML', '1'); |
|
35 | +} |
|
36 | +if (!defined('NOREQUIREAJAX')) { |
|
37 | + define('NOREQUIREAJAX', '1'); |
|
38 | +} |
|
27 | 39 | |
28 | -if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) require '../../main.inc.php'; // Load $user and permissions |
|
40 | +if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { |
|
41 | + require '../../main.inc.php'; |
|
42 | +} |
|
43 | +// Load $user and permissions |
|
29 | 44 | |
30 | 45 | $id = GETPOST('id', 'int'); |
31 | 46 | $w = GETPOST('w', 'int'); |
@@ -71,9 +71,13 @@ discard block |
||
71 | 71 | $credit = price2num(GETPOST('credit', 'alpha')); |
72 | 72 | |
73 | 73 | $save = GETPOST('save', 'alpha'); |
74 | -if (!empty($save)) $action = 'add'; |
|
74 | +if (!empty($save)) { |
|
75 | + $action = 'add'; |
|
76 | +} |
|
75 | 77 | $update = GETPOST('update', 'alpha'); |
76 | -if (!empty($update)) $action = 'confirm_update'; |
|
78 | +if (!empty($update)) { |
|
79 | + $action = 'confirm_update'; |
|
80 | +} |
|
77 | 81 | |
78 | 82 | $object = new BookKeeping($db); |
79 | 83 | |
@@ -340,7 +344,9 @@ discard block |
||
340 | 344 | } |
341 | 345 | |
342 | 346 | print '<form action="'.$_SERVER["PHP_SELF"].'" name="create_mvt" method="POST">'; |
343 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
347 | + if ($optioncss != '') { |
|
348 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
349 | + } |
|
344 | 350 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
345 | 351 | print '<input type="hidden" name="action" value="confirm_create">'."\n"; |
346 | 352 | print '<input type="hidden" name="next_num_mvt" value="'.$next_num_mvt.'">'."\n"; |
@@ -431,13 +437,16 @@ discard block |
||
431 | 437 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
432 | 438 | print $langs->trans('Docdate'); |
433 | 439 | print '</td>'; |
434 | - if ($action != 'editdate') |
|
435 | - print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>'; |
|
440 | + if ($action != 'editdate') { |
|
441 | + print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdate&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('SetDate'), 1).'</a></td>'; |
|
442 | + } |
|
436 | 443 | print '</tr></table>'; |
437 | 444 | print '</td><td colspan="3">'; |
438 | 445 | if ($action == 'editdate') { |
439 | 446 | print '<form name="setdate" action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">'; |
440 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
447 | + if ($optioncss != '') { |
|
448 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
449 | + } |
|
441 | 450 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
442 | 451 | print '<input type="hidden" name="action" value="setdate">'; |
443 | 452 | print '<input type="hidden" name="mode" value="'.$mode.'">'; |
@@ -455,13 +464,16 @@ discard block |
||
455 | 464 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
456 | 465 | print $langs->trans('Codejournal'); |
457 | 466 | print '</td>'; |
458 | - if ($action != 'editjournal') |
|
459 | - print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; |
|
467 | + if ($action != 'editjournal') { |
|
468 | + print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editjournal&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; |
|
469 | + } |
|
460 | 470 | print '</tr></table>'; |
461 | 471 | print '</td><td>'; |
462 | 472 | if ($action == 'editjournal') { |
463 | 473 | print '<form name="setjournal" action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">'; |
464 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
474 | + if ($optioncss != '') { |
|
475 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
476 | + } |
|
465 | 477 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
466 | 478 | print '<input type="hidden" name="action" value="setjournal">'; |
467 | 479 | print '<input type="hidden" name="mode" value="'.$mode.'">'; |
@@ -479,13 +491,16 @@ discard block |
||
479 | 491 | print '<table class="nobordernopadding" width="100%"><tr><td>'; |
480 | 492 | print $langs->trans('Piece'); |
481 | 493 | print '</td>'; |
482 | - if ($action != 'editdocref') |
|
483 | - print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; |
|
494 | + if ($action != 'editdocref') { |
|
495 | + print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editdocref&piece_num='.$object->piece_num.'&mode='.$mode.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a></td>'; |
|
496 | + } |
|
484 | 497 | print '</tr></table>'; |
485 | 498 | print '</td><td>'; |
486 | 499 | if ($action == 'editdocref') { |
487 | 500 | print '<form name="setdocref" action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">'; |
488 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
501 | + if ($optioncss != '') { |
|
502 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
503 | + } |
|
489 | 504 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
490 | 505 | print '<input type="hidden" name="action" value="setdocref">'; |
491 | 506 | print '<input type="hidden" name="mode" value="'.$mode.'">'; |
@@ -581,7 +596,9 @@ discard block |
||
581 | 596 | print load_fiche_titre($langs->trans("ListeMvts"), '', ''); |
582 | 597 | |
583 | 598 | print '<form action="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'" method="post">'; |
584 | - if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
599 | + if ($optioncss != '') { |
|
600 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
601 | + } |
|
585 | 602 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
586 | 603 | print '<input type="hidden" name="doc_date" value="'.$object->doc_date.'">'."\n"; |
587 | 604 | print '<input type="hidden" name="doc_type" value="'.$object->doc_type.'">'."\n"; |
@@ -647,7 +664,9 @@ discard block |
||
647 | 664 | print '</a> '; |
648 | 665 | |
649 | 666 | $actiontodelete = 'delete'; |
650 | - if ($mode == '_tmp' || $action != 'delmouv') $actiontodelete = 'confirm_delete'; |
|
667 | + if ($mode == '_tmp' || $action != 'delmouv') { |
|
668 | + $actiontodelete = 'confirm_delete'; |
|
669 | + } |
|
651 | 670 | |
652 | 671 | print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.$line->piece_num.'&mode='.$mode.'">'; |
653 | 672 | print img_delete(); |
@@ -31,10 +31,12 @@ discard block |
||
31 | 31 | $langs->loadLangs(array("admin", "compta")); |
32 | 32 | |
33 | 33 | // Security check |
34 | -if ($user->socid > 0) |
|
34 | +if ($user->socid > 0) { |
|
35 | 35 | accessforbidden(); |
36 | -if (empty($user->rights->accounting->fiscalyear->write)) |
|
36 | +} |
|
37 | +if (empty($user->rights->accounting->fiscalyear->write)) { |
|
37 | 38 | accessforbidden(); |
39 | +} |
|
38 | 40 | |
39 | 41 | $error = 0; |
40 | 42 | |
@@ -50,8 +52,9 @@ discard block |
||
50 | 52 | $statut2label = array( |
51 | 53 | '' |
52 | 54 | ); |
53 | -foreach ($tmpstatut2label as $key => $val) |
|
55 | +foreach ($tmpstatut2label as $key => $val) { |
|
54 | 56 | $statut2label[$key] = $langs->trans($val); |
57 | +} |
|
55 | 58 | |
56 | 59 | $object = new Fiscalyear($db); |
57 | 60 |
@@ -37,20 +37,23 @@ |
||
37 | 37 | include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; |
38 | 38 | $accountancyexport = new AccountancyExport($db); |
39 | 39 | |
40 | -if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger |
|
40 | +if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") { |
|
41 | + // Specific filename for FEC model export into the general ledger |
|
41 | 42 | { |
42 | 43 | // FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle |
43 | 44 | if (empty($search_date_end)) |
44 | 45 | { |
45 | 46 | // TODO Get the max date into bookeeping table |
46 | 47 | $search_date_end = dol_now(); |
48 | +} |
|
47 | 49 | } |
48 | 50 | $datetouseforfilename = $search_date_end; |
49 | 51 | $tmparray = dol_getdate($datetouseforfilename); |
50 | 52 | $fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START; |
51 | 53 | // Define end of month to use |
52 | - if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon'] = $fiscalmonth; |
|
53 | - else { |
|
54 | + if ($tmparray['mon'] <= $fiscalmonth) { |
|
55 | + $tmparray['mon'] = $fiscalmonth; |
|
56 | + } else { |
|
54 | 57 | $tmparray['mon'] = $fiscalmonth; |
55 | 58 | $tmparray['year']++; |
56 | 59 | } |
@@ -34,17 +34,23 @@ discard block |
||
34 | 34 | if (empty($conf->accounting->enabled)) { |
35 | 35 | accessforbidden(); |
36 | 36 | } |
37 | -if ($user->socid > 0) |
|
37 | +if ($user->socid > 0) { |
|
38 | 38 | accessforbidden(); |
39 | -if (!$user->rights->accounting->fiscalyear->write) |
|
39 | +} |
|
40 | +if (!$user->rights->accounting->fiscalyear->write) { |
|
40 | 41 | accessforbidden(); |
42 | +} |
|
41 | 43 | |
42 | 44 | |
43 | 45 | $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); |
44 | -if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); |
|
45 | -else { |
|
46 | +if (GETPOST("year", 'int')) { |
|
47 | + $year_start = GETPOST("year", 'int'); |
|
48 | +} else { |
|
46 | 49 | $year_start = dol_print_date(dol_now(), '%Y'); |
47 | - if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year |
|
50 | + if (dol_print_date(dol_now(), '%m') < $month_start) { |
|
51 | + $year_start--; |
|
52 | + } |
|
53 | + // If current month is lower that starting fiscal month, we start last year |
|
48 | 54 | } |
49 | 55 | $year_end = $year_start + 1; |
50 | 56 | $month_end = $month_start - 1; |
@@ -88,7 +94,9 @@ discard block |
||
88 | 94 | print '<table class="noborder centpercent">'; |
89 | 95 | for ($i = 1; $i <= 12; $i++) { |
90 | 96 | $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; |
91 | - if ($j > 12) $j -= 12; |
|
97 | + if ($j > 12) { |
|
98 | + $j -= 12; |
|
99 | + } |
|
92 | 100 | print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>'; |
93 | 101 | } |
94 | 102 | print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'; |
@@ -96,7 +104,9 @@ discard block |
||
96 | 104 | $sql = "SELECT COUNT(b.rowid) as detail,"; |
97 | 105 | for ($i = 1; $i <= 12; $i++) { |
98 | 106 | $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; |
99 | - if ($j > 12) $j -= 12; |
|
107 | + if ($j > 12) { |
|
108 | + $j -= 12; |
|
109 | + } |
|
100 | 110 | $sql .= " SUM(".$db->ifsql('MONTH(b.doc_date)='.$j, '1', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; |
101 | 111 | } |
102 | 112 | $sql .= " COUNT(b.rowid) as total"; |
@@ -34,17 +34,23 @@ discard block |
||
34 | 34 | if (empty($conf->accounting->enabled)) { |
35 | 35 | accessforbidden(); |
36 | 36 | } |
37 | -if ($user->socid > 0) |
|
38 | - accessforbidden(); |
|
39 | - if (!$user->rights->accounting->fiscalyear->write) |
|
37 | +if ($user->socid > 0) { |
|
40 | 38 | accessforbidden(); |
39 | +} |
|
40 | + if (!$user->rights->accounting->fiscalyear->write) { |
|
41 | + accessforbidden(); |
|
42 | + } |
|
41 | 43 | |
42 | 44 | |
43 | 45 | $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); |
44 | -if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); |
|
45 | -else { |
|
46 | +if (GETPOST("year", 'int')) { |
|
47 | + $year_start = GETPOST("year", 'int'); |
|
48 | +} else { |
|
46 | 49 | $year_start = dol_print_date(dol_now(), '%Y'); |
47 | - if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year |
|
50 | + if (dol_print_date(dol_now(), '%m') < $month_start) { |
|
51 | + $year_start--; |
|
52 | + } |
|
53 | + // If current month is lower that starting fiscal month, we start last year |
|
48 | 54 | } |
49 | 55 | $year_end = $year_start + 1; |
50 | 56 | $month_end = $month_start - 1; |
@@ -109,7 +115,9 @@ discard block |
||
109 | 115 | print '<tr class="oddeven">'; |
110 | 116 | for ($i = 1; $i <= 12; $i++) { |
111 | 117 | $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; |
112 | - if ($j > 12) $j -= 12; |
|
118 | + if ($j > 12) { |
|
119 | + $j -= 12; |
|
120 | + } |
|
113 | 121 | print '<td class="center">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>'; |
114 | 122 | } |
115 | 123 | print '<td><b>'.$langs->trans("Total").'</b></td></tr>'; |
@@ -118,7 +126,9 @@ discard block |
||
118 | 126 | $sql = "SELECT COUNT(b.rowid) as detail,"; |
119 | 127 | for ($i = 1; $i <= 12; $i++) { |
120 | 128 | $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; |
121 | - if ($j > 12) $j -= 12; |
|
129 | + if ($j > 12) { |
|
130 | + $j -= 12; |
|
131 | + } |
|
122 | 132 | $sql .= " SUM(".$db->ifsql('MONTH(b.doc_date)='.$j, '1', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).","; |
123 | 133 | } |
124 | 134 | $sql .= " COUNT(b.rowid) as total"; |
@@ -453,8 +453,9 @@ discard block |
||
453 | 453 | $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd |
454 | 454 | foreach ($TData as $data) { |
455 | 455 | $code_compta = $data->numero_compte; |
456 | - if (!empty($data->subledger_account)) |
|
457 | - $code_compta = $data->subledger_account; |
|
456 | + if (!empty($data->subledger_account)) { |
|
457 | + $code_compta = $data->subledger_account; |
|
458 | + } |
|
458 | 459 | |
459 | 460 | $Tab = array(); |
460 | 461 | $Tab['num_ecriture'] = str_pad($i, 5); |
@@ -494,8 +495,9 @@ discard block |
||
494 | 495 | //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy |
495 | 496 | foreach ($TData as $data) { |
496 | 497 | $code_compta = $data->numero_compte; |
497 | - if (!empty($data->subledger_account)) |
|
498 | - $code_compta = $data->subledger_account; |
|
498 | + if (!empty($data->subledger_account)) { |
|
499 | + $code_compta = $data->subledger_account; |
|
500 | + } |
|
499 | 501 | |
500 | 502 | $Tab = array(); |
501 | 503 | $Tab['type_ligne'] = 'M'; |
@@ -578,8 +580,9 @@ discard block |
||
578 | 580 | //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy |
579 | 581 | foreach ($TData as $data) { |
580 | 582 | $code_compta = $data->numero_compte; |
581 | - if (!empty($data->subledger_account)) |
|
582 | - $code_compta = $data->subledger_account; |
|
583 | + if (!empty($data->subledger_account)) { |
|
584 | + $code_compta = $data->subledger_account; |
|
585 | + } |
|
583 | 586 | |
584 | 587 | $Tab = array(); |
585 | 588 | //$Tab['type_ligne'] = 'M'; |
@@ -1446,8 +1449,9 @@ discard block |
||
1446 | 1449 | |
1447 | 1450 | print self::trunc($line->code_journal, 6).$separator; //Journal code |
1448 | 1451 | |
1449 | - if (!empty($line->subledger_account)) $account = $line->subledger_account; |
|
1450 | - else { |
|
1452 | + if (!empty($line->subledger_account)) { |
|
1453 | + $account = $line->subledger_account; |
|
1454 | + } else { |
|
1451 | 1455 | $account = $line->numero_compte; |
1452 | 1456 | } |
1453 | 1457 | print self::trunc($account, 15).$separator; //Account number |
@@ -248,8 +248,12 @@ discard block |
||
248 | 248 | if (isset($this->piece_num)) { |
249 | 249 | $this->piece_num = trim($this->piece_num); |
250 | 250 | } |
251 | - if (empty($this->debit)) $this->debit = 0.0; |
|
252 | - if (empty($this->credit)) $this->credit = 0.0; |
|
251 | + if (empty($this->debit)) { |
|
252 | + $this->debit = 0.0; |
|
253 | + } |
|
254 | + if (empty($this->credit)) { |
|
255 | + $this->credit = 0.0; |
|
256 | + } |
|
253 | 257 | |
254 | 258 | // Check parameters |
255 | 259 | if (($this->numero_compte == "") || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined') |
@@ -446,7 +450,10 @@ discard block |
||
446 | 450 | global $dolibarr_main_authentication, $dolibarr_main_demo; |
447 | 451 | global $menumanager; |
448 | 452 | |
449 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
453 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
454 | + $notooltip = 1; |
|
455 | + } |
|
456 | + // Force disable tooltips |
|
450 | 457 | |
451 | 458 | $result = ''; |
452 | 459 | $companylink = ''; |
@@ -461,8 +468,12 @@ discard block |
||
461 | 468 | { |
462 | 469 | // Add param to save lastsearch_values or not |
463 | 470 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
464 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; |
|
465 | - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; |
|
471 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
472 | + $add_save_lastsearch_values = 1; |
|
473 | + } |
|
474 | + if ($add_save_lastsearch_values) { |
|
475 | + $url .= '&save_lastsearch_values=1'; |
|
476 | + } |
|
466 | 477 | } |
467 | 478 | |
468 | 479 | $linkclose = ''; |
@@ -475,15 +486,21 @@ discard block |
||
475 | 486 | } |
476 | 487 | $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
477 | 488 | $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
478 | - } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
489 | + } else { |
|
490 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
491 | + } |
|
479 | 492 | |
480 | 493 | $linkstart = '<a href="'.$url.'"'; |
481 | 494 | $linkstart .= $linkclose.'>'; |
482 | 495 | $linkend = '</a>'; |
483 | 496 | |
484 | 497 | $result .= $linkstart; |
485 | - 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); |
|
486 | - if ($withpicto != 2) $result .= $this->piece_num; |
|
498 | + if ($withpicto) { |
|
499 | + $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); |
|
500 | + } |
|
501 | + if ($withpicto != 2) { |
|
502 | + $result .= $this->piece_num; |
|
503 | + } |
|
487 | 504 | $result .= $linkend; |
488 | 505 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
489 | 506 | |
@@ -563,8 +580,12 @@ discard block |
||
563 | 580 | if (isset($this->piece_num)) { |
564 | 581 | $this->piece_num = trim($this->piece_num); |
565 | 582 | } |
566 | - if (empty($this->debit)) $this->debit = 0; |
|
567 | - if (empty($this->credit)) $this->credit = 0; |
|
583 | + if (empty($this->debit)) { |
|
584 | + $this->debit = 0; |
|
585 | + } |
|
586 | + if (empty($this->credit)) { |
|
587 | + $this->credit = 0; |
|
588 | + } |
|
568 | 589 | |
569 | 590 | $this->debit = price2num($this->debit, 'MT'); |
570 | 591 | $this->credit = price2num($this->credit, 'MT'); |
@@ -1395,7 +1416,9 @@ discard block |
||
1395 | 1416 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
1396 | 1417 | $sql .= " WHERE 1 = 1"; |
1397 | 1418 | $sql .= dolSqlDateFilter('doc_date', 0, $delmonth, $delyear); |
1398 | - if (!empty($journal)) $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; |
|
1419 | + if (!empty($journal)) { |
|
1420 | + $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; |
|
1421 | + } |
|
1399 | 1422 | $sql .= " AND entity IN (".getEntity('accountancy').")"; |
1400 | 1423 | |
1401 | 1424 | // TODO: In a future we must forbid deletion if record is inside a closed fiscal period. |
@@ -1590,8 +1613,12 @@ discard block |
||
1590 | 1613 | |
1591 | 1614 | if ($result) { |
1592 | 1615 | $obj = $this->db->fetch_object($result); |
1593 | - if ($obj) $result = $obj->max; |
|
1594 | - if (empty($result)) $result = 1; |
|
1616 | + if ($obj) { |
|
1617 | + $result = $obj->max; |
|
1618 | + } |
|
1619 | + if (empty($result)) { |
|
1620 | + $result = 1; |
|
1621 | + } |
|
1595 | 1622 | return $result; |
1596 | 1623 | } else { |
1597 | 1624 | $this->error = "Error ".$this->db->lasterror(); |
@@ -226,18 +226,25 @@ discard block |
||
226 | 226 | { |
227 | 227 | global $langs, $conf, $user; |
228 | 228 | |
229 | - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips |
|
229 | + if (!empty($conf->dol_no_mouse_hover)) { |
|
230 | + $notooltip = 1; |
|
231 | + } |
|
232 | + // Force disable tooltips |
|
230 | 233 | |
231 | 234 | $result = ''; |
232 | 235 | |
233 | 236 | $url = DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35'; |
234 | 237 | |
235 | 238 | $label = '<u>'.$langs->trans("ShowAccountingJournal").'</u>'; |
236 | - if (!empty($this->code)) |
|
237 | - $label .= '<br><b>'.$langs->trans('Code').':</b> '.$this->code; |
|
238 | - if (!empty($this->label)) |
|
239 | - $label .= '<br><b>'.$langs->trans('Label').':</b> '.$langs->transnoentities($this->label); |
|
240 | - if ($moretitle) $label .= ' - '.$moretitle; |
|
239 | + if (!empty($this->code)) { |
|
240 | + $label .= '<br><b>'.$langs->trans('Code').':</b> '.$this->code; |
|
241 | + } |
|
242 | + if (!empty($this->label)) { |
|
243 | + $label .= '<br><b>'.$langs->trans('Label').':</b> '.$langs->transnoentities($this->label); |
|
244 | + } |
|
245 | + if ($moretitle) { |
|
246 | + $label .= ' - '.$moretitle; |
|
247 | + } |
|
241 | 248 | |
242 | 249 | $linkclose = ''; |
243 | 250 | if (empty($notooltip)) |
@@ -263,11 +270,17 @@ discard block |
||
263 | 270 | } |
264 | 271 | |
265 | 272 | $label_link = $this->code; |
266 | - if ($withlabel) $label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : ''); |
|
273 | + if ($withlabel) { |
|
274 | + $label_link .= ' - '.($nourl ? '<span class="opacitymedium">' : '').$langs->transnoentities($this->label).($nourl ? '</span>' : ''); |
|
275 | + } |
|
267 | 276 | |
268 | 277 | $result .= $linkstart; |
269 | - 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); |
|
270 | - if ($withpicto != 2) $result .= $label_link; |
|
278 | + if ($withpicto) { |
|
279 | + $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); |
|
280 | + } |
|
281 | + if ($withpicto != 2) { |
|
282 | + $result .= $label_link; |
|
283 | + } |
|
271 | 284 | $result .= $linkend; |
272 | 285 | |
273 | 286 | return $result; |
@@ -302,20 +315,34 @@ discard block |
||
302 | 315 | if ($mode == 0) |
303 | 316 | { |
304 | 317 | $prefix = ''; |
305 | - if ($nature == 9) return $langs->trans('AccountingJournalType9'); |
|
306 | - elseif ($nature == 5) return $langs->trans('AccountingJournalType5'); |
|
307 | - elseif ($nature == 4) return $langs->trans('AccountingJournalType4'); |
|
308 | - elseif ($nature == 3) return $langs->trans('AccountingJournalType3'); |
|
309 | - elseif ($nature == 2) return $langs->trans('AccountingJournalType2'); |
|
310 | - elseif ($nature == 1) return $langs->trans('AccountingJournalType1'); |
|
318 | + if ($nature == 9) { |
|
319 | + return $langs->trans('AccountingJournalType9'); |
|
320 | + } elseif ($nature == 5) { |
|
321 | + return $langs->trans('AccountingJournalType5'); |
|
322 | + } elseif ($nature == 4) { |
|
323 | + return $langs->trans('AccountingJournalType4'); |
|
324 | + } elseif ($nature == 3) { |
|
325 | + return $langs->trans('AccountingJournalType3'); |
|
326 | + } elseif ($nature == 2) { |
|
327 | + return $langs->trans('AccountingJournalType2'); |
|
328 | + } elseif ($nature == 1) { |
|
329 | + return $langs->trans('AccountingJournalType1'); |
|
330 | + } |
|
311 | 331 | } elseif ($mode == 1) |
312 | 332 | { |
313 | - if ($nature == 9) return $langs->trans('AccountingJournalType9'); |
|
314 | - elseif ($nature == 5) return $langs->trans('AccountingJournalType5'); |
|
315 | - elseif ($nature == 4) return $langs->trans('AccountingJournalType4'); |
|
316 | - elseif ($nature == 3) return $langs->trans('AccountingJournalType3'); |
|
317 | - elseif ($nature == 2) return $langs->trans('AccountingJournalType2'); |
|
318 | - elseif ($nature == 1) return $langs->trans('AccountingJournalType1'); |
|
333 | + if ($nature == 9) { |
|
334 | + return $langs->trans('AccountingJournalType9'); |
|
335 | + } elseif ($nature == 5) { |
|
336 | + return $langs->trans('AccountingJournalType5'); |
|
337 | + } elseif ($nature == 4) { |
|
338 | + return $langs->trans('AccountingJournalType4'); |
|
339 | + } elseif ($nature == 3) { |
|
340 | + return $langs->trans('AccountingJournalType3'); |
|
341 | + } elseif ($nature == 2) { |
|
342 | + return $langs->trans('AccountingJournalType2'); |
|
343 | + } elseif ($nature == 1) { |
|
344 | + return $langs->trans('AccountingJournalType1'); |
|
345 | + } |
|
319 | 346 | } |
320 | 347 | } |
321 | 348 | } |