@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | if ($mode != "_tmp") { |
| 552 | 552 | // Date document export |
| 553 | 553 | print '<tr>'; |
| 554 | - print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>'; |
|
| 554 | + print '<td class="titlefield">'.$langs->trans("DateExport").'</td>'; |
|
| 555 | 555 | print '<td>'; |
| 556 | 556 | print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; |
| 557 | 557 | print '</td>'; |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | // Date document validation |
| 561 | 561 | print '<tr>'; |
| 562 | - print '<td class="titlefield">' . $langs->trans("DateValidation") . '</td>'; |
|
| 562 | + print '<td class="titlefield">'.$langs->trans("DateValidation").'</td>'; |
|
| 563 | 563 | print '<td>'; |
| 564 | 564 | print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; |
| 565 | 565 | print '</td>'; |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | |
| 617 | 617 | print '<br>'; |
| 618 | 618 | |
| 619 | - $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt |
|
| 619 | + $result = $object->fetchAllPerMvt($piece_num, $mode); // This load $object->linesmvt |
|
| 620 | 620 | |
| 621 | 621 | if ($result < 0) { |
| 622 | 622 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -712,14 +712,14 @@ discard block |
||
| 712 | 712 | if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) { |
| 713 | 713 | print $formaccounting->select_auxaccount('', 'subledger_account', 1, 'maxwidth250', '', 'subledger_label'); |
| 714 | 714 | } else { |
| 715 | - print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccount")) . '">'; |
|
| 715 | + print '<input type="text" class="maxwidth150" name="subledger_account" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccount")).'">'; |
|
| 716 | 716 | } |
| 717 | - print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="' . dol_escape_htmltag($langs->trans("SubledgerAccountLabel")) . '">'; |
|
| 717 | + print '<br><input type="text" class="maxwidth150" name="subledger_label" value="" placeholder="'.dol_escape_htmltag($langs->trans("SubledgerAccountLabel")).'">'; |
|
| 718 | 718 | print '</td>'; |
| 719 | - print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>'; |
|
| 719 | + print '<td><input type="text" class="minwidth200" name="label_operation" value="'.$label_operation.'"/></td>'; |
|
| 720 | 720 | print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; |
| 721 | 721 | print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>'; |
| 722 | - print '<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans("Add") . '"></td>'; |
|
| 722 | + print '<td class="center"><input type="submit" class="button small" name="save" value="'.$langs->trans("Add").'"></td>'; |
|
| 723 | 723 | } |
| 724 | 724 | } else { |
| 725 | 725 | print '<!-- td columns in display mode -->'; |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | |
| 743 | 743 | print '<td class="center nowraponall">'; |
| 744 | 744 | if (empty($line->date_export) && empty($line->date_validation)) { |
| 745 | - print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; |
|
| 745 | + print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=update&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">'; |
|
| 746 | 746 | print img_edit('', 0, 'class="marginrightonly"'); |
| 747 | 747 | print '</a> '; |
| 748 | 748 | } else { |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | $actiontodelete = 'confirm_delete'; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; |
|
| 760 | + print '<a href="'.$_SERVER["PHP_SELF"].'?action='.$actiontodelete.'&id='.$line->id.'&piece_num='.urlencode($line->piece_num).'&mode='.urlencode($mode).'&token='.urlencode(newToken()).'">'; |
|
| 761 | 761 | print img_delete(); |
| 762 | 762 | print '</a>'; |
| 763 | 763 | } else { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 85 | 85 | $object = new BookKeeping($db); |
| 86 | -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array |
|
| 86 | +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array |
|
| 87 | 87 | |
| 88 | 88 | $formaccounting = new FormAccounting($db); |
| 89 | 89 | $formother = new FormOther($db); |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | if (!empty($search_date_start)) { |
| 163 | 163 | $filter['t.doc_date>='] = $search_date_start; |
| 164 | - $param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); |
|
| 164 | + $param .= '&date_startmonth='.GETPOST('date_startmonth', 'int').'&date_startday='.GETPOST('date_startday', 'int').'&date_startyear='.GETPOST('date_startyear', 'int'); |
|
| 165 | 165 | } |
| 166 | 166 | if (!empty($search_date_end)) { |
| 167 | 167 | $filter['t.doc_date<='] = $search_date_end; |
| 168 | - $param .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); |
|
| 168 | + $param .= '&date_endmonth='.GETPOST('date_endmonth', 'int').'&date_endday='.GETPOST('date_endday', 'int').'&date_endyear='.GETPOST('date_endyear', 'int'); |
|
| 169 | 169 | } |
| 170 | 170 | if (!empty($search_doc_date)) { |
| 171 | 171 | $filter['t.doc_date'] = $search_doc_date; |
| 172 | - $param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); |
|
| 172 | + $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int'); |
|
| 173 | 173 | } |
| 174 | 174 | if (!empty($search_accountancy_code_start)) { |
| 175 | 175 | if ($type == 'sub') { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } else { |
| 178 | 178 | $filter['t.numero_compte>='] = $search_accountancy_code_start; |
| 179 | 179 | } |
| 180 | - $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); |
|
| 180 | + $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start); |
|
| 181 | 181 | } |
| 182 | 182 | if (!empty($search_accountancy_code_end)) { |
| 183 | 183 | if ($type == 'sub') { |
@@ -185,12 +185,12 @@ discard block |
||
| 185 | 185 | } else { |
| 186 | 186 | $filter['t.numero_compte<='] = $search_accountancy_code_end; |
| 187 | 187 | } |
| 188 | - $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); |
|
| 188 | + $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); |
|
| 189 | 189 | } |
| 190 | 190 | if (!empty($search_ledger_code)) { |
| 191 | 191 | $filter['t.code_journal'] = $search_ledger_code; |
| 192 | 192 | foreach ($search_ledger_code as $code) { |
| 193 | - $param .= '&search_ledger_code[]=' . urlencode($code); |
|
| 193 | + $param .= '&search_ledger_code[]='.urlencode($code); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | if (!empty($search_not_reconciled)) { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | // param with type of list |
| 202 | 202 | $url_param = substr($param, 1); // remove first "&" |
| 203 | 203 | if (!empty($type)) { |
| 204 | - $param = '&type=' . $type . $param; |
|
| 204 | + $param = '&type='.$type.$param; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | foreach ($object->lines as $line) { |
| 225 | 225 | if ($type == 'sub') { |
| 226 | - print '"' . length_accounta($line->subledger_account) . '"' . $sep; |
|
| 227 | - print '"' . $line->subledger_label . '"' . $sep; |
|
| 226 | + print '"'.length_accounta($line->subledger_account).'"'.$sep; |
|
| 227 | + print '"'.$line->subledger_label.'"'.$sep; |
|
| 228 | 228 | } else { |
| 229 | - print '"' . length_accountg($line->numero_compte) . '"' . $sep; |
|
| 230 | - print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep; |
|
| 229 | + print '"'.length_accountg($line->numero_compte).'"'.$sep; |
|
| 230 | + print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep; |
|
| 231 | 231 | } |
| 232 | 232 | print '"'.price($line->debit).'"'.$sep; |
| 233 | 233 | print '"'.price($line->credit).'"'.$sep; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; |
| 301 | 301 | |
| 302 | 302 | if (empty($reshook)) { |
| 303 | - $newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' (' . getDolGlobalString('ACCOUNTING_EXPORT_FORMAT').')" />'; |
|
| 303 | + $newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.getDolGlobalString('ACCOUNTING_EXPORT_FORMAT').')" />'; |
|
| 304 | 304 | |
| 305 | 305 | print '<script type="text/javascript"> |
| 306 | 306 | jQuery(document).ready(function() { |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | </script>'; |
| 316 | 316 | |
| 317 | 317 | if ($type == 'sub') { |
| 318 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 319 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 318 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 319 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 320 | 320 | } else { |
| 321 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 322 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 321 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 322 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 323 | 323 | } |
| 324 | 324 | $newcardbutton .= dolGetButtonTitleSeparator(); |
| 325 | 325 | $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); |
@@ -463,9 +463,9 @@ discard block |
||
| 463 | 463 | // without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal. |
| 464 | 464 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 465 | 465 | $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; |
| 466 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; |
|
| 467 | - $sql .= " WHERE t.entity = " . $conf->entity; // Never do sharing into accounting features |
|
| 468 | - $sql .= " AND t.doc_date < '" . $db->idate($search_date_start) . "'"; |
|
| 466 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; |
|
| 467 | + $sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features |
|
| 468 | + $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; |
|
| 469 | 469 | $sql .= " GROUP BY t.numero_compte"; |
| 470 | 470 | |
| 471 | 471 | $resql = $db->query($sql); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $opening_balances = array(); |
| 474 | 474 | for ($i = 0; $i < $nrows; $i++) { |
| 475 | 475 | $arr = $resql->fetch_array(); |
| 476 | - $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; |
|
| 476 | + $opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance']; |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | |
@@ -505,9 +505,9 @@ discard block |
||
| 505 | 505 | //var_dump($accounting_account); |
| 506 | 506 | //var_dump($accountingaccountstatic); |
| 507 | 507 | if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) { |
| 508 | - $link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>'; |
|
| 508 | + $link = '<a class="editfielda reposition" href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>'; |
|
| 509 | 509 | } elseif ($accounting_account == 'NotDefined') { |
| 510 | - $link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; |
|
| 510 | + $link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&token='.newToken().'&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>'; |
|
| 511 | 511 | } elseif (empty($tmparrayforrootaccount['label'])) { |
| 512 | 512 | // $tmparrayforrootaccount['label'] not defined = the account has not parent with a parent. |
| 513 | 513 | // This is useless, we should not create a new account when an account has no parent, we must edit it to fix its parent. |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | // Show first line of a break |
| 541 | 541 | print '<tr class="trforbreak">'; |
| 542 | - print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; |
|
| 542 | + print '<td colspan="'.($colspan + 1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; |
|
| 543 | 543 | print '</tr>'; |
| 544 | 544 | |
| 545 | 545 | $displayed_account = $root_account_number; |
@@ -578,22 +578,22 @@ discard block |
||
| 578 | 578 | $urlzoom = ''; |
| 579 | 579 | if ($type == 'sub') { |
| 580 | 580 | if ($line->subledger_account) { |
| 581 | - $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) . '&search_accountancy_code_end=' . urlencode($line->subledger_account); |
|
| 581 | + $urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start='.urlencode($line->subledger_account).'&search_accountancy_code_end='.urlencode($line->subledger_account); |
|
| 582 | 582 | if (GETPOSTISSET('date_startmonth')) { |
| 583 | - $urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int'); |
|
| 583 | + $urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int'); |
|
| 584 | 584 | } |
| 585 | 585 | if (GETPOSTISSET('date_endmonth')) { |
| 586 | - $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); |
|
| 586 | + $urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int'); |
|
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | } else { |
| 590 | 590 | if ($line->numero_compte) { |
| 591 | - $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte); |
|
| 591 | + $urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte); |
|
| 592 | 592 | if (GETPOSTISSET('date_startmonth')) { |
| 593 | - $urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int'); |
|
| 593 | + $urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int'); |
|
| 594 | 594 | } |
| 595 | 595 | if (GETPOSTISSET('date_endmonth')) { |
| 596 | - $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); |
|
| 596 | + $urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int'); |
|
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | 599 | } |
@@ -636,9 +636,9 @@ discard block |
||
| 636 | 636 | print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit, 'MT')).'</td>'; |
| 637 | 637 | print '<td class="right nowraponall amount">'.price(price2num($sous_total_credit, 'MT')).'</td>'; |
| 638 | 638 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 639 | - print '<td class="right nowraponall amount">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>'; |
|
| 639 | + print '<td class="right nowraponall amount">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')).'</td>'; |
|
| 640 | 640 | } else { |
| 641 | - print '<td class="right nowraponall amount">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>'; |
|
| 641 | + print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit - $sous_total_credit, 'MT')).'</td>'; |
|
| 642 | 642 | } |
| 643 | 643 | // Action column |
| 644 | 644 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -659,9 +659,9 @@ discard block |
||
| 659 | 659 | print '<td class="right nowraponall amount">'.price(price2num($total_debit, 'MT')).'</td>'; |
| 660 | 660 | print '<td class="right nowraponall amount">'.price(price2num($total_credit, 'MT')).'</td>'; |
| 661 | 661 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 662 | - print '<td class="right nowraponall amount">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>'; |
|
| 662 | + print '<td class="right nowraponall amount">'.price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')).'</td>'; |
|
| 663 | 663 | } else { |
| 664 | - print '<td class="right nowraponall amount">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>'; |
|
| 664 | + print '<td class="right nowraponall amount">'.price(price2num($total_debit - $total_credit, 'MT')).'</td>'; |
|
| 665 | 665 | } |
| 666 | 666 | // Action column |
| 667 | 667 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 72 | 72 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 73 | 73 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 74 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 74 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 75 | 75 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 76 | 76 | $search_country = GETPOST('search_country', 'alpha'); |
| 77 | 77 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -266,20 +266,20 @@ discard block |
||
| 266 | 266 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; |
| 267 | 267 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
| 268 | 268 | if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 269 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
| 269 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
| 270 | 270 | } |
| 271 | 271 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
| 272 | 272 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; |
| 273 | 273 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
| 274 | 274 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 275 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 275 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 276 | 276 | } |
| 277 | 277 | $alias_societe_perentity = !getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED') ? "s" : "spe"; |
| 278 | 278 | $alias_product_perentity = !getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p" : "ppe"; |
| 279 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
| 280 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
| 281 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
| 282 | -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
| 279 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON ".$alias_product_perentity.".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
| 280 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON ".$alias_product_perentity.".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
| 281 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON ".$alias_product_perentity.".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
| 282 | +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON ".$alias_societe_perentity.".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
| 283 | 283 | $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; |
| 284 | 284 | $sql .= " AND l.product_type <= 2"; |
| 285 | 285 | // Define begin binding date |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num_lines, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); |
| 474 | 474 | |
| 475 | 475 | if ($massaction == 'set_default_account') { |
| 476 | - $formquestion[]=array('type' => 'other', |
|
| 476 | + $formquestion[] = array('type' => 'other', |
|
| 477 | 477 | 'name' => 'set_default_account', |
| 478 | 478 | 'label' => $langs->trans("AccountancyCode"), |
| 479 | 479 | 'value' => $formaccounting->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone')); |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | $thirdpartystatic->email = $objp->email; |
| 576 | 576 | $thirdpartystatic->country_code = $objp->country_code; |
| 577 | 577 | $thirdpartystatic->tva_intra = $objp->tva_intra; |
| 578 | - $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 578 | + $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 579 | 579 | |
| 580 | 580 | $product_static->ref = $objp->product_ref; |
| 581 | 581 | $product_static->id = $objp->product_id; |
@@ -617,16 +617,16 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | $suggestedid = 0; |
| 619 | 619 | |
| 620 | - $return=$accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier'); |
|
| 621 | - if (!is_array($return) && $return<0) { |
|
| 620 | + $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facturefourn_static, $facturefourn_static_det, $accountingAccountArray, 'supplier'); |
|
| 621 | + if (!is_array($return) && $return < 0) { |
|
| 622 | 622 | setEventMessage($accountingAccount->error, 'errors'); |
| 623 | 623 | } else { |
| 624 | - $suggestedid=$return['suggestedid']; |
|
| 625 | - $suggestedaccountingaccountfor=$return['suggestedaccountingaccountfor']; |
|
| 626 | - $suggestedaccountingaccountbydefaultfor=$return['suggestedaccountingaccountbydefaultfor']; |
|
| 627 | - $code_buy_l=$return['code_l']; |
|
| 628 | - $code_buy_p=$return['code_p']; |
|
| 629 | - $code_buy_t=$return['code_t']; |
|
| 624 | + $suggestedid = $return['suggestedid']; |
|
| 625 | + $suggestedaccountingaccountfor = $return['suggestedaccountingaccountfor']; |
|
| 626 | + $suggestedaccountingaccountbydefaultfor = $return['suggestedaccountingaccountbydefaultfor']; |
|
| 627 | + $code_buy_l = $return['code_l']; |
|
| 628 | + $code_buy_p = $return['code_p']; |
|
| 629 | + $code_buy_t = $return['code_t']; |
|
| 630 | 630 | } |
| 631 | 631 | //var_dump($return); |
| 632 | 632 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | //if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export |
| 699 | 699 | // $code_vat_differ = 'warning bold'; |
| 700 | 700 | //} |
| 701 | - print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">'; |
|
| 701 | + print '<td class="right'.($code_vat_differ ? ' '.$code_vat_differ : '').'">'; |
|
| 702 | 702 | print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1); |
| 703 | 703 | print '</td>'; |
| 704 | 704 | |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | if (!empty($toselect)) { |
| 778 | 778 | $ischecked = 0; |
| 779 | 779 | if (in_array($objp->rowid."_".$i, $toselect)) { |
| 780 | - $ischecked=1; |
|
| 780 | + $ischecked = 1; |
|
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | 783 | |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; |
| 112 | 112 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
| 113 | 113 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 114 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 114 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 115 | 115 | } |
| 116 | 116 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid"; |
| 117 | 117 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn "; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 62 | 62 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 63 | 63 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 64 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 64 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 65 | 65 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 66 | 66 | $search_country = GETPOST('search_country', 'alpha'); |
| 67 | 67 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; |
| 227 | 227 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
| 228 | 228 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 229 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 229 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 230 | 230 | } |
| 231 | 231 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation"; |
| 232 | 232 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn"; |
| 233 | 233 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
| 234 | 234 | if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 235 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
| 235 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
| 236 | 236 | } |
| 237 | 237 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
| 238 | 238 | $sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; |
@@ -145,20 +145,20 @@ discard block |
||
| 145 | 145 | $sql .= " FROM ".$db->prefix()."facture_fourn as f"; |
| 146 | 146 | $sql .= " INNER JOIN ".$db->prefix()."societe as s ON s.rowid = f.fk_soc"; |
| 147 | 147 | if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
| 148 | - $sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
| 148 | + $sql .= " LEFT JOIN ".$db->prefix()."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
| 149 | 149 | } |
| 150 | 150 | $sql .= " LEFT JOIN ".$db->prefix()."c_country as co ON co.rowid = s.fk_pays "; |
| 151 | 151 | $sql .= " INNER JOIN ".$db->prefix()."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; |
| 152 | 152 | $sql .= " LEFT JOIN ".$db->prefix()."product as p ON p.rowid = l.fk_product"; |
| 153 | 153 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 154 | - $sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 154 | + $sql .= " LEFT JOIN ".$db->prefix()."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 155 | 155 | } |
| 156 | 156 | $alias_societe_perentity = !getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED') ? "s" : "spe"; |
| 157 | 157 | $alias_product_perentity = !getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p" : "ppe"; |
| 158 | - $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
| 159 | - $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
| 160 | - $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
| 161 | - $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
| 158 | + $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON ".$alias_product_perentity.".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; |
|
| 159 | + $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa2 ON ".$alias_product_perentity.".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; |
|
| 160 | + $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa3 ON ".$alias_product_perentity.".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; |
|
| 161 | + $sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa4 ON ".$alias_product_perentity.".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; |
|
| 162 | 162 | $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; |
| 163 | 163 | $sql .= " AND l.product_type <= 2"; |
| 164 | 164 | $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $thirdpartystatic->email = $objp->email; |
| 201 | 201 | $thirdpartystatic->country_code = $objp->country_code; |
| 202 | 202 | $thirdpartystatic->tva_intra = $objp->tva_intra; |
| 203 | - $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 203 | + $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion) |
|
| 204 | 204 | |
| 205 | 205 | $product_static->ref = $objp->product_ref; |
| 206 | 206 | $product_static->id = $objp->product_id; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $suggestedid = 0; |
| 244 | 244 | |
| 245 | 245 | $return = $accountingAccount->getAccountingCodeToBind($mysoc, $thirdpartystatic, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'supplier'); |
| 246 | - if (!is_array($return) && $return<0) { |
|
| 246 | + if (!is_array($return) && $return < 0) { |
|
| 247 | 247 | setEventMessage($accountingAccount->error, 'errors'); |
| 248 | 248 | } else { |
| 249 | 249 | $suggestedid = $return['suggestedid']; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $db->rollback(); |
| 287 | 287 | } else { |
| 288 | 288 | $db->commit(); |
| 289 | - setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); |
|
| 289 | + setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, ($notpossible ? 'warnings' : 'mesgs')); |
|
| 290 | 290 | if ($nbbindfailed) { |
| 291 | 291 | setEventMessages($langs->trans('DoManualBindingForFailedRecord', $nbbindfailed), null, 'warnings'); |
| 292 | 292 | } |
@@ -200,8 +200,8 @@ discard block |
||
| 200 | 200 | } else { |
| 201 | 201 | $sql = ''; |
| 202 | 202 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 203 | - $sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity"; |
|
| 204 | - $sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity); |
|
| 203 | + $sql_exists = "SELECT rowid FROM ".MAIN_DB_PREFIX."product_perentity"; |
|
| 204 | + $sql_exists .= " WHERE fk_product = ".((int) $productid)." AND entity = ".((int) $conf->entity); |
|
| 205 | 205 | $resql_exists = $db->query($sql_exists); |
| 206 | 206 | if (!$resql_exists) { |
| 207 | 207 | $msg .= '<div><span class="error">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>'; |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | $nb_exists = $db->num_rows($resql_exists); |
| 211 | 211 | if ($nb_exists <= 0) { |
| 212 | 212 | // insert |
| 213 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")"; |
|
| 214 | - $sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')"; |
|
| 213 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_perentity (fk_product, entity, ".$db->escape($accountancy_field_name).")"; |
|
| 214 | + $sql .= " VALUES (".((int) $productid).", ".((int) $conf->entity).", '".$db->escape($accounting->account_number)."')"; |
|
| 215 | 215 | } else { |
| 216 | 216 | $obj_exists = $db->fetch_object($resql_exists); |
| 217 | 217 | // update |
| 218 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "product_perentity"; |
|
| 219 | - $sql .= " SET " . $accountancy_field_name . " = '" . $db->escape($accounting->account_number) . "'"; |
|
| 220 | - $sql .= " WHERE rowid = " . ((int) $obj_exists->rowid); |
|
| 218 | + $sql = "UPDATE ".MAIN_DB_PREFIX."product_perentity"; |
|
| 219 | + $sql .= " SET ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'"; |
|
| 220 | + $sql .= " WHERE rowid = ".((int) $obj_exists->rowid); |
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | } else { |
@@ -320,17 +320,17 @@ discard block |
||
| 320 | 320 | $sql .= " aa.rowid as aaid"; |
| 321 | 321 | $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; |
| 322 | 322 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
| 323 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 324 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ppe." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; |
|
| 323 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 324 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.account_number = ppe.".$accountancy_field_name." AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; |
|
| 325 | 325 | } else { |
| 326 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; |
|
| 326 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.account_number = p.".$accountancy_field_name." AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; |
|
| 327 | 327 | } |
| 328 | 328 | if (!empty($searchCategoryProductList)) { |
| 329 | 329 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ |
| 330 | 330 | } |
| 331 | 331 | $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
| 332 | 332 | if (strlen(trim($search_current_account))) { |
| 333 | - $sql .= natural_search((!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p." : "ppe.") . $accountancy_field_name, $search_current_account); |
|
| 333 | + $sql .= natural_search((!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p." : "ppe.").$accountancy_field_name, $search_current_account); |
|
| 334 | 334 | } |
| 335 | 335 | if ($search_current_account_valid == 'withoutvalidaccount') { |
| 336 | 336 | $sql .= " AND aa.account_number IS NULL"; |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); |
| 515 | 515 | |
| 516 | 516 | if ($massaction == 'set_default_account') { |
| 517 | - $formquestion[]=array('type' => 'other', |
|
| 517 | + $formquestion[] = array('type' => 'other', |
|
| 518 | 518 | 'name' => 'set_default_account', |
| 519 | 519 | 'label' => $langs->trans("AccountancyCode"), |
| 520 | 520 | 'value' => $form->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone')); |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | } else { |
| 615 | 615 | print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); |
| 616 | 616 | } |
| 617 | - print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p." : "ppe.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder); |
|
| 617 | + print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') ? "p." : "ppe.").$accountancy_field_name, "", $param, '', $sortfield, $sortorder); |
|
| 618 | 618 | print_liste_field_titre("AssignDedicatedAccountingAccount"); |
| 619 | 619 | // Action column |
| 620 | 620 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 56 | 56 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 57 | 57 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 58 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 58 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 59 | 59 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 60 | 60 | |
| 61 | 61 | // Load variable for pagination |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $i++; |
| 437 | 437 | } |
| 438 | 438 | if ($num_lines == 0) { |
| 439 | - $colspan=10; |
|
| 439 | + $colspan = 10; |
|
| 440 | 440 | if (getDolGlobalString('ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE')) { |
| 441 | 441 | $colspan++; |
| 442 | 442 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $filename = 'journal'; |
| 134 | 134 | $type_export = 'journal'; |
| 135 | 135 | |
| 136 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 136 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 137 | 137 | include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; |
| 138 | 138 | |
| 139 | 139 | print $result; |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // Must reload data, so we make a redirect |
| 147 | 147 | if ($reload) { |
| 148 | - $param = 'id_journal=' . $id_journal; |
|
| 149 | - $param .= '&date_startday=' . $date_startday; |
|
| 150 | - $param .= '&date_startmonth=' . $date_startmonth; |
|
| 151 | - $param .= '&date_startyear=' . $date_startyear; |
|
| 152 | - $param .= '&date_endday=' . $date_endday; |
|
| 153 | - $param .= '&date_endmonth=' . $date_endmonth; |
|
| 154 | - $param .= '&date_endyear=' . $date_endyear; |
|
| 155 | - $param .= '&in_bookkeeping=' . $in_bookkeeping; |
|
| 156 | - header("Location: " . $_SERVER['PHP_SELF'] . ($param ? '?' . $param : '')); |
|
| 148 | + $param = 'id_journal='.$id_journal; |
|
| 149 | + $param .= '&date_startday='.$date_startday; |
|
| 150 | + $param .= '&date_startmonth='.$date_startmonth; |
|
| 151 | + $param .= '&date_startyear='.$date_startyear; |
|
| 152 | + $param .= '&date_endday='.$date_endday; |
|
| 153 | + $param .= '&date_endmonth='.$date_endmonth; |
|
| 154 | + $param .= '&date_endyear='.$date_endyear; |
|
| 155 | + $param .= '&in_bookkeeping='.$in_bookkeeping; |
|
| 156 | + header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : '')); |
|
| 157 | 157 | exit; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $account_accounting_not_defined = false; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | -$title = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 2, 1, '', 1); |
|
| 188 | +$title = $langs->trans("GenerationOfAccountingEntries").' - '.$object->getNomUrl(0, 2, 1, '', 1); |
|
| 189 | 189 | |
| 190 | 190 | llxHeader('', dol_string_nohtmltag($title)); |
| 191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $periodlink = ''; |
| 195 | 195 | $exportlink = ''; |
| 196 | 196 | $builddate = dol_now(); |
| 197 | -$description = $langs->trans("DescJournalOnlyBindedVisible") . '<br>'; |
|
| 197 | +$description = $langs->trans("DescJournalOnlyBindedVisible").'<br>'; |
|
| 198 | 198 | if ($object->nature == 2 || $object->nature == 3) { |
| 199 | 199 | if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) { |
| 200 | 200 | $description .= $langs->trans("DepositsAreNotIncluded"); |
@@ -207,47 +207,47 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | $listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger")); |
| 210 | -$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); |
|
| 211 | -$period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
| 210 | +$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); |
|
| 211 | +$period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1); |
|
| 212 | 212 | |
| 213 | -$varlink = 'id_journal=' . $id_journal; |
|
| 213 | +$varlink = 'id_journal='.$id_journal; |
|
| 214 | 214 | |
| 215 | 215 | journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); |
| 216 | 216 | |
| 217 | 217 | if ($object->nature == 4) { // Bank journal |
| 218 | 218 | // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) |
| 219 | 219 | $sql = "SELECT COUNT(rowid) as nb"; |
| 220 | - $sql .= " FROM " . MAIN_DB_PREFIX . "bank_account"; |
|
| 221 | - $sql .= " WHERE entity = " . (int) $conf->entity; |
|
| 220 | + $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; |
|
| 221 | + $sql .= " WHERE entity = ".(int) $conf->entity; |
|
| 222 | 222 | $sql .= " AND fk_accountancy_journal IS NULL"; |
| 223 | 223 | $sql .= " AND clos=0"; |
| 224 | 224 | $resql = $db->query($sql); |
| 225 | 225 | if ($resql) { |
| 226 | 226 | $obj = $db->fetch_object($resql); |
| 227 | 227 | if ($obj->nb > 0) { |
| 228 | - print '<br>' . img_warning() . ' ' . $langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); |
|
| 229 | - print ' : ' . $langs->trans("AccountancyAreaDescBank", 9, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("BankAccounts") . '</strong>'); |
|
| 228 | + print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); |
|
| 229 | + print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>'); |
|
| 230 | 230 | } |
| 231 | 231 | } else dol_print_error($db); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // Button to write into Ledger |
| 235 | 235 | if ($some_mandatory_steps_of_setup_were_not_done) { |
| 236 | - print '<br><div class="warning">' . img_warning() . ' ' . $langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); |
|
| 237 | - print ' : ' . $langs->trans("AccountancyAreaDescMisc", 4, '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>'); |
|
| 236 | + print '<br><div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); |
|
| 237 | + print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); |
|
| 238 | 238 | print '</div>'; |
| 239 | 239 | } |
| 240 | 240 | print '<div class="tabsAction tabsActionNoBottom centerimp">'; |
| 241 | 241 | if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL') && $in_bookkeeping == 'notyet') { |
| 242 | - print '<input type="button" class="butAction" name="exportcsv" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />'; |
|
| 242 | + print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; |
|
| 243 | 243 | } |
| 244 | 244 | if ($account_accounting_not_defined) { |
| 245 | - print '<input type="button" class="butActionRefused classfortooltip" title="' . dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")) . '" value="' . $langs->trans("WriteBookKeeping") . '" />'; |
|
| 245 | + print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; |
|
| 246 | 246 | } else { |
| 247 | 247 | if ($in_bookkeeping == 'notyet') { |
| 248 | - print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; |
|
| 248 | + print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; |
|
| 249 | 249 | } else { |
| 250 | - print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">' . $langs->trans("WriteBookKeeping") . '</a>'; |
|
| 250 | + print '<a href="#" class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | print '</div>'; |
@@ -281,14 +281,14 @@ discard block |
||
| 281 | 281 | print '<div class="div-table-responsive">'; |
| 282 | 282 | print '<table class="noborder centpercent">'; |
| 283 | 283 | print '<tr class="liste_titre">'; |
| 284 | -print '<td>' . $langs->trans("Date") . '</td>'; |
|
| 285 | -print '<td>' . $langs->trans("Piece") . ' (' . $object_label . ')</td>'; |
|
| 286 | -print '<td>' . $langs->trans("AccountAccounting") . '</td>'; |
|
| 287 | -print '<td>' . $langs->trans("SubledgerAccount") . '</td>'; |
|
| 288 | -print '<td>' . $langs->trans("LabelOperation") . '</td>'; |
|
| 289 | -if ($object->nature == 4) print '<td class="center">' . $langs->trans("PaymentMode") . '</td>'; // bank |
|
| 290 | -print '<td class="right">' . $langs->trans("AccountingDebit") . '</td>'; |
|
| 291 | -print '<td class="right">' . $langs->trans("AccountingCredit") . '</td>'; |
|
| 284 | +print '<td>'.$langs->trans("Date").'</td>'; |
|
| 285 | +print '<td>'.$langs->trans("Piece").' ('.$object_label.')</td>'; |
|
| 286 | +print '<td>'.$langs->trans("AccountAccounting").'</td>'; |
|
| 287 | +print '<td>'.$langs->trans("SubledgerAccount").'</td>'; |
|
| 288 | +print '<td>'.$langs->trans("LabelOperation").'</td>'; |
|
| 289 | +if ($object->nature == 4) print '<td class="center">'.$langs->trans("PaymentMode").'</td>'; // bank |
|
| 290 | +print '<td class="right">'.$langs->trans("AccountingDebit").'</td>'; |
|
| 291 | +print '<td class="right">'.$langs->trans("AccountingCredit").'</td>'; |
|
| 292 | 292 | print "</tr>\n"; |
| 293 | 293 | |
| 294 | 294 | if (is_array($journal_data) && !empty($journal_data)) { |
@@ -296,14 +296,14 @@ discard block |
||
| 296 | 296 | foreach ($element['blocks'] as $lines) { |
| 297 | 297 | foreach ($lines as $line) { |
| 298 | 298 | print '<tr class="oddeven">'; |
| 299 | - print '<td>' . $line['date'] . '</td>'; |
|
| 300 | - print '<td>' . $line['piece'] . '</td>'; |
|
| 301 | - print '<td>' . $line['account_accounting'] . '</td>'; |
|
| 302 | - print '<td>' . $line['subledger_account'] . '</td>'; |
|
| 303 | - print '<td>' . $line['label_operation'] . '</td>'; |
|
| 304 | - if ($object->nature == 4) print '<td class="center">' . $line['payment_mode'] . '</td>'; |
|
| 305 | - print '<td class="right nowraponall">' . $line['debit'] . '</td>'; |
|
| 306 | - print '<td class="right nowraponall">' . $line['credit'] . '</td>'; |
|
| 299 | + print '<td>'.$line['date'].'</td>'; |
|
| 300 | + print '<td>'.$line['piece'].'</td>'; |
|
| 301 | + print '<td>'.$line['account_accounting'].'</td>'; |
|
| 302 | + print '<td>'.$line['subledger_account'].'</td>'; |
|
| 303 | + print '<td>'.$line['label_operation'].'</td>'; |
|
| 304 | + if ($object->nature == 4) print '<td class="center">'.$line['payment_mode'].'</td>'; |
|
| 305 | + print '<td class="right nowraponall">'.$line['debit'].'</td>'; |
|
| 306 | + print '<td class="right nowraponall">'.$line['credit'].'</td>'; |
|
| 307 | 307 | print '</tr>'; |
| 308 | 308 | |
| 309 | 309 | $i++; |