34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
41if (isModEnabled(
'category')) {
42 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44if (isModEnabled(
'accounting')) {
45 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47if (isModEnabled(
'accounting')) {
48 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
50if (isModEnabled(
'accounting')) {
51 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
55$langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta",
"withdrawals"));
57$action =
GETPOST(
'action',
'aZ09');
58$cancel =
GETPOST(
'cancel',
'alpha');
59$backtopage =
GETPOST(
'backtopage',
'alpha');
60$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
66$extrafields->fetch_name_optionals_label(
$object->table_element);
69$hookmanager->initHooks(array(
'bankcard',
'globalcard'));
84$result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
92$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
98 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
100 if (empty($backtopage) || ($cancel && empty($id))) {
101 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
102 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
103 $backtopage = $backurlforlist;
105 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
111 if (!empty($backtopageforcancel)) {
112 header(
"Location: ".$backtopageforcancel);
114 } elseif (!empty($backtopage)) {
115 header(
"Location: ".$backtopage);
121 if ($action ==
'add' && $user->hasRight(
'banque',
'configurer')) {
147 $object->address = trim(
GETPOST(
"account_address",
"alphanohtml"));
150 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
158 $account_number =
GETPOST(
'account_number',
'alphanohtml');
159 if (empty($account_number) || $account_number ==
'-1') {
162 $object->account_number = $account_number;
164 $fk_accountancy_journal =
GETPOSTINT(
'fk_accountancy_journal');
165 if ($fk_accountancy_journal <= 0) {
166 $object->fk_accountancy_journal = 0;
168 $object->fk_accountancy_journal = $fk_accountancy_journal;
182 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
184 $object->fk_user_author = $user->id;
187 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
192 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
197 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
203 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
209 $categories =
GETPOST(
'categories',
'array');
210 $object->setCategories($categories);
226 $urltogo = $backtopage ? str_replace(
'__ID__', (
string)
$object->id, $backtopage) : $backurlforlist;
227 $urltogo = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $urltogo);
229 if (empty($noback)) {
230 header(
"Location: " . $urltogo);
238 if ($action ==
'update' && $user->hasRight(
'banque',
'configurer')) {
265 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
273 $account_number =
GETPOST(
'account_number',
'alphanohtml');
274 if (empty($account_number) || $account_number ==
'-1') {
277 $object->account_number = $account_number;
279 $fk_accountancy_journal =
GETPOSTINT(
'fk_accountancy_journal');
280 if ($fk_accountancy_journal <= 0) {
281 $object->fk_accountancy_journal = 0;
283 $object->fk_accountancy_journal = $fk_accountancy_journal;
288 $object->address = trim(
GETPOST(
"account_address",
"alphanohtml"));
294 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
297 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
302 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
307 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
316 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
320 $result =
$object->update($user);
323 $categories =
GETPOST(
'categories',
'array');
324 $object->setCategories($categories);
341 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->hasRight(
'banque',
'configurer')) {
345 $result =
$object->delete($user);
349 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
363$form =
new Form($db);
366if (isModEnabled(
'accounting')) {
370$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
372$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
373if ($action ==
'create') {
374 $title = $langs->trans(
"NewFinancialAccount");
375} elseif (!empty(
$object->ref)) {
376 $title =
$object->ref.
" - ".$langs->trans(
"Card");
382if ($action ==
'create') {
383 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
385 if ($conf->use_javascript_ajax) {
386 print
"\n".
'<script type="text/javascript">';
387 print
'jQuery(document).ready(function () {
388 jQuery("#type").change(function() {
389 document.formsoc.action.value="create";
390 document.formsoc.submit();
392 jQuery("#selectaccount_country_id").change(function() {
393 document.formsoc.action.value="create";
394 document.formsoc.submit();
397 print
'</script>'.
"\n";
400 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
401 print
'<input type="hidden" name="token" value="'.newToken().
'">';
402 print
'<input type="hidden" name="action" value="add">';
403 print
'<input type="hidden" name="clos" value="0">';
404 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
408 print
'<table class="border centpercent tableforfieldcreate">';
411 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
412 print
'<td><input type="text" class="flat width100" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET(
'ref') ?
GETPOST(
"ref",
'alpha') :
$object->
ref).
'" maxlength="12" autofocus></td></tr>';
415 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
416 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
419 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
421 $formbank->selectTypeOfBankAccount(GETPOSTISSET(
"type") ?
GETPOSTINT(
'type') :
Account::TYPE_CURRENT,
'type');
425 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
427 $selectedcode =
$object->currency_code;
428 if (!$selectedcode) {
429 $selectedcode = $conf->currency;
431 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
437 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
439 print $form->selectarray(
"clos",
$object->labelStatus, (
GETPOSTINT(
'clos') !=
'' ?
GETPOSTINT(
'clos') :
$object->
status), 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth150onsmartphone');
444 if (GETPOSTISSET(
"account_country_id")) {
445 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") :
$object->country_code;
446 } elseif (empty($selectedcode)) {
447 $selectedcode = $mysoc->country_code;
451 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
453 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
454 print $form->select_country($selectedcode,
'account_country_id');
456 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
461 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
463 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
464 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
466 print $countrynotdefined;
473 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
474 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
476 print
"</textarea></td></tr>";
480 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
482 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
483 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
487 if (isModEnabled(
'category')) {
488 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
489 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 3);
491 $arrayselected = array();
493 $cats = $c->containing(
$object->id, Categorie::TYPE_ACCOUNT);
494 if (is_array($cats)) {
495 foreach ($cats as $cat) {
496 $arrayselected[] = $cat->id;
499 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
504 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
507 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
508 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") :
$object->comment),
'', 90,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor') &&
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_4,
'90%');
509 $doleditor->Create();
513 $parameters = array();
514 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
515 print $hookmanager->resPrint;
516 if (empty($reshook)) {
517 print
$object->showOptionals($extrafields,
'create', $parameters);
524 print
'<table class="border centpercent">';
527 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
528 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOSTISSET(
"solde") ?
GETPOST(
"solde") :
price2num(
$object->solde)).
'"></td></tr>';
530 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
533 print $form->selectDate($startdate,
're', 0, 0, 0,
'formsoc');
536 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
537 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>';
539 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
540 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>';
547 print
'<table class="border centpercent">';
550 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
551 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOSTISSET(
'bank') ?
GETPOST(
'bank',
'alpha') :
$object->bank).
'"></td>';
555 $bickey =
"BICNumber";
556 if (
$object->getCountryCode() ==
'IN') {
561 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
562 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') :
$object->iban).
'"></td></tr>';
565 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
566 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') :
$object->bic).
'"></td></tr>';
570 foreach (
$object->getFieldsToShow() as $val) {
572 if ($val ==
'BankCode') {
573 $name =
'code_banque';
574 $sizecss =
'minwidth100';
575 $content =
$object->code_banque;
576 } elseif ($val ==
'DeskCode') {
577 $name =
'code_guichet';
578 $sizecss =
'minwidth100';
579 $content =
$object->code_guichet;
580 } elseif ($val ==
'BankAccountNumber') {
582 $sizecss =
'minwidth200';
584 } elseif ($val ==
'BankAccountNumberKey') {
586 $sizecss =
'minwidth50';
590 print
'<td>'.$langs->trans($val).
'</td>';
591 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
595 if (isModEnabled(
'paymentbybanktransfer')) {
596 if ($mysoc->isInEEC()) {
597 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
598 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'>';
605 print
'<table class="border centpercent">';
606 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwner").
'</td>';
607 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'">';
610 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
611 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
612 print(GETPOSTISSET(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') :
$object->owner_address);
613 print
"</textarea></td></tr>";
615 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
616 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
619 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
620 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
623 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
625 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
626 print $form->select_country(GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
633 print
'<table class="border centpercent">';
637 $fieldrequired =
'fieldrequired ';
640 if (isModEnabled(
'accounting')) {
641 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
643 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
644 print $formaccounting->select_account(
$object->account_number,
'account_number', 1,
'', 1, 1);
645 if ($formaccounting->nbaccounts == 0) {
646 $langs->load(
"errors");
647 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
648 print $form->textwithpicto(
'', $htmltext);
652 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
653 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') :
$object->account_number).
'"></td></tr>';
657 if (isModEnabled(
'accounting')) {
658 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyJournal").
'</td>';
660 print $formaccounting->select_journal(
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
668 print $form->buttonsSaveCancel(
"CreateAccount");
677 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account', 0,
'',
'', 0,
'', 1);
682 if ($action ==
'delete') {
683 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
689 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
692 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
694 print
'<div class="fichecenter">';
695 print
'<div class="fichehalfleft">';
696 print
'<div class="underbanner clearboth"></div>';
698 print
'<table class="border centpercent tableforfield">';
701 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
702 print
'<td>'.$object->type_lib[
$object->type].
'</td></tr>';
705 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
707 $selectedcode =
$object->currency_code;
708 if (!$selectedcode) {
709 $selectedcode = $conf->currency;
711 print $langs->trans(
"Currency".$selectedcode);
715 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
717 $conciliate =
$object->canBeConciliated();
718 if ($conciliate == -2) {
719 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
720 } elseif ($conciliate == -3) {
721 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
723 print(
$object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
727 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
728 print
'<td>'.$object->min_allowed.
'</td></tr>';
730 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
731 print
'<td>'.$object->min_desired.
'</td></tr>';
734 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
736 if (isModEnabled(
'accounting')) {
738 $accountingaccount->fetch(0,
$object->account_number, 1);
740 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
747 if (isModEnabled(
'accounting')) {
748 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
751 if (
$object->fk_accountancy_journal > 0) {
753 $accountingjournal->fetch(
$object->fk_accountancy_journal);
755 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
762 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
767 print
'<div class="fichehalfright">';
768 print
'<div class="underbanner clearboth"></div>';
770 print
'<table class="border tableforfield centpercent">';
773 if (isModEnabled(
'category')) {
774 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
775 print $form->showCategories(
$object->id, Categorie::TYPE_ACCOUNT, 1);
779 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
780 print
'<td>'.dol_htmlentitiesbr(
$object->comment).
'</td></tr>';
785 print
'<table class="border tableforfield centpercent">';
787 print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"BankName").
'</td>';
788 print
'<td>'.$object->bank.
'</td></tr>';
791 $bickey =
"BICNumber";
792 if (
$object->getCountryCode() ==
'IN') {
797 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
798 print
'<td>'.getIbanHumanReadable(
$object).
' ';
801 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
803 print
img_picto($langs->trans(
"IbanValid"),
'tick');
809 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
810 print
'<td>'.$object->bic.
' ';
813 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
815 print
img_picto($langs->trans(
"SwiftValid"),
'tick');
823 foreach (
$object->getFieldsToShow() as $val) {
825 if ($val ==
'BankCode') {
826 $content =
$object->code_banque;
827 } elseif ($val ==
'DeskCode') {
828 $content =
$object->code_guichet;
829 } elseif ($val ==
'BankAccountNumber') {
831 } elseif ($val ==
'BankAccountNumberKey') {
835 print
'<tr><td>'.$langs->trans($val).
'</td>';
836 print
'<td>'.$content.
'</td>';
840 if (isModEnabled(
'prelevement')) {
841 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
842 print
'<td>'.$object->ics.
'</td>';
846 if (isModEnabled(
'paymentbybanktransfer')) {
848 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
849 print
'<td>'.$object->ics_transfer.
'</td>';
852 if ($mysoc->isInEEC()) {
853 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td><td>';
854 print(empty(
$object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes"));
855 print
"</td></tr>\n";
859 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
861 print
"</td></tr>\n";
863 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
864 print nl2br(
$object->owner_address);
865 print
"</td></tr>\n";
867 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
868 print
'<td>'.dol_escape_htmltag(
$object->owner_zip);
871 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
872 print
'<td>'.dol_escape_htmltag(
$object->owner_town);
875 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
878 $langs->load(
"dict");
879 print(empty(
$object->owner_country_code) ?
'' : $langs->convToOutputCharset($langs->transnoentitiesnoconv(
"Country".
$object->owner_country_code)));
889 print
'<div class="clearboth"></div>';
896 print
'<div class="tabsAction">';
898 if ($user->hasRight(
'banque',
'configurer')) {
899 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
902 $canbedeleted =
$object->can_be_deleted();
903 if ($user->hasRight(
'banque',
'configurer') && $canbedeleted) {
904 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
916 if (
GETPOSTINT(
'id') && $action ==
'edit' && $user->hasRight(
'banque',
'configurer')) {
917 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
919 if ($conf->use_javascript_ajax) {
920 print
"\n".
'<script type="text/javascript">';
921 print
'jQuery(document).ready(function () {
922 jQuery("#type").change(function() {
923 document.formsoc.action.value="edit";
924 document.formsoc.submit();
928 print
'jQuery(document).ready(function () {
929 jQuery("#selectaccount_country_id").change(function() {
930 document.formsoc.action.value="edit";
931 document.formsoc.submit();
934 print
'</script>'.
"\n";
937 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post" name="formsoc">';
938 print
'<input type="hidden" name="token" value="'.newToken().
'">';
939 print
'<input type="hidden" name="action" value="update">';
940 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">'.
"\n\n";
941 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
947 print
'<table class="border centpercent tableforfieldcreate">';
950 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
951 print
'<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') :
$object->
ref).
'" maxlength="12" autofocus></td></tr>';
954 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
955 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') :
$object->label).
'"></td></tr>';
958 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
959 print
'<td class="maxwidth200onsmartphone">';
960 $formbank->selectTypeOfBankAccount((GETPOSTISSET(
'type') ?
GETPOSTINT(
'type') :
$object->
type),
'type');
964 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
965 print
'<input type="hidden" value="'.$object->currency_code.
'">';
967 print
'<td class="maxwidth200onsmartphone">';
968 $selectedcode =
$object->currency_code;
969 if (!$selectedcode) {
970 $selectedcode = $conf->currency;
972 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
973 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
979 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
980 print
'<td class="maxwidth200onsmartphone">';
986 $selectedcode =
$object->country_code;
987 if (GETPOSTISSET(
"account_country_id")) {
988 $selectedcode =
GETPOST(
"account_country_id");
989 } elseif (empty($selectedcode)) {
990 $selectedcode = $mysoc->country_code;
994 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
995 print
'<td class="maxwidth200onsmartphone">';
996 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
998 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1003 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1004 if ($selectedcode) {
1005 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1006 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
$object->state_id, $selectedcode,
'account_state_id');
1008 print $countrynotdefined;
1015 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1016 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
1018 print
"</textarea></td></tr>";
1022 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
1024 $conciliate =
$object->canBeConciliated();
1025 if ($conciliate == -2) {
1026 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
1027 } elseif ($conciliate == -3) {
1028 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
1030 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro" class="opacitymedium">'.$langs->trans(
"DisableConciliation").
'</label>';
1035 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
1036 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>';
1038 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
1039 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>';
1042 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
1044 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
1045 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") :
$object->url).
'">';
1049 if (isModEnabled(
'category')) {
1050 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1051 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 3);
1053 $arrayselected = array();
1055 $cats = $c->containing(
$object->id, Categorie::TYPE_ACCOUNT);
1056 if (is_array($cats)) {
1057 foreach ($cats as $cat) {
1058 $arrayselected[] = $cat->id;
1061 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1066 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
1069 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1070 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") :
$object->comment),
'', 90,
'dolibarr_notes',
'', false, true, isModEnabled(
'fckeditor') &&
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_4,
'95%');
1071 $doleditor->Create();
1075 $parameters = array();
1076 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1077 print $hookmanager->resPrint;
1078 if (empty($reshook)) {
1079 print
$object->showOptionals($extrafields,
'edit', $parameters);
1088 print
'<table class="border centpercent">';
1091 $tdextra =
' class="titlefieldcreate"';
1094 $tdextra =
' class="fieldrequired titlefieldcreate"';
1097 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1099 if (isModEnabled(
'accounting')) {
1100 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
1101 print $formaccounting->select_account(
$object->account_number,
'account_number', 1,
'', 1, 1);
1102 if ($formaccounting->nbaccounts == 0) {
1103 $langs->load(
"errors");
1104 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
1105 print $form->textwithpicto(
'', $htmltext);
1108 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") :
$object->account_number).
'">';
1113 if (isModEnabled(
'accounting')) {
1114 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1116 print $formaccounting->select_journal(
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1126 print
'<table class="border centpercent">';
1129 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1130 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1134 $bickey =
"BICNumber";
1135 if (
$object->getCountryCode() ==
'IN') {
1141 $tooltip = $langs->trans(
"Example").
':<br>CH93 0076 2011 6238 5295 7<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
1142 print $form->textwithpicto($langs->trans($ibankey), $tooltip, 1,
'help',
'', 0, 3,
'iban');
1144 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') :
$object->iban).
'"></td></tr>';
1148 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1149 print $form->textwithpicto($langs->trans($bickey), $tooltip, 1,
'help',
'', 0, 3,
'bic');
1151 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') :
$object->bic).
'"></td></tr>';
1154 foreach (
$object->getFieldsToShow() as $val) {
1156 if ($val ==
'BankCode') {
1157 $name =
'code_banque';
1159 $content =
$object->code_banque;
1160 } elseif ($val ==
'DeskCode') {
1161 $name =
'code_guichet';
1163 $content =
$object->code_guichet;
1164 } elseif ($val ==
'BankAccountNumber') {
1168 } elseif ($val ==
'BankAccountNumberKey') {
1174 print
'<tr><td>'.$langs->trans($val).
'</td>';
1175 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1179 if (isModEnabled(
'prelevement')) {
1180 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1181 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') :
$object->ics).
'"></td></tr>';
1184 if (isModEnabled(
'paymentbybanktransfer')) {
1186 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1187 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>';
1189 if ($mysoc->isInEEC()) {
1190 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
1191 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (
$object->pti_in_ctti ?
' checked ' :
'') .
'>';
1200 print
'<table class="border centpercent">';
1202 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1203 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'"></td>';
1206 print
'<tr><td class="titlefieldcreate tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1207 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1208 print GETPOSTISSET(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') :
$object->owner_address;
1209 print
"</textarea></td></tr>";
1211 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
1212 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
1215 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
1216 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
1219 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
1221 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1222 print $form->select_country(GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
1230 print $form->buttonsSaveCancel(
"Modify");
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
checkIbanForAccount($account=null, $ibantocheck=null)
Check IBAN number information for a bank account.
bank_prepare_head(Account $object)
Prepare array with list of tabs.
checkSwiftForAccount($account=null, $swift=null)
Check SWIFT information for a bank account.
Class to manage bank accounts.
const TYPE_SAVINGS
Savings account.
const TYPE_CURRENT
Current account.
Class to manage accounting accounts.
Class to manage accounting journals.
Class to manage categories.
Class to manage a WYSIWYG editor.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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.
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
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)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='')
Return the value of a $_GET or $_POST supervariable, converted into float.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
div refaddress div address
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.