33 require
'../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
54 $langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta"));
56 $action =
GETPOST(
'action',
'aZ09');
57 $cancel =
GETPOST(
'cancel',
'alpha');
63 $extrafields->fetch_name_optionals_label($object->table_element);
66 $hookmanager->initHooks(array(
'bankcard',
'globalcard'));
70 $fieldid =
GETPOST(
"id",
'int') ?
'rowid' :
'ref';
74 $object->fetch(
GETPOST(
"id",
'int'));
77 $object->fetch(0,
GETPOST(
"ref"));
81 $result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
89 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
90 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
92 if (empty($reshook)) {
93 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
95 if (empty($backtopage) || ($cancel && empty($id))) {
96 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
97 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
98 $backtopage = $backurlforlist;
100 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
106 if (!empty($backtopageforcancel)) {
107 header(
"Location: ".$backtopageforcancel);
109 } elseif (!empty($backtopage)) {
110 header(
"Location: ".$backtopage);
116 if ($action ==
'add') {
125 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
126 $object->courant =
GETPOST(
"type");
127 $object->clos =
GETPOST(
"clos");
128 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
129 $object->url = trim(
GETPOST(
"url",
'alpha'));
131 $object->bank = trim(
GETPOST(
"bank"));
132 $object->code_banque = trim(
GETPOST(
"code_banque"));
133 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
134 $object->number = trim(
GETPOST(
"number"));
135 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
136 $object->bic = trim(
GETPOST(
"bic"));
137 $object->iban = trim(
GETPOST(
"iban"));
138 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
139 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
141 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
142 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
144 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
145 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
147 $account_number =
GETPOST(
'account_number',
'alphanohtml');
148 if (empty($account_number) || $account_number ==
'-1') {
149 $object->account_number =
'';
151 $object->account_number = $account_number;
153 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
154 if ($fk_accountancy_journal <= 0) {
155 $object->fk_accountancy_journal =
'';
157 $object->fk_accountancy_journal = $fk_accountancy_journal;
163 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
165 $object->state_id =
GETPOST(
"account_state_id",
'int');
166 $object->country_id =
GETPOST(
"account_country_id",
'int');
168 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
169 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
170 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
172 $object->fk_user_author = $user->id;
174 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
175 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
179 if (empty($object->ref)) {
180 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
184 if (empty($object->label)) {
185 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
191 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
194 $id = $object->create($user);
197 $categories =
GETPOST(
'categories',
'array');
198 $object->setCategories($categories);
218 if ($action ==
'update') {
223 $object->fetch(
GETPOST(
"id",
'int'));
226 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
227 $object->courant =
GETPOST(
"type");
228 $object->clos =
GETPOST(
"clos");
229 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
230 $object->url = trim(
GETPOST(
"url",
'alpha'));
232 $object->bank = trim(
GETPOST(
"bank"));
233 $object->code_banque = trim(
GETPOST(
"code_banque"));
234 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
235 $object->number = trim(
GETPOST(
"number"));
236 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
237 $object->bic = trim(
GETPOST(
"bic"));
238 $object->iban = trim(
GETPOST(
"iban"));
239 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
240 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
242 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
243 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
245 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
246 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
248 $account_number =
GETPOST(
'account_number',
'alphanohtml');
249 if (empty($account_number) || $account_number ==
'-1') {
250 $object->account_number =
'';
252 $object->account_number = $account_number;
254 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
255 if ($fk_accountancy_journal <= 0) {
256 $object->fk_accountancy_journal =
'';
258 $object->fk_accountancy_journal = $fk_accountancy_journal;
261 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
263 $object->state_id =
GETPOST(
"account_state_id",
'int');
264 $object->country_id =
GETPOST(
"account_country_id",
'int');
266 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
267 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
268 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
270 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
271 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
275 if (empty($object->ref)) {
276 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
280 if (empty($object->label)) {
281 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
290 $ret = $extrafields->setOptionalsFromPost(
null, $object);
294 $result = $object->update($user);
297 $categories =
GETPOST(
'categories',
'array');
298 $object->setCategories($categories);
300 $_GET[
"id"] =
GETPOST(
"id",
'int');
315 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->banque->configurer) {
318 $object->fetch(
GETPOST(
"id",
"int"));
319 $result = $object->delete($user);
323 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
344 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
346 $help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
347 if ($action ==
'create') {
348 $title = $langs->trans(
"NewFinancialAccount");
349 } elseif (!empty($object->ref)) {
350 $title = $object->ref.
" - ".$langs->trans(
"Card");
355 if ($action ==
'create') {
356 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
358 if ($conf->use_javascript_ajax) {
359 print
"\n".
'<script type="text/javascript">';
360 print
'jQuery(document).ready(function () {
361 jQuery("#type").change(function() {
362 document.formsoc.action.value="create";
363 document.formsoc.submit();
365 jQuery("#selectaccount_country_id").change(function() {
366 document.formsoc.action.value="create";
367 document.formsoc.submit();
370 print
'</script>'.
"\n";
373 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
374 print
'<input type="hidden" name="token" value="'.newToken().
'">';
375 print
'<input type="hidden" name="action" value="add">';
376 print
'<input type="hidden" name="clos" value="0">';
380 print
'<table class="border centpercent tableforfieldcreate">';
383 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
384 print
'<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
"ref",
'alpha') : $object->ref).
'" maxlength="12" autofocus></td></tr>';
387 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
388 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
391 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
397 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
399 $selectedcode = $object->currency_code;
400 if (!$selectedcode) {
401 $selectedcode = $conf->currency;
403 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
409 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
411 print
$form->selectarray(
"clos", $object->status, (
GETPOST(
'clos',
'int') !=
'' ?
GETPOST(
'clos',
'int') : $object->clos), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150onsmartphone');
417 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") : $object->country_code;
418 } elseif (empty($selectedcode)) {
419 $selectedcode = $mysoc->country_code;
421 $object->country_code =
getCountry($selectedcode, 2);
423 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
425 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
427 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
432 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
434 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
435 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
437 print $countrynotdefined;
442 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
444 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
445 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
450 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
451 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
453 $arrayselected = array();
455 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
456 if (is_array($cats)) {
457 foreach ($cats as $cat) {
458 $arrayselected[] = $cat->id;
461 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
466 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
469 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
470 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") : $object->comment),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_4,
'90%');
471 $doleditor->Create();
476 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
477 print $hookmanager->resPrint;
478 if (empty($reshook)) {
479 print $object->showOptionals($extrafields,
'create',
$parameters);
486 print
'<table class="border centpercent">';
489 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
490 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST(
"solde") ?
GETPOST(
"solde") :
price2num($object->solde)).
'"></td></tr>';
492 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
494 print
$form->selectDate(
'',
're', 0, 0, 0,
'formsoc');
497 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
498 print
'<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST(
"account_min_allowed") ?
GETPOST(
"account_min_allowed") : $object->min_allowed).
'"></td></tr>';
500 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
501 print
'<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST(
"account_min_desired") ?
GETPOST(
"account_min_desired") : $object->min_desired).
'"></td></tr>';
508 print
'<table class="border centpercent">';
511 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
512 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST(
'bank') ?
GETPOST(
'bank',
'alpha') : $object->bank).
'"></td>';
517 foreach ($object->getFieldsToShow() as $val) {
518 if ($val ==
'BankCode') {
519 $name =
'code_banque';
520 $sizecss =
'minwidth100';
521 $content = $object->code_banque;
522 } elseif ($val ==
'DeskCode') {
523 $name =
'code_guichet';
524 $sizecss =
'minwidth100';
525 $content = $object->code_guichet;
526 } elseif ($val ==
'BankAccountNumber') {
528 $sizecss =
'minwidth200';
529 $content = $object->number;
530 } elseif ($val ==
'BankAccountNumberKey') {
532 $sizecss =
'minwidth50';
533 $content = $object->cle_rib;
536 print
'<td>'.$langs->trans($val).
'</td>';
537 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOST($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
541 $bickey =
"BICNumber";
542 if ($object->getCountryCode() ==
'IN') {
547 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
548 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOST(
'iban') ?
GETPOST(
'iban',
'alpha') : $object->iban).
'"></td></tr>';
550 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
551 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST(
'bic') ?
GETPOST(
'bic',
'alpha') : $object->bic).
'"></td></tr>';
554 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td>';
555 print
'<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'> ';
556 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
560 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
561 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
562 print (
GETPOST(
'domiciliation') ?
GETPOST(
'domiciliation') : $object->domiciliation);
563 print
"</textarea></td></tr>";
565 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
566 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $object->proprio).
'">';
569 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
570 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
571 print (
GETPOST(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') : $object->owner_address);
572 print
"</textarea></td></tr>";
578 print
'<table class="border centpercent">';
581 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
582 $fieldrequired =
'fieldrequired ';
586 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
588 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
591 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
592 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') : $object->account_number).
'"></td></tr>';
597 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
599 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
607 print
$form->buttonsSaveCancel(
"CreateAccount");
612 if ((
GETPOST(
"id",
'int') ||
GETPOST(
"ref")) && $action !=
'edit') {
615 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account');
620 if ($action ==
'delete') {
621 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
627 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
630 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
633 print
'<div class="fichecenter">';
634 print
'<div class="fichehalfleft">';
635 print
'<div class="underbanner clearboth"></div>';
637 print
'<table class="border tableforfield" width="100%">';
640 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
641 print
'<td>'.$object->type_lib[$object->type].
'</td></tr>';
644 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
646 $selectedcode = $object->currency_code;
647 if (!$selectedcode) {
648 $selectedcode = $conf->currency;
650 print $langs->trans(
"Currency".$selectedcode);
654 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
656 $conciliate = $object->canBeConciliated();
657 if ($conciliate == -2) {
658 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
659 } elseif ($conciliate == -3) {
660 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
662 print ($object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
666 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
667 print
'<td>'.$object->min_allowed.
'</td></tr>';
669 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
670 print
'<td>'.$object->min_desired.
'</td></tr>';
673 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
677 $accountingaccount->fetch(
'', $object->account_number, 1);
679 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
681 print $object->account_number;
687 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
690 if ($object->fk_accountancy_journal > 0) {
692 $accountingjournal->fetch($object->fk_accountancy_journal);
694 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
701 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
706 print
'<div class="fichehalfright">';
707 print
'<div class="underbanner clearboth"></div>';
709 print
'<table class="border tableforfield centpercent">';
713 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
714 print
$form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
718 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
719 print
'<td>'.dol_htmlentitiesbr($object->comment).
'</td></tr>';
726 print
'<table class="border tableforfield centpercent">';
728 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"BankName").
'</td>';
729 print
'<td>'.$object->bank.
'</td></tr>';
732 foreach ($object->getFieldsToShow() as $val) {
733 if ($val ==
'BankCode') {
734 $content = $object->code_banque;
735 } elseif ($val ==
'DeskCode') {
736 $content = $object->code_guichet;
737 } elseif ($val ==
'BankAccountNumber') {
738 $content = $object->number;
739 } elseif ($val ==
'BankAccountNumberKey') {
740 $content = $object->cle_rib;
743 print
'<tr><td>'.$langs->trans($val).
'</td>';
744 print
'<td>'.$content.
'</td>';
749 $bickey =
"BICNumber";
750 if ($object->getCountryCode() ==
'IN') {
754 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
755 print
'<td>'.getIbanHumanReadable($object).
' ';
756 if (!empty($object->iban)) {
758 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
760 print
img_picto($langs->trans(
"IbanValid"),
'info');
765 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
766 print
'<td>'.$object->bic.
' ';
767 if (!empty($object->bic)) {
769 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
771 print
img_picto($langs->trans(
"SwiftValid"),
'info');
777 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
778 print
'<td>'.$object->ics.
'</td>';
784 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
785 print
'<td>'.$object->ics_transfer.
'</td>';
788 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td><td>';
789 print (empty($object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes")) .
' ';
790 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
791 print
"</td></tr>\n";
794 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
795 print nl2br($object->domiciliation);
796 print
"</td></tr>\n";
798 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
799 print $object->proprio;
800 print
"</td></tr>\n";
802 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
803 print nl2br($object->owner_address);
804 print
"</td></tr>\n";
812 print
'<div class="clearboth"></div>';
819 print
'<div class="tabsAction">';
821 if ($user->rights->banque->configurer) {
822 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
825 $canbedeleted = $object->can_be_deleted();
826 if ($user->rights->banque->configurer && $canbedeleted) {
827 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
839 if (
GETPOST(
'id',
'int') && $action ==
'edit' && $user->rights->banque->configurer) {
840 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
842 if ($conf->use_javascript_ajax) {
843 print
"\n".
'<script type="text/javascript">';
844 print
'jQuery(document).ready(function () {
845 jQuery("#type").change(function() {
846 document.formsoc.action.value="edit";
847 document.formsoc.submit();
851 print
'jQuery(document).ready(function () {
852 jQuery("#selectaccount_country_id").change(function() {
853 document.formsoc.action.value="edit";
854 document.formsoc.submit();
857 print
'</script>'.
"\n";
860 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formsoc">';
861 print
'<input type="hidden" name="token" value="'.newToken().
'">';
862 print
'<input type="hidden" name="action" value="update">';
863 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">'.
"\n\n";
869 print
'<table class="border centpercent tableforfieldcreate">';
872 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
873 print
'<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') : $object->ref).
'"></td></tr>';
876 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
877 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $object->label).
'"></td></tr>';
880 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
881 print
'<td class="maxwidth200onsmartphone">';
882 $formbank->selectTypeOfBankAccount((
GETPOSTISSET(
'type') ?
GETPOST(
'type',
'int') : $object->type),
'type');
886 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
887 print
'<input type="hidden" value="'.$object->currency_code.
'">';
889 print
'<td class="maxwidth200onsmartphone">';
890 $selectedcode = $object->currency_code;
891 if (!$selectedcode) {
892 $selectedcode = $conf->currency;
894 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
895 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
901 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
902 print
'<td class="maxwidth200onsmartphone">';
907 $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
908 $selectedcode = $object->country_code;
910 $selectedcode =
GETPOST(
"account_country_id");
911 } elseif (empty($selectedcode)) {
912 $selectedcode = $mysoc->country_code;
914 $object->country_code =
getCountry($selectedcode, 2);
916 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
917 print
'<td class="maxwidth200onsmartphone">';
918 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
920 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
925 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
927 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
928 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $object->state_id, $selectedcode,
'account_state_id');
930 print $countrynotdefined;
935 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
937 $conciliate = $object->canBeConciliated();
938 if ($conciliate == -2) {
939 print $langs->trans(
"No").
' ('.$langs->trans(
"CashAccount").
')';
940 } elseif ($conciliate == -3) {
941 print $langs->trans(
"No").
' ('.$langs->trans(
"Closed").
')';
943 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro">'.$langs->trans(
"DisableConciliation").
'</label>';
948 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
949 print
'<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOSTISSET(
"account_min_allowed") ?
GETPOST(
"account_min_allowed") : $object->min_allowed).
'"></td></tr>';
951 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
952 print
'<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOSTISSET(
"account_min_desired") ?
GETPOST(
"account_min_desired") : $object->min_desired).
'"></td></tr>';
955 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
957 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
958 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") : $object->url).
'">';
963 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
964 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
966 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
967 if (is_array($cats)) {
968 foreach ($cats as $cat) {
969 $arrayselected[] = $cat->id;
972 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
977 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
980 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
981 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") : $object->comment),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_4,
'95%');
982 $doleditor->Create();
987 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
988 print $hookmanager->resPrint;
989 if (empty($reshook)) {
990 print $object->showOptionals($extrafields,
'edit',
$parameters);
999 print
'<table class="border centpercent">';
1002 $tdextra =
' class="titlefieldcreate"';
1004 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1005 $tdextra =
' class="fieldrequired titlefieldcreate"';
1008 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1011 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
1013 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") : $object->account_number).
'">';
1019 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1021 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1033 print
'<table class="border centpercent">';
1036 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1037 print
'<td><input size="30" type="text" class="flat" name="bank" value="'.$object->bank.
'"></td>';
1041 foreach ($object->getFieldsToShow() as $val) {
1042 if ($val ==
'BankCode') {
1043 $name =
'code_banque';
1045 $content = $object->code_banque;
1046 } elseif ($val ==
'DeskCode') {
1047 $name =
'code_guichet';
1049 $content = $object->code_guichet;
1050 } elseif ($val ==
'BankAccountNumber') {
1053 $content = $object->number;
1054 } elseif ($val ==
'BankAccountNumberKey') {
1057 $content = $object->cle_rib;
1060 print
'<tr><td>'.$langs->trans($val).
'</td>';
1061 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1066 $bickey =
"BICNumber";
1067 if ($object->getCountryCode() ==
'IN') {
1072 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
1073 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') : $object->iban).
'"></td></tr>';
1075 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
1076 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') : $object->bic).
'"></td></tr>';
1079 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1080 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') : $object->ics).
'"></td></tr>';
1084 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1085 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET(
'ics_transfer') ?
GETPOST(
'ics_transfer',
'alphanohtml') : $object->ics_transfer).
'"></td></tr>';
1087 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td>';
1088 print
'<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ?
' checked ' :
'') .
'> ';
1089 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
1093 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1094 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
1095 print $object->domiciliation;
1096 print
"</textarea></td></tr>";
1098 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1099 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.
'"></td>';
1102 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1103 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1104 print $object->owner_address;
1105 print
"</textarea></td></tr>";
1112 print
$form->buttonsSaveCancel(
"Modify");
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
checkIbanForAccount(Account $account)
Check IBAN number informations for a bank account.
checkSwiftForAccount($account)
Check SWIFT informations for a bank account.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Class to manage bank accounts.
const TYPE_SAVINGS
Savings account.
const TYPE_CURRENT
Current account.
Class to manage accounting accounts.
Class to manage accounting accounts.
Class to manage categories.
Class to manage a WYSIWYG editor.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='')
Clean a string from all punctuation characters to use it as a ref or login.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$formconfirm
if ($action == 'delbookkeepingyear') {
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.