@@ -26,14 +26,18 @@ |
||
26 | 26 | * \brief Page de configuration du module externalsite |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check anti CSRF attack test |
|
29 | +if (!defined('NOSCANPOSTFORINJECTION')) { |
|
30 | + define('NOSCANPOSTFORINJECTION', '1'); |
|
31 | +} |
|
32 | +// Do not check anti CSRF attack test |
|
30 | 33 | |
31 | 34 | require '../../main.inc.php'; |
32 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
33 | 36 | |
34 | 37 | |
35 | -if (!$user->admin) |
|
38 | +if (!$user->admin) { |
|
36 | 39 | accessforbidden(); |
40 | +} |
|
37 | 41 | |
38 | 42 | // Load translation files required by the page |
39 | 43 | $langs->loadLangs(array('admin', 'other', 'externalsite')); |
@@ -25,11 +25,21 @@ |
||
25 | 25 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language |
26 | 26 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); |
27 | 27 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); |
28 | -if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); |
|
29 | -if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); |
|
30 | -if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); |
|
31 | -if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); |
|
32 | -if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); |
|
28 | +if (!defined('NOCSRFCHECK')) { |
|
29 | + define('NOCSRFCHECK', '1'); |
|
30 | +} |
|
31 | +if (!defined('NOTOKENRENEWAL')) { |
|
32 | + define('NOTOKENRENEWAL', '1'); |
|
33 | +} |
|
34 | +if (!defined('NOREQUIREMENU')) { |
|
35 | + define('NOREQUIREMENU', '1'); |
|
36 | +} |
|
37 | +if (!defined('NOREQUIREHTML')) { |
|
38 | + define('NOREQUIREHTML', '1'); |
|
39 | +} |
|
40 | +if (!defined('NOREQUIREAJAX')) { |
|
41 | + define('NOREQUIREAJAX', '1'); |
|
42 | +} |
|
33 | 43 | |
34 | 44 | require '../main.inc.php'; // Load $user and permissions |
35 | 45 | require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
@@ -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 |
@@ -1510,9 +1510,9 @@ discard block |
||
1510 | 1510 | ($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) { |
1511 | 1511 | if ($line->doc_type == 'customer_invoice') { |
1512 | 1512 | // Get new customer invoice ref and company name |
1513 | - $sql = 'SELECT f.facnumber, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; |
|
1514 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid'; |
|
1515 | - $sql .= ' WHERE f.rowid = ' . $line->fk_doc; |
|
1513 | + $sql = 'SELECT f.facnumber, s.nom FROM '.MAIN_DB_PREFIX.'facture as f'; |
|
1514 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON f.fk_soc = s.rowid'; |
|
1515 | + $sql .= ' WHERE f.rowid = '.$line->fk_doc; |
|
1516 | 1516 | $resql = $this->db->query($sql); |
1517 | 1517 | if ($resql) { |
1518 | 1518 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -1524,9 +1524,9 @@ discard block |
||
1524 | 1524 | } |
1525 | 1525 | } else { |
1526 | 1526 | // Get new supplier invoice ref and company name |
1527 | - $sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff'; |
|
1528 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid'; |
|
1529 | - $sql .= ' WHERE ff.rowid = ' . $line->fk_doc; |
|
1527 | + $sql = 'SELECT ff.ref, s.nom FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; |
|
1528 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON ff.fk_soc = s.rowid'; |
|
1529 | + $sql .= ' WHERE ff.rowid = '.$line->fk_doc; |
|
1530 | 1530 | $resql = $this->db->query($sql); |
1531 | 1531 | if ($resql) { |
1532 | 1532 | if ($obj = $this->db->fetch_object($resql)) { |
@@ -1548,28 +1548,28 @@ discard block |
||
1548 | 1548 | } |
1549 | 1549 | } |
1550 | 1550 | |
1551 | - print $line->id . $this->separator; |
|
1552 | - print $date . $this->separator; |
|
1553 | - print substr($line->code_journal, 0, 4) . $this->separator; |
|
1551 | + print $line->id.$this->separator; |
|
1552 | + print $date.$this->separator; |
|
1553 | + print substr($line->code_journal, 0, 4).$this->separator; |
|
1554 | 1554 | |
1555 | 1555 | if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
1556 | - print length_accountg($line->subledger_account) . $this->separator; |
|
1556 | + print length_accountg($line->subledger_account).$this->separator; |
|
1557 | 1557 | } else { |
1558 | - print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; |
|
1558 | + print substr(length_accountg($line->numero_compte), 0, 15).$this->separator; |
|
1559 | 1559 | } |
1560 | 1560 | //Libellé Auto |
1561 | 1561 | print $this->separator; |
1562 | 1562 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; |
1563 | 1563 | //Libellé manuel |
1564 | - print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator; |
|
1564 | + print dol_trunc(str_replace('"', '', $invoice_ref.(!empty($company_name) ? ' - ' : '').$company_name), 40, 'right', 'UTF-8', 1).$this->separator; |
|
1565 | 1565 | //Numéro de pièce |
1566 | - print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator; |
|
1566 | + print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).$this->separator; |
|
1567 | 1567 | //Devise |
1568 | - print 'EUR' . $this->separator; |
|
1568 | + print 'EUR'.$this->separator; |
|
1569 | 1569 | //Montant |
1570 | - print price2num(abs($line->montant)) . $this->separator; |
|
1570 | + print price2num(abs($line->montant)).$this->separator; |
|
1571 | 1571 | //Sens |
1572 | - print $line->sens . $this->separator; |
|
1572 | + print $line->sens.$this->separator; |
|
1573 | 1573 | //Code lettrage |
1574 | 1574 | print $this->separator; |
1575 | 1575 | //Date Echéance |
@@ -1593,21 +1593,21 @@ discard block |
||
1593 | 1593 | foreach ($objectLines as $line) { |
1594 | 1594 | $date = dol_print_date($line->doc_date, '%d%m%Y'); |
1595 | 1595 | |
1596 | - print $line->id . $this->separator; |
|
1597 | - print $date . $this->separator; |
|
1598 | - print substr($line->code_journal, 0, 4) . $this->separator; |
|
1599 | - if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
|
1600 | - print length_accountg($line->subledger_account) . $this->separator; |
|
1596 | + print $line->id.$this->separator; |
|
1597 | + print $date.$this->separator; |
|
1598 | + print substr($line->code_journal, 0, 4).$this->separator; |
|
1599 | + if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
|
1600 | + print length_accountg($line->subledger_account).$this->separator; |
|
1601 | 1601 | } else { |
1602 | - print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; |
|
1602 | + print substr(length_accountg($line->numero_compte), 0, 15).$this->separator; |
|
1603 | 1603 | } |
1604 | 1604 | print $this->separator; |
1605 | 1605 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; |
1606 | - print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"' . $this->separator; |
|
1606 | + print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"'.$this->separator; |
|
1607 | 1607 | print '"'.dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).'"'.$this->separator; |
1608 | 1608 | print price2num($line->montant).$this->separator; |
1609 | 1609 | print $line->sens.$this->separator; |
1610 | - print $date . $this->separator; |
|
1610 | + print $date.$this->separator; |
|
1611 | 1611 | print $this->separator; |
1612 | 1612 | print $this->separator; |
1613 | 1613 | print 'EUR'; |
@@ -825,8 +825,8 @@ |
||
825 | 825 | |
826 | 826 | foreach ($objectLines as $line) { |
827 | 827 | if ($line->debit == 0 && $line->credit == 0) { |
828 | - unset($array[$line]); |
|
829 | - } else { |
|
828 | + unset($array[$line]); |
|
829 | + } else { |
|
830 | 830 | $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); |
831 | 831 | $date_document = dol_print_date($line->doc_date, '%Y%m%d'); |
832 | 832 | $date_lettering = dol_print_date($line->date_lettering, '%Y%m%d'); |