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';
64$langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta",
"withdrawals"));
66$action =
GETPOST(
'action',
'aZ09');
67$cancel =
GETPOST(
'cancel',
'alpha');
68$backtopage =
GETPOST(
'backtopage',
'alpha');
69$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
75$extrafields->fetch_name_optionals_label(
$object->table_element);
78$hookmanager->initHooks(array(
'bankcard',
'globalcard'));
93$result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
100$parameters = array();
101$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
106if (empty($reshook)) {
107 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
109 if (empty($backtopage) || ($cancel && empty($id))) {
110 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
111 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
112 $backtopage = $backurlforlist;
114 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
120 if (!empty($backtopageforcancel)) {
121 header(
"Location: ".$backtopageforcancel);
123 } elseif (!empty($backtopage)) {
124 header(
"Location: ".$backtopage);
130 if ($action ==
'add' && $user->hasRight(
'banque',
'configurer')) {
156 $object->address = trim(
GETPOST(
"account_address",
"alphanohtml"));
159 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
167 $account_number =
GETPOST(
'account_number',
'alphanohtml');
168 if (empty($account_number) || $account_number ==
'-1') {
171 $object->account_number = $account_number;
173 $fk_accountancy_journal =
GETPOSTINT(
'fk_accountancy_journal');
174 if ($fk_accountancy_journal <= 0) {
175 $object->fk_accountancy_journal = 0;
177 $object->fk_accountancy_journal = $fk_accountancy_journal;
191 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
193 $object->fk_user_author = $user->id;
196 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
201 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
206 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
212 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
218 $categories =
GETPOST(
'categories',
'array');
219 $object->setCategories($categories);
235 $urltogo = $backtopage ? str_replace(
'__ID__', (
string)
$object->id, $backtopage) : $backurlforlist;
236 $urltogo = preg_replace(
'/--IDFORBACKTOPAGE--/', (
string)
$object->id, $urltogo);
238 if (empty($noback)) {
239 header(
"Location: " . $urltogo);
247 if ($action ==
'update' && $user->hasRight(
'banque',
'configurer')) {
274 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
282 $account_number =
GETPOST(
'account_number',
'alphanohtml');
283 if (empty($account_number) || $account_number ==
'-1') {
286 $object->account_number = $account_number;
288 $fk_accountancy_journal =
GETPOSTINT(
'fk_accountancy_journal');
289 if ($fk_accountancy_journal <= 0) {
290 $object->fk_accountancy_journal = 0;
292 $object->fk_accountancy_journal = $fk_accountancy_journal;
297 $object->address = trim(
GETPOST(
"account_address",
"alphanohtml"));
303 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
306 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
311 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
316 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
325 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
329 $result =
$object->update($user);
332 $categories =
GETPOST(
'categories',
'array');
333 $object->setCategories($categories);
350 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->hasRight(
'banque',
'configurer')) {
354 $result =
$object->delete($user);
358 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
372$form =
new Form($db);
375if (isModEnabled(
'accounting')) {
379$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
381$help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
382if ($action ==
'create') {
383 $title = $langs->trans(
"NewFinancialAccount");
384} elseif (!empty(
$object->ref)) {
385 $title =
$object->ref.
" - ".$langs->trans(
"Card");
391if ($action ==
'create') {
392 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
394 if (
$conf->use_javascript_ajax) {
395 print
"\n".
'<script type="text/javascript">';
396 print
'jQuery(document).ready(function () {
397 jQuery("#type").change(function() {
398 document.formsoc.action.value="create";
399 document.formsoc.submit();
401 jQuery("#selectaccount_country_id").change(function() {
402 document.formsoc.action.value="create";
403 document.formsoc.submit();
406 print
'</script>'.
"\n";
409 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
410 print
'<input type="hidden" name="token" value="'.newToken().
'">';
411 print
'<input type="hidden" name="action" value="add">';
412 print
'<input type="hidden" name="clos" value="0">';
413 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
417 print
'<table class="border centpercent tableforfieldcreate">';
420 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
421 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>';
424 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
425 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
428 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
430 $formbank->selectTypeOfBankAccount(GETPOSTISSET(
"type") ?
GETPOSTINT(
'type') :
Account::TYPE_CURRENT,
'type');
434 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
436 $selectedcode =
$object->currency_code;
437 if (!$selectedcode) {
438 $selectedcode =
$conf->currency;
440 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
446 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
448 print $form->selectarray(
"clos",
$object->labelStatus, (
GETPOSTINT(
'clos') !=
'' ?
GETPOSTINT(
'clos') :
$object->
status), 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth150onsmartphone');
453 if (GETPOSTISSET(
"account_country_id")) {
454 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") :
$object->country_code;
455 } elseif (empty($selectedcode)) {
456 $selectedcode = $mysoc->country_code;
460 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
462 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
463 print $form->select_country($selectedcode,
'account_country_id');
465 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
470 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
472 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
473 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
475 print $countrynotdefined;
482 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
483 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
485 print
"</textarea></td></tr>";
489 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
491 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
492 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
496 if (isModEnabled(
'category')) {
497 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
498 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 3);
500 $arrayselected = array();
502 $cats = $c->containing(
$object->id, Categorie::TYPE_ACCOUNT);
503 if (is_array($cats)) {
504 foreach ($cats as $cat) {
505 $arrayselected[] = $cat->id;
508 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
513 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
516 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
517 $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%');
518 $doleditor->Create();
522 $parameters = array();
523 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
524 print $hookmanager->resPrint;
525 if (empty($reshook)) {
526 print
$object->showOptionals($extrafields,
'create', $parameters);
533 print
'<table class="border centpercent">';
536 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
537 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOSTISSET(
"solde") ?
GETPOST(
"solde") :
price2num(
$object->solde)).
'"></td></tr>';
539 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
542 print $form->selectDate($startdate,
're', 0, 0, 0,
'formsoc');
545 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
546 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>';
548 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
549 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>';
556 print
'<table class="border centpercent">';
559 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
560 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOSTISSET(
'bank') ?
GETPOST(
'bank',
'alpha') :
$object->bank).
'"></td>';
564 $bickey =
"BICNumber";
565 if (
$object->getCountryCode() ==
'IN') {
570 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
571 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') :
$object->iban).
'"></td></tr>';
574 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
575 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') :
$object->bic).
'"></td></tr>';
579 foreach (
$object->getFieldsToShow() as $val) {
581 if ($val ==
'BankCode') {
582 $name =
'code_banque';
583 $sizecss =
'minwidth100';
584 $content =
$object->code_banque;
585 } elseif ($val ==
'DeskCode') {
586 $name =
'code_guichet';
587 $sizecss =
'minwidth100';
588 $content =
$object->code_guichet;
589 } elseif ($val ==
'BankAccountNumber') {
591 $sizecss =
'minwidth200';
593 } elseif ($val ==
'BankAccountNumberKey') {
595 $sizecss =
'minwidth50';
599 $sizecss =
'undefined';
600 $content =
'undefined';
603 print
'<td>'.$langs->trans($val).
'</td>';
604 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
608 if (isModEnabled(
'paymentbybanktransfer')) {
609 if ($mysoc->isInEEC()) {
610 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
611 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'>';
618 print
'<table class="border centpercent">';
619 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwner").
'</td>';
620 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'">';
623 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
624 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
625 print(GETPOSTISSET(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') :
$object->owner_address);
626 print
"</textarea></td></tr>";
628 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
629 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
632 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
633 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
636 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
638 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
639 print $form->select_country(GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
646 print
'<table class="border centpercent">';
650 $fieldrequired =
'fieldrequired ';
653 if (isModEnabled(
'accounting')) {
655 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
657 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
658 print $formaccounting->select_account(
$object->account_number,
'account_number', 1, array(), 1, 1);
659 if ($formaccounting->nbaccounts == 0) {
660 $langs->load(
"errors");
661 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
662 print $form->textwithpicto(
'', $htmltext);
666 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
667 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') :
$object->account_number).
'"></td></tr>';
671 if (isModEnabled(
'accounting')) {
673 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyJournal").
'</td>';
675 print $formaccounting->select_journal(
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
683 print $form->buttonsSaveCancel(
"CreateAccount");
692 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account', 0,
'',
'', 0,
'', 1);
697 if ($action ==
'delete') {
698 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
704 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
707 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
709 print
'<div class="fichecenter">';
710 print
'<div class="fichehalfleft">';
711 print
'<div class="underbanner clearboth"></div>';
713 print
'<table class="border centpercent tableforfield">';
716 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
717 print
'<td>'.$object->type_lib[
$object->type].
'</td></tr>';
720 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
722 $selectedcode =
$object->currency_code;
723 if (!$selectedcode) {
724 $selectedcode =
$conf->currency;
726 print $langs->trans(
"Currency".$selectedcode);
730 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
732 $conciliate =
$object->canBeConciliated();
733 if ($conciliate == -2) {
734 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
735 } elseif ($conciliate == -3) {
736 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
738 print(
$object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
742 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
743 print
'<td>'.$object->min_allowed.
'</td></tr>';
745 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
746 print
'<td>'.$object->min_desired.
'</td></tr>';
749 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
751 if (isModEnabled(
'accounting')) {
753 $accountingaccount->fetch(0,
$object->account_number, 1);
755 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
762 if (isModEnabled(
'accounting')) {
763 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
766 if (
$object->fk_accountancy_journal > 0) {
768 $accountingjournal->fetch(
$object->fk_accountancy_journal);
770 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
777 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
782 print
'<div class="fichehalfright">';
783 print
'<div class="underbanner clearboth"></div>';
785 print
'<table class="border tableforfield centpercent">';
788 if (isModEnabled(
'category')) {
789 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
790 print $form->showCategories(
$object->id, Categorie::TYPE_ACCOUNT, 1);
794 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
795 print
'<td>'.dol_htmlentitiesbr(
$object->comment).
'</td></tr>';
800 print
'<table class="border tableforfield centpercent">';
802 print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"BankName").
'</td>';
803 print
'<td>'.$object->bank.
'</td></tr>';
806 $bickey =
"BICNumber";
807 if (
$object->getCountryCode() ==
'IN') {
812 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
813 print
'<td>'.getIbanHumanReadable(
$object).
' ';
816 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
818 print
img_picto($langs->trans(
"IbanValid"),
'tick');
824 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
825 print
'<td>'.$object->bic.
' ';
828 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
830 print
img_picto($langs->trans(
"SwiftValid"),
'tick');
838 foreach (
$object->getFieldsToShow() as $val) {
840 if ($val ==
'BankCode') {
841 $content =
$object->code_banque;
842 } elseif ($val ==
'DeskCode') {
843 $content =
$object->code_guichet;
844 } elseif ($val ==
'BankAccountNumber') {
846 } elseif ($val ==
'BankAccountNumberKey') {
850 print
'<tr><td>'.$langs->trans($val).
'</td>';
851 print
'<td>'.$content.
'</td>';
855 if (isModEnabled(
'prelevement')) {
856 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
857 print
'<td>'.$object->ics.
'</td>';
861 if (isModEnabled(
'paymentbybanktransfer')) {
863 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
864 print
'<td>'.$object->ics_transfer.
'</td>';
867 if ($mysoc->isInEEC()) {
868 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td><td>';
869 print(empty(
$object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes"));
870 print
"</td></tr>\n";
874 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
876 print
"</td></tr>\n";
878 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
879 print nl2br(
$object->owner_address);
880 print
"</td></tr>\n";
882 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
883 print
'<td>'.dol_escape_htmltag(
$object->owner_zip);
886 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
887 print
'<td>'.dol_escape_htmltag(
$object->owner_town);
890 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
893 $langs->load(
"dict");
894 print(empty(
$object->owner_country_code) ?
'' : $langs->convToOutputCharset($langs->transnoentitiesnoconv(
"Country".
$object->owner_country_code)));
904 print
'<div class="clearboth"></div>';
911 print
'<div class="tabsAction">';
913 if ($user->hasRight(
'banque',
'configurer')) {
914 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
917 $canbedeleted =
$object->can_be_deleted();
918 if ($user->hasRight(
'banque',
'configurer') && $canbedeleted) {
919 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
931 if (
GETPOSTINT(
'id') && $action ==
'edit' && $user->hasRight(
'banque',
'configurer')) {
932 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
934 if (
$conf->use_javascript_ajax) {
935 print
"\n".
'<script type="text/javascript">';
936 print
'jQuery(document).ready(function () {
937 jQuery("#type").change(function() {
938 document.formsoc.action.value="edit";
939 document.formsoc.submit();
943 print
'jQuery(document).ready(function () {
944 jQuery("#selectaccount_country_id").change(function() {
945 document.formsoc.action.value="edit";
946 document.formsoc.submit();
949 print
'</script>'.
"\n";
952 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post" name="formsoc">';
953 print
'<input type="hidden" name="token" value="'.newToken().
'">';
954 print
'<input type="hidden" name="action" value="update">';
955 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">'.
"\n\n";
956 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
962 print
'<table class="border centpercent tableforfieldcreate">';
965 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
966 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>';
969 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
970 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') :
$object->label).
'"></td></tr>';
973 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
974 print
'<td class="maxwidth200onsmartphone">';
975 $formbank->selectTypeOfBankAccount((GETPOSTISSET(
'type') ?
GETPOSTINT(
'type') :
$object->
type),
'type');
979 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
980 print
'<input type="hidden" value="'.$object->currency_code.
'">';
982 print
'<td class="maxwidth200onsmartphone">';
983 $selectedcode =
$object->currency_code;
984 if (!$selectedcode) {
985 $selectedcode =
$conf->currency;
987 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
988 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
994 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
995 print
'<td class="maxwidth200onsmartphone">';
1001 $selectedcode =
$object->country_code;
1002 if (GETPOSTISSET(
"account_country_id")) {
1003 $selectedcode =
GETPOST(
"account_country_id");
1004 } elseif (empty($selectedcode)) {
1005 $selectedcode = $mysoc->country_code;
1009 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
1010 print
'<td class="maxwidth200onsmartphone">';
1011 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
1013 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1018 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1019 if ($selectedcode) {
1020 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1021 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
$object->state_id, $selectedcode,
'account_state_id');
1023 print $countrynotdefined;
1030 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1031 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
1033 print
"</textarea></td></tr>";
1037 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
1039 $conciliate =
$object->canBeConciliated();
1040 if ($conciliate == -2) {
1041 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
1042 } elseif ($conciliate == -3) {
1043 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
1045 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro" class="opacitymedium">'.$langs->trans(
"DisableConciliation").
'</label>';
1050 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
1051 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>';
1053 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
1054 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>';
1057 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
1059 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
1060 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") :
$object->url).
'">';
1064 if (isModEnabled(
'category')) {
1065 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1066 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 3);
1068 $arrayselected = array();
1070 $cats = $c->containing(
$object->id, Categorie::TYPE_ACCOUNT);
1071 if (is_array($cats)) {
1072 foreach ($cats as $cat) {
1073 $arrayselected[] = $cat->id;
1076 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected, 0, 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1081 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
1084 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1085 $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%');
1086 $doleditor->Create();
1090 $parameters = array();
1091 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1092 print $hookmanager->resPrint;
1093 if (empty($reshook)) {
1094 print
$object->showOptionals($extrafields,
'edit', $parameters);
1103 print
'<table class="border centpercent">';
1106 $tdextra =
' class="titlefieldcreate"';
1109 $tdextra =
' class="fieldrequired titlefieldcreate"';
1112 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1114 if (isModEnabled(
'accounting')) {
1116 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
1117 print $formaccounting->select_account(
$object->account_number,
'account_number', 1, array(), 1, 1);
1118 if ($formaccounting->nbaccounts == 0) {
1119 $langs->load(
"errors");
1120 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
1121 print $form->textwithpicto(
'', $htmltext);
1124 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") :
$object->account_number).
'">';
1129 if (isModEnabled(
'accounting')) {
1131 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1133 print $formaccounting->select_journal(
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1143 print
'<table class="border centpercent">';
1146 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1147 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1151 $bickey =
"BICNumber";
1152 if (
$object->getCountryCode() ==
'IN') {
1158 $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';
1159 print $form->textwithpicto($langs->trans($ibankey), $tooltip, 1,
'help',
'', 0, 3,
'iban');
1161 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') :
$object->iban).
'"></td></tr>';
1165 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1166 print $form->textwithpicto($langs->trans($bickey), $tooltip, 1,
'help',
'', 0, 3,
'bic');
1168 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') :
$object->bic).
'"></td></tr>';
1171 foreach (
$object->getFieldsToShow() as $val) {
1173 if ($val ==
'BankCode') {
1174 $name =
'code_banque';
1176 $content =
$object->code_banque;
1177 } elseif ($val ==
'DeskCode') {
1178 $name =
'code_guichet';
1180 $content =
$object->code_guichet;
1181 } elseif ($val ==
'BankAccountNumber') {
1185 } elseif ($val ==
'BankAccountNumberKey') {
1190 $name =
'undefined';
1192 $content =
'undefined';
1195 print
'<tr><td>'.$langs->trans($val).
'</td>';
1196 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1200 if (isModEnabled(
'prelevement')) {
1201 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1202 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') :
$object->ics).
'"></td></tr>';
1205 if (isModEnabled(
'paymentbybanktransfer')) {
1207 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1208 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>';
1210 if ($mysoc->isInEEC()) {
1211 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
1212 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (
$object->pti_in_ctti ?
' checked ' :
'') .
'>';
1221 print
'<table class="border centpercent">';
1223 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1224 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'"></td>';
1227 print
'<tr><td class="titlefieldcreate tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1228 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1229 print GETPOSTISSET(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') :
$object->owner_address;
1230 print
"</textarea></td></tr>";
1232 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
1233 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
1236 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
1237 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
1240 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
1242 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1243 print $form->select_country(GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
1251 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
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.