31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeeping.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/lettering.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeepingtemplate.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeepingtemplateline.class.php';
53$langs->loadLangs(array(
"accountancy",
"bills",
"compta"));
55$action =
GETPOST(
'action',
'aZ09');
56$cancel =
GETPOST(
'cancel',
'alpha');
57$confirm =
GETPOST(
'confirm',
'alpha');
59$type =
GETPOST(
'type',
'alpha');
60$backtopage =
GETPOST(
'backtopage',
'alpha');
61if (empty($backtopage)) {
62 $backtopage = DOL_URL_ROOT .
'/accountancy/bookkeeping/list.php';
65$optioncss =
GETPOST(
'optioncss',
'aZ');
75$accountingaccount_number =
GETPOST(
'accountingaccount_number',
'alphanohtml');
76$accountingaccount->fetch(0, $accountingaccount_number,
true);
77$accountingaccount_label = $accountingaccount->label;
79$journal_code =
GETPOST(
'code_journal',
'alpha');
80$accountingjournal->fetch(0, $journal_code);
81$journal_label = $accountingjournal->label;
83$subledger_account =
GETPOST(
'subledger_account',
'alphanohtml');
84if ($subledger_account == -1) {
85 $subledger_account =
null;
87$subledger_label =
GETPOST(
'subledger_label',
'alphanohtml');
89$label_operation =
GETPOST(
'label_operation',
'alphanohtml');
93$save =
GETPOST(
'save',
'alpha');
97$update =
GETPOST(
'update',
'alpha');
99 $action =
'confirm_update';
103$hookmanager->initHooks(array(
'bookkeepingcard',
'globalcard'));
111if ($user->socid > 0) {
114if (!$user->hasRight(
'accounting',
'mouvements',
'lire')) {
118$permissiontoadd = $user->hasRight(
'accounting',
'mouvements',
'creer');
119$permissiontodelete = $user->hasRight(
'accounting',
'mouvements',
'supprimer');
120$caneditalllabels = 0;
127$parameters = array();
128$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
130 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
132if (empty($reshook)) {
136 header(
"Location: ". $backtopage . (!empty($type) ?
'?type=sub' :
''));
140 if ($action ==
"confirm_update" && $permissiontoadd) {
141 if (((
float) $debit != 0.0) && ((
float) $credit != 0.0)) {
143 setEventMessages($langs->trans(
'ErrorDebitCredit'),
null,
'errors');
146 if (empty($accountingaccount_number) || $accountingaccount_number ==
'-1') {
148 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"AccountAccountingShort")),
null,
'errors');
155 $result =
$object->fetch($id,
null, $mode);
160 $object->numero_compte = $accountingaccount_number;
161 $object->subledger_account = $subledger_account;
162 $object->subledger_label = $subledger_label;
163 $object->label_compte = $accountingaccount_label;
164 $object->label_operation = $label_operation;
168 if ((
float) $debit != 0.0) {
173 if ((
float) $credit != 0.0) {
179 $result =
$object->update($user, 0, $mode);
183 if ($mode !=
'_tmp') {
184 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
194 } elseif ($action ==
"add" && $permissiontoadd) {
195 if (((
float) $debit != 0.0) && ((
float) $credit != 0.0)) {
197 setEventMessages($langs->trans(
'ErrorDebitCredit'),
null,
'errors');
200 if (empty($accountingaccount_number) || $accountingaccount_number ==
'-1') {
202 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"AccountAccountingShort")),
null,
'errors');
205 $subledger_account_str = is_array($subledger_account) ? reset($subledger_account) : (string) $subledger_account;
208 setEventMessages($langs->trans(
"ErrorAccountNotCentralized").
". " . $langs->trans(
"RemoveSubsidiaryAccountOrAdjustTheGeneralAccount"),
null,
'errors');
220 $object->numero_compte = $accountingaccount_number;
221 $object->subledger_account = $subledger_account;
222 $object->subledger_label = $subledger_label;
223 $object->label_compte = $accountingaccount_label;
224 $object->label_operation = $label_operation;
229 $object->piece_num = $piece_num;
232 $object->code_journal = $journal_code;
233 $object->journal_label = $journal_label;
237 if ((
float) $debit != 0.0) {
243 if ((
float) $credit != 0.0) {
249 $result =
$object->createStd($user, 0, $mode);
254 if ($mode !=
'_tmp') {
255 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
264 } elseif ($action ==
"confirm_delete" && $permissiontoadd) {
267 $result =
$object->fetch($id,
null, $mode);
268 $piece_num = (int)
$object->piece_num;
273 } elseif ($result > 0) {
275 $result =
$object->delete($user, 0, $mode);
281 } elseif ($action ==
"confirm_create" && $permissiontoadd) {
284 if (!$journal_code || $journal_code ==
'-1') {
285 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
"Journal")),
null,
'errors');
289 if (!
GETPOST(
'doc_ref',
'alpha')) {
290 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Piece")),
null,
'errors');
295 $langs->load(
'errors');
296 setEventMessages($langs->trans(
"ErrorFieldTooLong", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
311 $object->code_journal = $journal_code;
312 $object->journal_label = $journal_label;
319 $result =
$object->createStd($user, 0, $mode);
327 $piece_num =
$object->piece_num;
332 if ($template_id > 0) {
333 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeepingtemplate.class.php';
334 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeepingtemplateline.class.php';
337 $result_template = $template->fetch($template_id);
339 if ($result_template > 0 && !empty($template->lines)) {
343 foreach ($template->lines as $templateline) {
348 $bookkeeping->doc_type =
GETPOST(
'doctype',
'alpha');
349 $bookkeeping->piece_num = $piece_num;
350 $bookkeeping->doc_ref =
GETPOST(
'docref',
'alpha');
351 $bookkeeping->code_journal = $journal_code;
352 $bookkeeping->journal_label = $journal_label;
353 $bookkeeping->fk_doc = 0;
354 $bookkeeping->fk_docdet = 0;
358 $bookkeeping->numero_compte = $templateline->general_account;
359 $bookkeeping->label_compte = $templateline->general_label;
360 $bookkeeping->subledger_account = $templateline->subledger_account;
361 $bookkeeping->subledger_label = $templateline->subledger_label;
362 $bookkeeping->label_operation = $templateline->operation_label;
363 $bookkeeping->debit = (float) $templateline->debit;
364 $bookkeeping->credit = (float) $templateline->credit;
367 if ((
float) $bookkeeping->debit != 0.0) {
368 $bookkeeping->montant = $bookkeeping->debit;
369 $bookkeeping->amount = $bookkeeping->debit;
370 $bookkeeping->sens =
'D';
372 if ((
float) $bookkeeping->credit != 0.0) {
373 $bookkeeping->montant = $bookkeeping->credit;
374 $bookkeeping->amount = $bookkeeping->credit;
375 $bookkeeping->sens =
'C';
378 $result_line = $bookkeeping->createStd($user, 0,
'_tmp');
380 if ($result_line < 0) {
382 setEventMessages($bookkeeping->error, $bookkeeping->errors,
'errors');
387 if (!$error_template) {
389 setEventMessages($langs->trans(
'TemplateLinesLoaded', count($template->lines)),
null,
'mesgs');
397 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?piece_num=".$piece_num.
"&mode=_tmp");
404 if ($action ==
'confirm_setalllabels' && $confirm ==
'yes' && $permissiontoadd) {
405 if ($_SERVER[
'REQUEST_METHOD'] !==
'POST') {
409 $newlabeloperation = trim(
GETPOST(
'labeloperationforalllines',
'alphanohtml'));
411 if ($newlabeloperation ===
'') {
412 setEventMessages($langs->trans(
'ErrorFieldRequired', $langs->transnoentitiesnoconv(
'LabelOperation')),
null,
'errors');
417 $result = $bookkeepinglabels->fetchAllPerMvt($piece_num, $mode);
421 setEventMessages($bookkeepinglabels->error, $bookkeepinglabels->errors,
'errors');
422 } elseif (empty($bookkeepinglabels->linesmvt)) {
424 setEventMessages($langs->trans(
'NoRecordFound'),
null,
'errors');
427 foreach ($bookkeepinglabels->linesmvt as $bookkeepingline) {
428 if (!empty($bookkeepingline->date_validation)) {
430 setEventMessages($langs->trans(
'ForbiddenTransactionAlreadyValidated'),
null,
'errors');
434 if (!empty($bookkeepingline->date_export)) {
436 setEventMessages($langs->trans(
'ForbiddenTransactionAlreadyExported'),
null,
'errors');
443 $result = $bookkeepinglabels->updateByMvt($piece_num,
'label_operation', $newlabeloperation, $mode);
447 setEventMessages($bookkeepinglabels->error, $bookkeepinglabels->errors,
'errors');
456 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
458 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?piece_num='.(
int) $piece_num.
'&mode='.urlencode($mode).
'&type='.urlencode($type).
'&backtopage='.urlencode($backtopage));
466 if ($action ==
'setdate' && $permissiontoadd) {
468 $result =
$object->updateByMvt($piece_num,
'doc_date', $db->idate($datedoc), $mode);
472 if ($mode !=
'_tmp') {
473 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
479 if ($action ==
'setjournal' && $permissiontoadd) {
480 $result =
$object->updateByMvt($piece_num,
'code_journal', $journal_code, $mode);
481 $result =
$object->updateByMvt($piece_num,
'journal_label', $journal_label, $mode);
485 if ($mode !=
'_tmp') {
486 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
492 if ($action ==
'setdocref' && $permissiontoadd) {
493 $refdoc =
GETPOST(
'doc_ref',
'alpha');
494 $result =
$object->updateByMvt($piece_num,
'doc_ref', $refdoc, $mode);
498 if ($mode !=
'_tmp') {
499 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
505 if ($action ==
'setref' && $permissiontoadd && $numRefModel ===
'mod_bookkeeping_neon') {
506 $newref =
GETPOST(
'ref',
'alpha');
508 $langs->load(
'errors');
510 $object->error = $langs->trans(
"ErrorFieldTooLong", $langs->transnoentitiesnoconv(
"Ref"));
513 $result =
$object->updateByMvt($piece_num,
'ref', $newref, $mode);
518 if ($mode !=
'_tmp') {
519 setEventMessages($langs->trans(
'RecordSaved'),
null,
'mesgs');
526 if ($action ==
'valid' && $permissiontoadd) {
527 $result =
$object->transformTransaction(0, $piece_num);
532 $piece_num =
$object->piece_num;
534 $linkEntry =
'<a href="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.(int) $piece_num.
'">'.$langs->trans(
'NumMvts').
': '.(int) $piece_num.
'</a>';
535 setEventMessages($langs->trans(
'RecordSaved').
' - '.$linkEntry,
null,
'mesgs',
'', 1);
539 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?piece_num=".(
int) $piece_num);
542 header(
"Location: ".$backtopage.
"?sortfield=t.piece_num&sortorder=asc".($type ?
'&type='.$type :
''));
549 $toselect_str = explode(
',',
GETPOST(
'toselect',
'alphanohtml'));
551 foreach ($toselect_str as $i) {
552 $toselect[] = (int) $i;
555 if ($action ==
'deletebookkeepingwriting' && $confirm ==
"yes" && $permissiontodelete) {
560 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect,
true);
561 if ($nb_lettering < 0) {
562 setEventMessages(
'', $lettering->errors,
'errors');
570 foreach ($toselect as $toselectid) {
571 $result =
$object->fetch($toselectid);
572 if ($result >= 0 && (!isset(
$object->date_validation) ||
$object->date_validation ===
'')) {
581 } elseif ($result < 0) {
585 } elseif (isset(
$object->date_validation) &&
$object->date_validation !=
'') {
586 setEventMessages($langs->trans(
"ValidatedRecordWhereFound"),
null,
'errors');
598 setEventMessages($langs->trans(
"RecordsDeleted", $nbok),
null,
'mesgs');
599 } elseif ($nbok > 0) {
600 setEventMessages($langs->trans(
"RecordDeleted", $nbok),
null,
'mesgs');
602 setEventMessages($langs->trans(
"NoRecordDeleted"),
null,
'mesgs');
605 header(
"Location: ".DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?noreset=1');
612 if ($action ==
'clonebookkeepingwriting' && $confirm ==
"yes" && $permissiontoadd) {
614 $piece_num =
GETPOST(
'piece_num',
'alpha');
615 $journal_code =
GETPOST(
'code_journal',
'alpha');
620 $result =
$object->newClone($piece_num, $journal_code, $clonedate);
629 header(
"Location: " . $_SERVER[
'PHP_SELF'] .
"?piece_num=" . (
$object->getNextNumMvt() - 1));
643$form =
new Form($db);
646$title = $langs->trans(
"CreateMvts");
647$help_url =
'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilité_en_Partie_Double';
649llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-accountancy accountancy-consultation page-card');
652if ($action ==
'delete') {
653 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$id.
'&mode='.$mode, $langs->trans(
'DeleteMvt'), $langs->trans(
'ConfirmDeleteMvt', $langs->transnoentitiesnoconv(
"RegistrationInAccounting")),
'confirm_delete',
'', 0, 1);
658if (!empty(
$conf->use_javascript_ajax)) {
659 print
"\n" .
'<script type="text/javascript">';
660 print
'$(document).ready(function () {
661 function toggleSubledger() {
662 var isCentral = $("#accountingaccount_number option:selected").data("centralized");
663 console.log("the selected general ledger account is centralised?", isCentral);
665 var isAjaxMode = $("#search_subledger_account").length > 0;
666 var $visibleSubledger = isAjaxMode
667 ? $("#search_subledger_account")
668 : $("#subledger_account");
671 $visibleSubledger.prop("disabled", false);
673 $("#subledger_account").prop("disabled", false).trigger("change");
675 $("#subledger_label").prop("disabled", false);
677 $visibleSubledger.prop("disabled", true).val("");
679 $("#subledger_account").val("").prop("disabled", true).trigger("change");
681 $("#subledger_account").val("");
683 $("#subledger_label").val("").prop("disabled", true);
689 $("#accountingaccount_number").on("change", toggleSubledger);
690 $("#accountingaccount_number").on("select2:select", toggleSubledger);
693 print
' </script>' .
"\n";
696if ($action ==
'create') {
700 $next_num_mvt =
$object->getNextNumMvt(
'_tmp');
702 if (empty($next_num_mvt)) {
703 dol_print_error(
null,
'Failed to get next piece number');
706 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="create_mvt" method="POST">';
707 if ($optioncss !=
'') {
708 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
710 print
'<input type="hidden" name="token" value="'.newToken().
'">';
711 print
'<input type="hidden" name="action" value="confirm_create">'.
"\n";
712 print
'<input type="hidden" name="next_num_mvt" value="'.$next_num_mvt.
'">'.
"\n";
713 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
714 print
'<input type="hidden" name="type" value="'.$type.
'">';
715 print
'<input type="hidden" name="mode" value="_tmp">'.
"\n";
719 print
'<table class="border centpercent">';
722 print
'<td class="fieldrequired">'.$langs->trans(
"Docdate").
'</td>';
724 print $form->selectDate(
'',
'doc_date', 0, 0, 0,
"create_mvt", 1, 1);
729 print
'<td class="fieldrequired">'.$langs->trans(
"Codejournal").
'</td>';
730 print
'<td>'.$formaccounting->select_journal($journal_code,
'code_journal', 0, 0, 1, 1).
'</td>';
734 print
'<td class="fieldrequired">'.$form->textwithpicto($langs->trans(
"Piece"), $langs->trans(
"PieceDesc")).
'</td>';
735 print
'<td><input type="text" class="minwidth200" name="doc_ref" value="'.GETPOST(
'doc_ref',
'alpha').
'"></td>';
740 print
'<td>'.$form->textwithpicto($langs->trans(
"Ref"), $langs->trans(
"BankTransactionRef")).
'</td>';
742 if ($numRefModel ===
'mod_bookkeeping_neon') {
743 print
'<input type="text" class="minwidth200" name="ref" maxlength="30" value="">';
745 print
'<span class="opacitymedium">'.$langs->trans(
"Automatic").
'</span>';
751 print
'<td>'.$langs->trans(
"BookkeepingTemplate").
'</td>';
753 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/bookkeepingtemplate.class.php';
755 $sql =
"SELECT rowid, code, label";
756 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_transaction_template";
757 $sql .=
" WHERE entity IN (".getEntity(
'accounting').
")";
758 $sql .=
" ORDER BY code ASC";
760 $resql = $db->query($sql);
761 $templates = array();
764 $num = $db->num_rows($resql);
767 $obj = $db->fetch_object($resql);
768 $templates[$obj->rowid] = $obj->code.
' - '.$obj->label;
774 if (count($templates) > 0) {
775 print
'<select class="flat minwidth300" name="template_id" id="template_id">';
776 print
'<option value=""></option>';
777 foreach ($templates as $key => $label) {
782 print
'<span class="opacitymedium">'.$langs->trans(
"NoTemplateAvailable").
'</span>';
788 $reshookAddLine = $hookmanager->executeHooks(
'bookkeepingAddLine', $parameters, $object, $action);
794 print $form->buttonsSaveCancel(
"Create");
800 $result =
$object->fetchPerMvt($piece_num, $mode);
805 if (!empty(
$object->piece_num)) {
806 $backlink =
'<a href="'.DOL_URL_ROOT.
'/accountancy/bookkeeping/list.php?restore_lastsearch_values=1">'.$langs->trans(
'BackToList').
'</a>';
819 if ($mode ==
'_tmp') {
820 $object->context[
'mode'] = $mode;
821 $object->next_prev_filter =
'1=0';
825 $morehtmlref =
'<div style="clear: both;"></div>';
826 $morehtmlref .=
'<div class="refidno opacitymedium">';
827 $morehtmlref .=
$object->label;
828 $morehtmlref .=
'</div>';
830 dol_banner_tab($object,
'ref', $backlink, 1,
'piece_num',
'piece_num', $morehtmlref);
833 if ($action ==
'clonebookkeepingwriting' && $confirm !=
'yes' && $permissiontoadd) {
834 $piece_num =
GETPOST(
'piece_num',
'alpha');
837 $form =
new Form($db);
838 $input1 = $form->selectDate(
'',
'clonedate', 0, 0, 0,
"", 1, 1);
839 $input2 = $formaccounting->select_journal($journal_code,
'code_journal', 0, 0, 1, 1);
841 $formquestion = array(
844 'name' =>
'clonedate',
845 'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Docdate") .
'</span>',
850 $formquestion[] = array(
'type' =>
'hidden',
'name' =>
'piece_num',
'value' => $piece_num);
853 $formquestion[] = array(
855 'name' =>
'code_journal',
856 'label' =>
'<span class="fieldrequired">' . $langs->trans(
"Codejournal") .
'</span>',
861 print $form->formconfirm(
862 $_SERVER[
"PHP_SELF"],
863 $langs->trans(
"ConfirmMassCloneBookkeepingWriting"),
864 $langs->trans(
"ConfirmMassCloneBookkeepingWritingQuestion", 1),
865 "clonebookkeepingwriting",
872 print
'<div class="fichecenter">';
874 print
'<div class="fichehalfleft">';
876 print
'<div class="underbanner clearboth"></div>';
877 print
'<table class="border tableforfield centpercent">';
888 print
'<tr><td class="titlefieldmiddle">';
889 print
'<table class="nobordernopadding centpercent"><tr><td>';
890 print $langs->trans(
'Ref');
892 if ($action !=
'editref' && empty(
$object->date_validation)) {
893 print
'<td class="right">';
894 if ($permissiontoadd && $numRefModel ===
'mod_bookkeeping_neon') {
895 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editref&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a>';
899 print
'</tr></table>';
901 if ($action ==
'editref' && empty(
$object->date_validation)) {
902 print
'<form name="setref" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
903 if ($optioncss !=
'') {
904 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
906 print
'<input type="hidden" name="token" value="'.newToken().
'">';
907 print
'<input type="hidden" name="action" value="setref">';
908 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
909 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
910 print
'<input type="hidden" name="type" value="'.$type.
'">';
911 print
'<input type="text" size="20" name="ref" maxlength="30" value="'.dol_escape_htmltag(
$object->ref).
'">';
912 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
922 print
'<table class="nobordernopadding centpercent"><tr><td>';
923 print $form->textwithpicto($langs->trans(
'Piece'), $langs->trans(
'PieceDesc'));
925 if ($action !=
'editdocref') {
926 print
'<td class="right">';
927 if ($permissiontoadd && empty(
$object->date_validation)) {
928 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdocref&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a>';
932 print
'</tr></table>';
934 if ($action ==
'editdocref' && empty(
$object->date_validation)) {
935 print
'<form name="setdocref" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
936 if ($optioncss !=
'') {
937 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
939 print
'<input type="hidden" name="token" value="'.newToken().
'">';
940 print
'<input type="hidden" name="action" value="setdocref">';
941 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
942 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
943 print
'<input type="hidden" name="type" value="'.$type.
'">';
944 print
'<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag(
$object->doc_ref).
'">';
945 print
'<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans(
'Modify').
'">';
949 if (
$object->doc_type ===
'customer_invoice' && !empty(
$object->fk_doc)) {
950 $invoicestatic =
new Facture($db);
951 $result = $invoicestatic->fetch(
$object->fk_doc);
954 $label_element = $invoicestatic->getNomUrl(1);
956 $label_element =
$object->doc_ref;
958 } elseif (
$object->doc_type ===
'supplier_invoice' && !empty(
$object->fk_doc)) {
960 $result = $supplierinvoicestatic->fetch(
$object->fk_doc);
963 $label_element = $supplierinvoicestatic->getNomUrl(1);
965 $label_element =
$object->doc_ref;
967 } elseif (
$object->doc_type ===
'expense_report' && !empty(
$object->fk_doc)) {
969 $result = $expensereportstatic->fetch(
$object->fk_doc);
972 $label_element = $expensereportstatic->getNomUrl(1);
974 $label_element =
$object->doc_ref;
977 $label_element =
$object->doc_ref;
979 print $label_element;
986 print
'<table class="nobordernopadding centpercent"><tr><td>';
987 print $langs->trans(
'Docdate');
989 if ($action !=
'editdate') {
990 print
'<td class="right">';
991 if ($permissiontoadd && empty(
$object->date_validation)) {
992 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetDate'), 1).
'</a>';
996 print
'</tr></table>';
997 print
'</td><td colspan="3">';
998 if ($action ==
'editdate' && empty(
$object->date_validation)) {
999 print
'<form name="setdate" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
1000 if ($optioncss !=
'') {
1001 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1003 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1004 print
'<input type="hidden" name="action" value="setdate">';
1005 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1006 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1007 print
'<input type="hidden" name="type" value="'.$type.
'">';
1008 print $form->selectDate(
$object->doc_date ?
$object->doc_date : -1,
'doc_date', 0, 0, 0,
"setdate");
1009 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1019 print
'<table class="nobordernopadding centpercent"><tr><td>';
1020 print $langs->trans(
'Codejournal');
1022 if ($action !=
'editjournal') {
1023 print
'<td class="right">';
1024 if ($permissiontoadd && empty(
$object->date_validation)) {
1025 print
'<a class="editfielda reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=editjournal&token='.
newToken().
'&piece_num='.((int)
$object->piece_num).
'&mode='.urlencode((
string) $mode).
'">'.img_edit($langs->transnoentitiesnoconv(
'Edit'), 1).
'</a>';
1029 print
'</tr></table>';
1031 if ($action ==
'editjournal' && empty(
$object->date_validation)) {
1032 print
'<form name="setjournal" action="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).
'" method="POST">';
1033 if ($optioncss !=
'') {
1034 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1036 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1037 print
'<input type="hidden" name="action" value="setjournal">';
1038 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1039 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
1040 print
'<input type="hidden" name="type" value="'.$type.
'">';
1041 print $formaccounting->select_journal(
$object->code_journal,
'code_journal', 0, 0, 0, 1,
'');
1042 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
1047 $accountingjournalstatic->fetch(0,
$object->code_journal);
1048 $journal = $accountingjournalstatic->code;
1049 $journal_label = $accountingjournalstatic->label;
1051 print $accountingjournalstatic->getNomUrl(1, 1, 1);
1061 print
'<div class="fichehalfright">';
1063 print
'<div class="underbanner clearboth"></div>';
1064 print
'<table class="border tableforfield centpercent">';
1067 if (!empty(
$object->doc_type)) {
1069 print
'<td class="titlefield">'.$langs->trans(
"Doctype").
'</td>';
1070 print
'<td>'.$object->doc_type.
'</td>';
1076 print
'<td class="titlefield">'.$langs->trans(
"DateCreation").
'</td>';
1085 print
'<td class="titlefield">' . $form->textwithpicto($langs->trans(
'DateDue'), $langs->trans(
"IfTransactionHasDueDate")) .
'</td>';
1093 if ($mode !=
"_tmp") {
1096 print
'<td class="titlefield">' . $langs->trans(
"DateExport") .
'</td>';
1098 print
$object->date_export ? img_picto($langs->trans(
"TransactionExportDesc"),
'fa-file-export',
'class="pictofixedwidth opacitymedium"').dol_print_date(
$object->date_export,
'dayhour') :
' ';
1104 print
'<td class="titlefield">' . $langs->trans(
"DateValidation") .
'</td>';
1106 print
$object->date_validation ? img_picto($langs->trans(
"TransactionBlockedLockedDesc"),
'fa-lock',
'class="pictofixedwidth opacitymedium"').dol_print_date(
$object->date_validation,
'dayhour') :
' ';
1111 if (!empty(
$object->import_key)) {
1113 print
'<td class="titlefield">' . $langs->trans(
"ImportId") .
'</td>';
1166 print
'<div class="clearboth"></div>';
1172 $result =
$object->fetchAllPerMvt($piece_num, $mode);
1178 $tmptoselect = array();
1179 $atleastonevalidated = 0;
1180 $atleastoneexported = 0;
1181 foreach (
$object->linesmvt as $line) {
1182 $tmptoselect[] = $line->id;
1183 if (!empty($line->date_validation)) {
1184 $atleastonevalidated = 1;
1186 if (!empty($line->date_export) || !empty($line->date_validation)) {
1187 $atleastoneexported = 1;
1191 if ($mode !=
'_tmp' && !$atleastonevalidated) {
1192 print
"\n".
'<div class="tabsAction">'.
"\n";
1194 $parameters = array();
1195 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1196 if (empty($reshook)) {
1197 if ($permissiontodelete) {
1198 if (!isset($hookmanager->resArray[
'no_button_edit']) || $hookmanager->resArray[
'no_button_edit'] != 1) {
1199 print dolGetButtonAction($langs->trans(
'Delete'), $langs->trans(
'Delete'),
'delete', DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?action=deletebookkeepingwriting&confirm=yes&token='.
newToken().
'&piece_num='.((
int)
$object->piece_num).
'&toselect='.implode(
',', $tmptoselect),
'', $permissiontodelete, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
1202 if ($permissiontoadd) {
1203 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', DOL_URL_ROOT.
'/accountancy/bookkeeping/card.php?action=clonebookkeepingwriting&token=' .
newToken() .
'&piece_num=' . ((
int)
$object->piece_num) .
'&toselect=' . implode(
',', $tmptoselect),
'action-clone', $permissiontoadd, array(
'attr' => array(
'class' =>
'reposition')));
1209 $caneditalllabels = $permissiontoadd && !$atleastonevalidated && !$atleastoneexported;
1212 if ($action ==
'editalllabels' && $caneditalllabels) {
1213 $currentlabeloperation =
'';
1215 foreach (
$object->linesmvt as $bookkeepingline) {
1216 $currentlabeloperation = $bookkeepingline->label_operation;
1220 $formquestion = array(
1223 'name' =>
'labeloperationforalllines',
1224 'label' => $langs->trans(
'LabelOperation'),
1225 'value' =>
GETPOSTISSET(
'labeloperationforalllines') ?
GETPOST(
'labeloperationforalllines',
'alphanohtml') : $currentlabeloperation,
1229 $confirm_url = $_SERVER[
'PHP_SELF'] .
'?piece_num='.(int) $piece_num .
'&mode='.urlencode($mode) .
'&type='.urlencode($type) .
'&backtopage='.urlencode($backtopage);
1231 print $form->formconfirm($confirm_url, $langs->trans(
'UpdateAllOperationLabels'), $langs->trans(
'ConfirmUpdateAllOperationLabels'),
'confirm_setalllabels', $formquestion,
'', 0);
1238 if (empty(
$object->date_validation)) {
1239 print
'<form action="' . $_SERVER[
"PHP_SELF"] .
'?piece_num=' . ((int)
$object->piece_num) . (
$id > 0 ?
'#bookkeeping-line-'.((int) $id) :
'') .
'" method="POST">';
1240 if ($optioncss !=
'') {
1241 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
1243 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
1244 print
'<input type="hidden" name="doc_date" value="' .
$object->doc_date .
'">' .
"\n";
1245 print
'<input type="hidden" name="doc_type" value="' .
$object->doc_type .
'">' .
"\n";
1246 print
'<input type="hidden" name="doc_ref" value="' .
$object->doc_ref .
'">' .
"\n";
1247 print
'<input type="hidden" name="ref" value="' .
$object->ref .
'">' .
"\n";
1248 print
'<input type="hidden" name="code_journal" value="' .
$object->code_journal .
'">' .
"\n";
1249 print
'<input type="hidden" name="fk_doc" value="' .
$object->fk_doc .
'">' .
"\n";
1250 print
'<input type="hidden" name="fk_docdet" value="' .
$object->fk_docdet .
'">' .
"\n";
1251 print
'<input type="hidden" name="mode" value="' . $mode .
'">' .
"\n";
1252 print
'<input type="hidden" name="backtopage" value="' . $backtopage .
'">';
1253 print
'<input type="hidden" name="type" value="' . $type .
'">';
1256 if (count(
$object->linesmvt) > 0) {
1257 print
'<div class="div-table-responsive-no-min">';
1258 print
'<table class="noborder centpercent">';
1263 print
'<tr class="liste_titre">';
1269 print $langs->trans(
'LabelOperation');
1270 if ($caneditalllabels) {
1271 $editalllabelsurl = $_SERVER[
'PHP_SELF'] .
'?action=editalllabels&piece_num='.(int) $piece_num.
'&mode='.urlencode($mode).
'&type='.urlencode($type).
'&backtopage='.urlencode($backtopage).
'&token='.urlencode(
newToken());
1272 print
' <a class="editfielda reposition" href="'.dol_escape_htmltag($editalllabelsurl).
'">';
1273 print img_edit($langs->trans(
'UpdateAllOperationLabels'));
1279 if (empty(
$object->date_validation)) {
1288 if (!empty(
$object->linesmvt[0]) && empty(
$object->date_validation)) {
1289 $tmpline =
$object->linesmvt[0];
1290 if (!empty($tmpline->numero_compte)) {
1296 foreach (
$object->linesmvt as $line) {
1297 $total_debit += $line->debit;
1298 $total_credit += $line->credit;
1300 if ($action ==
'update' && $line->id == $id && empty(
$object->date_validation)) {
1301 print
'<tr class="oddeven" id="bookkeeping-line-'.((int) $line->id).
'" style="scroll-margin-top: 150px;" data-lineid="'.((int) $line->id).
'">';
1302 print
'<!-- td columns in edit mode -->';
1304 print $formaccounting->select_account((
GETPOSTISSET(
"accountingaccount_number") ?
GETPOST(
"accountingaccount_number",
"alpha") : $line->numero_compte),
'accountingaccount_number', 1, array(), 1, 1,
'minwidth200 maxwidth500');
1307 print $formaccounting->select_auxaccount((
GETPOSTISSET(
"subledger_account") ?
GETPOST(
"subledger_account",
"alpha") : $line->subledger_account),
'subledger_account', 1,
'maxwidth250',
'',
'subledger_label');
1309 print
'<br><input type="text" class="maxwidth150" name="subledger_label" id="subledger_label" value="'.(GETPOSTISSET(
"subledger_label") ?
GETPOST(
"subledger_label",
"alpha") : $line->subledger_label).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
"SubledgerAccountLabel")).
'">';
1311 print
'<td><input type="text" class="minwidth200" name="label_operation" value="'.(GETPOSTISSET(
"label_operation") ?
GETPOST(
"label_operation",
"alpha") : $line->label_operation).
'"></td>';
1312 print
'<td class="right"><input type="text" class="right width100" name="debit" value="'.(GETPOSTISSET(
"debit") ?
GETPOST(
"debit",
"alpha") :
price($line->debit)).
'"></td>';
1313 print
'<td class="right"><input type="text" class="right width100" name="credit" value="'.(GETPOSTISSET(
"credit") ?
GETPOST(
"credit",
"alpha") :
price($line->credit)).
'"></td>';
1315 print
'<input type="hidden" name="id" value="'.$line->id.
'">'.
"\n";
1316 print
'<input type="submit" class="button" name="update" value="'.$langs->trans(
"Update").
'">';
1319 } elseif ((empty($line->numero_compte) || (empty($line->debit) && empty($line->credit))) && empty(
$object->date_validation)) {
1320 if (($action ==
"" || $action ==
'add') && $permissiontoadd) {
1321 print
'<tr class="oddeven" id="bookkeeping-line-'.((int) $line->id).
'" style="scroll-margin-top: 150px;" data-lineid="'.((int) $line->id).
'">';
1322 print
'<!-- td columns in add mode -->';
1324 print $formaccounting->select_account($action ==
'add' ?
GETPOST(
'accountingaccount_number') :
'',
'accountingaccount_number', 1, array(), 1, 1,
'minwidth200 maxwidth500');
1327 print $formaccounting->select_auxaccount(
'',
'subledger_account', 1,
'maxwidth250',
'',
'subledger_label');
1328 print
'<br><input type="text" class="maxwidth150" name="subledger_label" id="subledger_label" value="" placeholder="' .
dol_escape_htmltag($langs->trans(
"SubledgerAccountLabel")) .
'">';
1330 print
'<td><input type="text" class="minwidth200" name="label_operation" value="' .
dol_escape_htmltag($label_operation) .
'"/></td>';
1331 print
'<td class="right"><input type="text" class="right width100" name="debit" value=""/></td>';
1332 print
'<td class="right"><input type="text" class="right width100" name="credit" value=""/></td>';
1333 print
'<td class="center"><input type="submit" class="button small" name="save" value="' . $langs->trans(
"Add") .
'"></td>';
1337 print
'<tr class="oddeven" id="bookkeeping-line-'.((int) $line->id).
'" style="scroll-margin-top: 150px;" data-lineid="'.((int) $line->id).
'">';
1338 print
'<!-- td columns in display mode -->';
1339 $resultfetch = $accountingaccount->fetch(0, $line->numero_compte,
true);
1341 if ($resultfetch > 0) {
1342 print $accountingaccount->getNomUrl(0, 1, 1,
'', 0);
1344 print
dol_escape_htmltag($line->numero_compte).
' <span class="warning">('.$langs->trans(
"AccountRemovedFromCurrentChartOfAccount").
')</span>';
1347 print
'<td>'.length_accounta($line->subledger_account);
1348 if ($line->subledger_label) {
1349 print
' - <span class="opacitymedium">'.dol_escape_htmltag($line->subledger_label).
'</span>';
1352 print
'<td>'.$line->label_operation.
'</td>';
1353 print
'<td class="right nowraponall amount">'.($line->debit != 0 ?
price($line->debit) :
'').
'</td>';
1354 print
'<td class="right nowraponall amount">'.($line->credit != 0 ?
price($line->credit) :
'').
'</td>';
1356 print
'<td class="center nowraponall">';
1357 if ($permissiontoadd) {
1358 if (empty($line->date_export) && empty($line->date_validation)) {
1359 print
'<a class="editfielda" href="' . $_SERVER[
"PHP_SELF"] .
'?action=update&id=' . $line->id .
'&piece_num=' . ((int) $line->piece_num) .
'&mode=' . urlencode((
string) $mode) .
'&token=' . urlencode(
newToken()) .
'#bookkeeping-line-'.((int) $line->id).
'">';
1360 print img_edit(
'', 0,
'class="marginrightonly"');
1361 print
'</a> ';
1363 print
'<a class="editfielda nohover cursornotallowed reposition disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"ForbiddenTransactionAlreadyExported")).
'">';
1364 print img_edit($langs->trans(
"ForbiddenTransactionAlreadyExported"), 0,
'class="marginrightonly"');
1365 print
'</a> ';
1368 if (empty($line->date_validation)) {
1369 $actiontodelete =
'delete';
1370 if ($mode ==
'_tmp' || $action !=
'delmouv') {
1371 $actiontodelete =
'confirm_delete';
1374 print
'<a href="' . $_SERVER[
"PHP_SELF"] .
'?action=' . $actiontodelete .
'&id=' . $line->id .
'&piece_num=' . ((int) $line->piece_num) .
'&mode=' . urlencode((
string) $mode) .
'&token=' . urlencode(
newToken()) .
'">';
1378 print
'<a class="editfielda nohover cursornotallowed disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"ForbiddenTransactionAlreadyExported")).
'">';
1379 print img_delete($langs->trans(
"ForbiddenTransactionAlreadyValidated"));
1388 $total_debit =
price2num($total_debit,
'MT');
1389 $total_credit =
price2num($total_credit,
'MT');
1391 if ($total_debit != $total_credit) {
1392 setEventMessages(
null, array($langs->trans(
'MvtNotCorrectlyBalanced', $total_debit, $total_credit)),
'warnings');
1398 if ($mode ==
'_tmp' && $action ==
'' && $permissiontoadd) {
1400 print
'<div class="center">';
1401 if (empty($total_debit) && empty($total_credit)) {
1402 print
'<a class="button disabled cursornotallowed" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"EnterNonEmptyLinesFirst")).
'">'.
dol_escape_htmltag($langs->trans(
"ValidTransaction")).
'</a>';
1403 } elseif ($total_debit == $total_credit) {
1404 print
'<a class="button" href="'.$_SERVER[
"PHP_SELF"].
'?piece_num='.((int)
$object->piece_num).(!empty($type) ?
'&type=sub' :
'').
'&backtopage='.urlencode($backtopage).
'&action=valid&token='.
newToken().
'">'.$langs->trans(
"ValidTransaction").
'</a>';
1406 print
'<a class="button disabled cursornotallowed" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans(
"MvtNotCorrectlyBalanced", $total_debit, $total_credit)).
'">'.
dol_escape_htmltag($langs->trans(
"ValidTransaction")).
'</a>';
1410 print
'<a class="button button-cancel" href="'.$backtopage.(!empty($type) ?
'?type=sub' :
'').
'">'.$langs->trans(
"Cancel").
'</a>';
1419 print $langs->trans(
"NoRecordFound");
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
accounting_transaction_prepare_head(BookKeeping $object, $mode='', $type='', $backtopage='/accountancy/bookkeeping/listbyaccount.php')
Prepare array with list of tabs for accounting transaction.
checkGeneralAccountAllowsAuxiliary($db, $general_account, $auxiliary_account, $general_account_id=0)
Check if a general accounting account allows the use of an auxiliary account.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage accounting accounts.
Class to manage accounting journals.
Class to manage Ledger (General Ledger and Subledger)
Class for BookkeepingTemplate.
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
$date_start
Variables from include:
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.