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) {
519 if ($val ==
'BankCode') {
520 $name =
'code_banque';
521 $sizecss =
'minwidth100';
522 $content = $object->code_banque;
523 } elseif ($val ==
'DeskCode') {
524 $name =
'code_guichet';
525 $sizecss =
'minwidth100';
526 $content = $object->code_guichet;
527 } elseif ($val ==
'BankAccountNumber') {
529 $sizecss =
'minwidth200';
530 $content = $object->number;
531 } elseif ($val ==
'BankAccountNumberKey') {
533 $sizecss =
'minwidth50';
534 $content = $object->cle_rib;
537 print
'<td>'.$langs->trans($val).
'</td>';
538 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
542 $bickey =
"BICNumber";
543 if ($object->getCountryCode() ==
'IN') {
548 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
549 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') : $object->iban).
'"></td></tr>';
551 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
552 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') : $object->bic).
'"></td></tr>';
555 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td>';
556 print
'<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'> ';
557 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
561 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
562 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
564 print
"</textarea></td></tr>";
566 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
567 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $object->proprio).
'">';
570 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
571 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
572 print (
GETPOST(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') : $object->owner_address);
573 print
"</textarea></td></tr>";
579 print
'<table class="border centpercent">';
582 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
583 $fieldrequired =
'fieldrequired ';
587 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
589 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
592 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
593 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') : $object->account_number).
'"></td></tr>';
598 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
600 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
608 print
$form->buttonsSaveCancel(
"CreateAccount");
613 if ((
GETPOST(
"id",
'int') ||
GETPOST(
"ref")) && $action !=
'edit') {
616 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account');
621 if ($action ==
'delete') {
622 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
628 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
631 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
634 print
'<div class="fichecenter">';
635 print
'<div class="fichehalfleft">';
636 print
'<div class="underbanner clearboth"></div>';
638 print
'<table class="border tableforfield" width="100%">';
641 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
642 print
'<td>'.$object->type_lib[$object->type].
'</td></tr>';
645 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
647 $selectedcode = $object->currency_code;
648 if (!$selectedcode) {
649 $selectedcode = $conf->currency;
651 print $langs->trans(
"Currency".$selectedcode);
655 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
657 $conciliate = $object->canBeConciliated();
658 if ($conciliate == -2) {
659 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
660 } elseif ($conciliate == -3) {
661 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
663 print ($object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
667 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
668 print
'<td>'.$object->min_allowed.
'</td></tr>';
670 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
671 print
'<td>'.$object->min_desired.
'</td></tr>';
674 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
678 $accountingaccount->fetch(
'', $object->account_number, 1);
680 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
682 print $object->account_number;
688 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
691 if ($object->fk_accountancy_journal > 0) {
693 $accountingjournal->fetch($object->fk_accountancy_journal);
695 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
702 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
707 print
'<div class="fichehalfright">';
708 print
'<div class="underbanner clearboth"></div>';
710 print
'<table class="border tableforfield centpercent">';
714 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
715 print
$form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
719 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
720 print
'<td>'.dol_htmlentitiesbr($object->comment).
'</td></tr>';
727 print
'<table class="border tableforfield centpercent">';
729 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"BankName").
'</td>';
730 print
'<td>'.$object->bank.
'</td></tr>';
733 foreach ($object->getFieldsToShow() as $val) {
735 if ($val ==
'BankCode') {
736 $content = $object->code_banque;
737 } elseif ($val ==
'DeskCode') {
738 $content = $object->code_guichet;
739 } elseif ($val ==
'BankAccountNumber') {
740 $content = $object->number;
741 } elseif ($val ==
'BankAccountNumberKey') {
742 $content = $object->cle_rib;
745 print
'<tr><td>'.$langs->trans($val).
'</td>';
746 print
'<td>'.$content.
'</td>';
751 $bickey =
"BICNumber";
752 if ($object->getCountryCode() ==
'IN') {
756 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
757 print
'<td>'.getIbanHumanReadable($object).
' ';
758 if (!empty($object->iban)) {
760 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
762 print
img_picto($langs->trans(
"IbanValid"),
'info');
767 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
768 print
'<td>'.$object->bic.
' ';
769 if (!empty($object->bic)) {
771 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
773 print
img_picto($langs->trans(
"SwiftValid"),
'info');
779 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
780 print
'<td>'.$object->ics.
'</td>';
786 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
787 print
'<td>'.$object->ics_transfer.
'</td>';
790 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td><td>';
791 print (empty($object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes")) .
' ';
792 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
793 print
"</td></tr>\n";
796 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
797 print nl2br($object->domiciliation);
798 print
"</td></tr>\n";
800 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
801 print $object->proprio;
802 print
"</td></tr>\n";
804 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
805 print nl2br($object->owner_address);
806 print
"</td></tr>\n";
814 print
'<div class="clearboth"></div>';
821 print
'<div class="tabsAction">';
823 if ($user->rights->banque->configurer) {
824 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
827 $canbedeleted = $object->can_be_deleted();
828 if ($user->rights->banque->configurer && $canbedeleted) {
829 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
841 if (
GETPOST(
'id',
'int') && $action ==
'edit' && $user->rights->banque->configurer) {
842 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
844 if ($conf->use_javascript_ajax) {
845 print
"\n".
'<script type="text/javascript">';
846 print
'jQuery(document).ready(function () {
847 jQuery("#type").change(function() {
848 document.formsoc.action.value="edit";
849 document.formsoc.submit();
853 print
'jQuery(document).ready(function () {
854 jQuery("#selectaccount_country_id").change(function() {
855 document.formsoc.action.value="edit";
856 document.formsoc.submit();
859 print
'</script>'.
"\n";
862 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formsoc">';
863 print
'<input type="hidden" name="token" value="'.newToken().
'">';
864 print
'<input type="hidden" name="action" value="update">';
865 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">'.
"\n\n";
871 print
'<table class="border centpercent tableforfieldcreate">';
874 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
875 print
'<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') : $object->ref).
'"></td></tr>';
878 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
879 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $object->label).
'"></td></tr>';
882 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
883 print
'<td class="maxwidth200onsmartphone">';
884 $formbank->selectTypeOfBankAccount((
GETPOSTISSET(
'type') ?
GETPOST(
'type',
'int') : $object->type),
'type');
888 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
889 print
'<input type="hidden" value="'.$object->currency_code.
'">';
891 print
'<td class="maxwidth200onsmartphone">';
892 $selectedcode = $object->currency_code;
893 if (!$selectedcode) {
894 $selectedcode = $conf->currency;
896 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
897 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
903 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
904 print
'<td class="maxwidth200onsmartphone">';
909 $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
910 $selectedcode = $object->country_code;
912 $selectedcode =
GETPOST(
"account_country_id");
913 } elseif (empty($selectedcode)) {
914 $selectedcode = $mysoc->country_code;
916 $object->country_code =
getCountry($selectedcode, 2);
918 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
919 print
'<td class="maxwidth200onsmartphone">';
920 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
922 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
927 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
929 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
930 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $object->state_id, $selectedcode,
'account_state_id');
932 print $countrynotdefined;
937 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
939 $conciliate = $object->canBeConciliated();
940 if ($conciliate == -2) {
941 print $langs->trans(
"No").
' ('.$langs->trans(
"CashAccount").
')';
942 } elseif ($conciliate == -3) {
943 print $langs->trans(
"No").
' ('.$langs->trans(
"Closed").
')';
945 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro">'.$langs->trans(
"DisableConciliation").
'</label>';
950 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
951 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>';
953 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
954 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>';
957 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
959 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
960 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") : $object->url).
'">';
965 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
966 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
968 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
969 if (is_array($cats)) {
970 foreach ($cats as $cat) {
971 $arrayselected[] = $cat->id;
974 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
979 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
982 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
983 $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%');
984 $doleditor->Create();
989 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
990 print $hookmanager->resPrint;
991 if (empty($reshook)) {
992 print $object->showOptionals($extrafields,
'edit',
$parameters);
1001 print
'<table class="border centpercent">';
1004 $tdextra =
' class="titlefieldcreate"';
1006 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1007 $tdextra =
' class="fieldrequired titlefieldcreate"';
1010 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1013 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
1015 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") : $object->account_number).
'">';
1021 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1023 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1035 print
'<table class="border centpercent">';
1038 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1039 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1043 foreach ($object->getFieldsToShow() as $val) {
1045 if ($val ==
'BankCode') {
1046 $name =
'code_banque';
1048 $content = $object->code_banque;
1049 } elseif ($val ==
'DeskCode') {
1050 $name =
'code_guichet';
1052 $content = $object->code_guichet;
1053 } elseif ($val ==
'BankAccountNumber') {
1056 $content = $object->number;
1057 } elseif ($val ==
'BankAccountNumberKey') {
1060 $content = $object->cle_rib;
1063 print
'<tr><td>'.$langs->trans($val).
'</td>';
1064 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1069 $bickey =
"BICNumber";
1070 if ($object->getCountryCode() ==
'IN') {
1075 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
1076 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') : $object->iban).
'"></td></tr>';
1078 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
1079 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') : $object->bic).
'"></td></tr>';
1082 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1083 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') : $object->ics).
'"></td></tr>';
1087 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1088 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>';
1090 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td>';
1091 print
'<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ?
' checked ' :
'') .
'> ';
1092 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
1096 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1097 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
1098 print $object->domiciliation;
1099 print
"</textarea></td></tr>";
1101 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1102 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.
'"></td>';
1105 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1106 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1107 print $object->owner_address;
1108 print
"</textarea></td></tr>";
1115 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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.