34require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
58 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
62$langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta",
"withdrawals"));
64$action =
GETPOST(
'action',
'aZ09');
65$cancel =
GETPOST(
'cancel',
'alpha');
66$backtopage =
GETPOST(
'backtopage',
'alpha');
67$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
72$extrafields->fetch_name_optionals_label(
$object->table_element);
75$hookmanager->initHooks(array(
'bankcard',
'globalcard'));
80if ($action ==
'create' || $action ==
'add') {
94$result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
101$parameters = array();
102$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
104 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
107if (empty($reshook)) {
108 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
110 if (empty($backtopage) || ($cancel && empty($id))) {
111 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
112 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
113 $backtopage = $backurlforlist;
115 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
121 if (!empty($backtopageforcancel)) {
122 header(
"Location: ".$backtopageforcancel);
124 } elseif (!empty($backtopage)) {
125 header(
"Location: ".$backtopage);
131 if ($action ==
'close' && $user->hasRight(
'banque',
'configurer')) {
137 $result =
$object->setStatut($object::STATUS_CLOSED,
null,
'',
'BANKACCOUNT_MODIFY');
140 if ($action ==
'reopen' && $user->hasRight(
'banque',
'configurer')) {
146 $result =
$object->setStatut($object::STATUS_OPEN,
null,
'',
'BANKACCOUNT_MODIFY');
149 if ($action ==
'add' && $user->hasRight(
'banque',
'configurer')) {
175 $object->address = trim(
GETPOST(
"account_address",
"alphanohtml"));
178 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
186 $account_number =
GETPOST(
'account_number',
'alphanohtml');
187 if (empty($account_number) || $account_number ==
'-1') {
190 $object->account_number = $account_number;
192 $fk_accountancy_journal =
GETPOSTINT(
'fk_accountancy_journal');
193 if ($fk_accountancy_journal <= 0) {
194 $object->fk_accountancy_journal = 0;
196 $object->fk_accountancy_journal = $fk_accountancy_journal;
210 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
212 $object->fk_user_author = $user->id;
215 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
220 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
225 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
231 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
237 $categories =
GETPOST(
'categories',
'array:int');
238 $object->setCategories($categories);
254 $urltogo = $backtopage ? str_replace(
'__ID__', (
string)
$object->id, $backtopage) : $backurlforlist;
255 $urltogo = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $urltogo);
257 if (empty($noback)) {
258 header(
"Location: " . $urltogo);
266 if ($action ==
'update' && $user->hasRight(
'banque',
'configurer')) {
293 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
301 $account_number =
GETPOST(
'account_number',
'alphanohtml');
302 if (empty($account_number) || $account_number ==
'-1') {
305 $object->account_number = $account_number;
307 $fk_accountancy_journal =
GETPOSTINT(
'fk_accountancy_journal');
308 if ($fk_accountancy_journal <= 0) {
309 $object->fk_accountancy_journal = 0;
311 $object->fk_accountancy_journal = $fk_accountancy_journal;
316 $object->address = trim(
GETPOST(
"account_address",
"alphanohtml"));
322 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
325 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
330 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
335 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
344 $ret = $extrafields->setOptionalsFromPost(
null, $object);
348 $result =
$object->update($user);
351 $categories =
GETPOST(
'categories',
'array:int');
352 $object->setCategories($categories);
369 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->hasRight(
'banque',
'configurer')) {
374 $result =
$object->delete($user);
377 setEventMessages($langs->trans(
"RecordDeleted"),
null,
'mesgs');
378 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
392$form =
new Form($db);
397$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
399$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
400$title = $langs->trans(
"BankAccount");
401if ($action ==
'create') {
402 $title = $langs->trans(
"NewFinancialAccount");
403} elseif (!empty(
$object->ref)) {
404 $title =
$object->ref.
" - ".$langs->trans(
"Card");
410if ($action ==
'create') {
411 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
413 if (
$conf->use_javascript_ajax) {
414 print
"\n".
'<script type="text/javascript">';
415 print
'jQuery(document).ready(function () {
416 jQuery("#type").change(function() {
417 document.formsoc.action.value="create";
418 document.formsoc.submit();
420 jQuery("#selectaccount_country_id").change(function() {
421 document.formsoc.action.value="create";
422 document.formsoc.submit();
425 print
'</script>'.
"\n";
428 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
429 print
'<input type="hidden" name="token" value="'.newToken().
'">';
430 print
'<input type="hidden" name="action" value="add">';
431 print
'<input type="hidden" name="clos" value="0">';
432 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
436 print
'<table class="border centpercent tableforfieldcreate">';
439 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
440 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>';
443 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
444 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
447 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
453 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
455 $selectedcode =
$object->currency_code;
456 if (!$selectedcode) {
457 $selectedcode =
$conf->currency;
459 print $form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
465 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
467 print $form->selectarray(
"clos",
$object->labelStatus, (
GETPOSTINT(
'clos') !=
'' ?
GETPOSTINT(
'clos') :
$object->
status), 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth150onsmartphone');
473 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") :
$object->country_code;
474 } elseif (empty($selectedcode)) {
475 $selectedcode =
$mysoc->country_code;
479 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
481 print img_picto(
'',
'country',
'class="pictofixedwidth"');
482 print $form->select_country($selectedcode,
'account_country_id');
484 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
489 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
491 print img_picto(
'',
'state',
'class="pictofixedwidth"');
492 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOSTINT(
"account_state_id") : 0, $selectedcode,
'account_state_id');
494 print $countrynotdefined;
501 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
502 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
504 print
"</textarea></td></tr>";
508 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
510 print img_picto(
'',
'globe',
'class="pictofixedwidth"');
511 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
516 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
517 print $form->selectCategories(Categorie::TYPE_ACCOUNT,
'categories', $object);
522 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
525 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
526 $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%');
527 $doleditor->Create();
531 $parameters = array();
532 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
533 print $hookmanager->resPrint;
534 if (empty($reshook)) {
535 print
$object->showOptionals($extrafields,
'create', $parameters);
542 print
'<table class="border centpercent">';
545 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
546 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOSTISSET(
"solde") ?
GETPOST(
"solde") :
price2num(
$object->solde)).
'"></td></tr>';
548 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
551 print $form->selectDate($startdate,
're', 0, 0, 0,
'formsoc');
554 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
555 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>';
557 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
558 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>';
565 print
'<table class="border centpercent">';
568 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
569 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOSTISSET(
'bank') ?
GETPOST(
'bank',
'alpha') :
$object->bank).
'"></td>';
573 $bickey =
"BICNumber";
574 if (
$object->getCountryCode() ==
'IN') {
579 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
580 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') :
$object->iban).
'"></td></tr>';
583 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
584 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') :
$object->bic).
'"></td></tr>';
588 foreach (
$object->getFieldsToShow() as $val) {
590 if ($val ==
'BankCode') {
591 $name =
'code_banque';
592 $sizecss =
'minwidth100';
593 $content =
$object->code_banque;
594 } elseif ($val ==
'DeskCode') {
595 $name =
'code_guichet';
596 $sizecss =
'minwidth100';
597 $content =
$object->code_guichet;
598 } elseif ($val ==
'BankAccountNumber') {
600 $sizecss =
'minwidth200';
602 } elseif ($val ==
'BankAccountNumberKey') {
604 $sizecss =
'minwidth50';
608 $sizecss =
'undefined';
609 $content =
'undefined';
612 print
'<td>'.$langs->trans($val).
'</td>';
613 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
619 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
620 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'>';
627 print
'<table class="border centpercent">';
628 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwner").
'</td>';
629 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'">';
632 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
633 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
635 print
"</textarea></td></tr>";
637 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
638 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
641 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
642 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
645 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
647 print img_picto(
'',
'country',
'class="pictofixedwidth"');
648 print $form->select_country(
GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
655 print
'<table class="border centpercent">';
659 $fieldrequired =
'fieldrequired ';
664 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
666 print img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
667 print $formaccounting->select_account(
$object->account_number,
'account_number', 1, array(), 1, 1);
668 if ($formaccounting->nbaccounts == 0) {
669 $langs->load(
"errors");
670 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
671 print $form->textwithpicto(
'', $htmltext);
675 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
676 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') :
$object->account_number).
'"></td></tr>';
682 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyJournal").
'</td>';
684 print $formaccounting->select_journal((
string)
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
692 print $form->buttonsSaveCancel(
"CreateAccount");
701 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account', 0,
'',
'', 0,
'', 1);
706 if ($action ==
'delete') {
707 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
713 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
716 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
718 print
'<div class="fichecenter">';
719 print
'<div class="fichehalfleft">';
720 print
'<div class="underbanner clearboth"></div>';
722 print
'<table class="border centpercent tableforfield">';
725 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"AccountType").
'</td>';
726 print
'<td>'.$object->type_lib[
$object->type].
'</td></tr>';
729 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
731 $selectedcode =
$object->currency_code;
732 if (!$selectedcode) {
733 $selectedcode =
$conf->currency;
735 print $langs->trans(
"Currency".$selectedcode);
739 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
741 $conciliate =
$object->canBeConciliated();
742 if ($conciliate == -2) {
743 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
744 } elseif ($conciliate == -3) {
745 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
747 print(
$object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
751 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
752 print
'<td>'.$object->min_allowed.
'</td></tr>';
754 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
755 print
'<td>'.$object->min_desired.
'</td></tr>';
758 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
761 if (empty(
$object->account_number)) {
762 print img_warning($langs->trans(
"Mandatory"));
765 $accountingaccount->fetch(0,
$object->account_number, 1);
766 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
775 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
777 if (empty(
$object->fk_accountancy_journal)) {
778 print img_warning($langs->trans(
"Mandatory"));
779 } elseif (
$object->fk_accountancy_journal > 0) {
781 $accountingjournal->fetch(
$object->fk_accountancy_journal);
782 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
789 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
794 print
'<div class="fichehalfright">';
795 print
'<div class="underbanner clearboth"></div>';
797 print
'<table class="border tableforfield centpercent">';
801 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
802 print $form->showCategories(
$object->id, Categorie::TYPE_ACCOUNT, 1);
806 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
807 print
'<td>'.dol_htmlentitiesbr(
$object->comment).
'</td></tr>';
812 print
'<table class="border tableforfield centpercent">';
814 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"BankName").
'</td>';
815 print
'<td>'.$object->bank.
'</td></tr>';
818 $bickey =
"BICNumber";
819 if (
$object->getCountryCode() ==
'IN') {
824 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
825 print
'<td>'.getIbanHumanReadable($object).
' ';
828 print img_picto($langs->trans(
"IbanNotValid"),
'warning');
830 print img_picto($langs->trans(
"IbanValid"),
'tick');
836 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
837 print
'<td>'.$object->bic.
' ';
840 print img_picto($langs->trans(
"SwiftNotValid"),
'warning');
842 print img_picto($langs->trans(
"SwiftValid"),
'tick');
850 foreach (
$object->getFieldsToShow() as $val) {
852 if ($val ==
'BankCode') {
853 $content =
$object->code_banque;
854 } elseif ($val ==
'DeskCode') {
855 $content =
$object->code_guichet;
856 } elseif ($val ==
'BankAccountNumber') {
858 } elseif ($val ==
'BankAccountNumberKey') {
862 print
'<tr><td>'.$langs->trans($val).
'</td>';
863 print
'<td>'.$content.
'</td>';
868 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
869 print
'<td>'.$object->ics.
'</td>';
875 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
876 print
'<td>'.$object->ics_transfer.
'</td>';
880 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td><td>';
881 print(empty(
$object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes"));
882 print
"</td></tr>\n";
886 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
888 print
"</td></tr>\n";
890 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
891 print nl2br(
$object->owner_address);
892 print
"</td></tr>\n";
894 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
895 print
'<td>'.dol_escape_htmltag(
$object->owner_zip);
898 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
899 print
'<td>'.dol_escape_htmltag(
$object->owner_town);
902 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
905 $langs->load(
"dict");
906 print(empty(
$object->owner_country_code) ?
'' : $langs->convToOutputCharset($langs->transnoentitiesnoconv(
"Country".
$object->owner_country_code)));
916 print
'<div class="clearboth"></div>';
923 print
'<div class="tabsAction">';
924 $parameters = array();
925 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
927 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
930 if (empty($reshook)) {
931 if ($user->hasRight(
'banque',
'configurer') &&
$object->status == $object::STATUS_CLOSED) {
932 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=reopen&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"ReOpen").
'</a>';
935 if ($user->hasRight(
'banque',
'configurer') &&
$object->status == $object::STATUS_OPEN) {
936 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
939 if ($user->hasRight(
'banque',
'configurer') &&
$object->status == $object::STATUS_OPEN) {
940 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=close&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Close").
'</a>';
943 $canbedeleted =
$object->can_be_deleted();
944 if ($user->hasRight(
'banque',
'configurer') && $canbedeleted) {
945 print dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
958 if (
GETPOSTINT(
'id') && $action ==
'edit' && $user->hasRight(
'banque',
'configurer')) {
959 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
961 if (
$conf->use_javascript_ajax) {
962 print
"\n".
'<script type="text/javascript">';
963 print
'jQuery(document).ready(function () {
964 jQuery("#type").change(function() {
965 document.formsoc.action.value="edit";
966 document.formsoc.submit();
970 print
'jQuery(document).ready(function () {
971 jQuery("#selectaccount_country_id").change(function() {
972 document.formsoc.action.value="edit";
973 document.formsoc.submit();
976 print
'</script>'.
"\n";
979 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post" name="formsoc">';
980 print
'<input type="hidden" name="token" value="'.newToken().
'">';
981 print
'<input type="hidden" name="action" value="update">';
982 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">'.
"\n\n";
983 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
989 print
'<table class="border centpercent tableforfieldcreate">';
992 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
993 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>';
996 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
997 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') :
$object->label).
'"></td></tr>';
1000 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
1001 print
'<td class="maxwidth200onsmartphone">';
1006 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
1007 print
'<input type="hidden" value="'.$object->currency_code.
'">';
1009 print
'<td class="maxwidth200onsmartphone">';
1010 $selectedcode =
$object->currency_code;
1011 if (!$selectedcode) {
1012 $selectedcode =
$conf->currency;
1014 print img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
1015 print $form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
1021 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
1022 print
'<td class="maxwidth200onsmartphone">';
1028 $selectedcode =
$object->country_code;
1030 $selectedcode =
GETPOST(
"account_country_id");
1031 } elseif (empty($selectedcode)) {
1032 $selectedcode =
$mysoc->country_code;
1036 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
1037 print
'<td class="maxwidth200onsmartphone">';
1038 print img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
1040 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1045 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1046 if ($selectedcode) {
1047 print img_picto(
'',
'state',
'class="pictofixedwidth"');
1048 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
$object->state_id, $selectedcode,
'account_state_id');
1050 print $countrynotdefined;
1057 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1058 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
1060 print
"</textarea></td></tr>";
1064 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
1066 $conciliate =
$object->canBeConciliated();
1067 if ($conciliate == -2) {
1068 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
1069 } elseif ($conciliate == -3) {
1070 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
1072 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro" class="opacitymedium">'.$langs->trans(
"DisableConciliation").
'</label>';
1077 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
1078 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>';
1080 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
1081 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>';
1084 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
1086 print img_picto(
'',
'globe',
'class="pictofixedwidth"');
1087 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") :
$object->url).
'">';
1092 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1093 print $form->selectCategories(Categorie::TYPE_ACCOUNT,
'categories', $object);
1098 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
1101 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1102 $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%');
1103 $doleditor->Create();
1107 $parameters = array();
1108 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
1109 print $hookmanager->resPrint;
1110 if (empty($reshook)) {
1111 print
$object->showOptionals($extrafields,
'edit', $parameters);
1120 print
'<table class="border centpercent">';
1123 $tdextra =
' class="titlefieldcreate"';
1126 $tdextra =
' class="fieldrequired titlefieldcreate"';
1129 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1133 print img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
1134 print $formaccounting->select_account(
$object->account_number,
'account_number', 1, array(), 1, 1);
1135 if ($formaccounting->nbaccounts == 0) {
1136 $langs->load(
"errors");
1137 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
1138 print $form->textwithpicto(
'', $htmltext);
1141 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") :
$object->account_number).
'">';
1148 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1150 print $formaccounting->select_journal((
string)
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1160 print
'<table class="border centpercent">';
1163 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1164 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1168 $bickey =
"BICNumber";
1169 if (
$object->getCountryCode() ==
'IN') {
1175 $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';
1176 print $form->textwithpicto($langs->trans($ibankey), $tooltip, 1,
'help',
'', 0, 3,
'iban');
1178 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') :
$object->iban).
'"></td></tr>';
1182 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1183 print $form->textwithpicto($langs->trans($bickey), $tooltip, 1,
'help',
'', 0, 3,
'bic');
1185 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') :
$object->bic).
'"></td></tr>';
1188 foreach (
$object->getFieldsToShow() as $val) {
1190 if ($val ==
'BankCode') {
1191 $name =
'code_banque';
1193 $content =
$object->code_banque;
1194 } elseif ($val ==
'DeskCode') {
1195 $name =
'code_guichet';
1197 $content =
$object->code_guichet;
1198 } elseif ($val ==
'BankAccountNumber') {
1202 } elseif ($val ==
'BankAccountNumberKey') {
1207 $name =
'undefined';
1209 $content =
'undefined';
1212 print
'<tr><td>'.$langs->trans($val).
'</td>';
1213 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1218 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1219 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') :
$object->ics).
'"></td></tr>';
1224 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1225 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>';
1227 if (
$mysoc->isInSEPA()) {
1228 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
1229 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (
$object->pti_in_ctti ?
' checked ' :
'') .
'>';
1238 print
'<table class="border centpercent">';
1240 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1241 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'"></td>';
1244 print
'<tr><td class="titlefieldcreate tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1245 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1247 print
"</textarea></td></tr>";
1249 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
1250 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
1253 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
1254 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
1257 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
1259 print img_picto(
'',
'country',
'class="pictofixedwidth"');
1260 print $form->select_country(
GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
1268 print $form->buttonsSaveCancel(
"Modify");
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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 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...
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='', $useCache=true)
Return an id or code from a code or id.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
div refaddress div address
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.