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") ?
GETPOSTINT(
"account_state_id") : 0, $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 print $form->selectCategories(Categorie::TYPE_ACCOUNT,
'categories',
$object);
503 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
506 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
507 $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%');
508 $doleditor->Create();
512 $parameters = array();
513 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
514 print $hookmanager->resPrint;
515 if (empty($reshook)) {
516 print
$object->showOptionals($extrafields,
'create', $parameters);
523 print
'<table class="border centpercent">';
526 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
527 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOSTISSET(
"solde") ?
GETPOST(
"solde") :
price2num(
$object->solde)).
'"></td></tr>';
529 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
532 print $form->selectDate($startdate,
're', 0, 0, 0,
'formsoc');
535 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
536 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>';
538 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
539 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>';
546 print
'<table class="border centpercent">';
549 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
550 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOSTISSET(
'bank') ?
GETPOST(
'bank',
'alpha') :
$object->bank).
'"></td>';
554 $bickey =
"BICNumber";
555 if (
$object->getCountryCode() ==
'IN') {
560 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
561 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') :
$object->iban).
'"></td></tr>';
564 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
565 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') :
$object->bic).
'"></td></tr>';
569 foreach (
$object->getFieldsToShow() as $val) {
571 if ($val ==
'BankCode') {
572 $name =
'code_banque';
573 $sizecss =
'minwidth100';
574 $content =
$object->code_banque;
575 } elseif ($val ==
'DeskCode') {
576 $name =
'code_guichet';
577 $sizecss =
'minwidth100';
578 $content =
$object->code_guichet;
579 } elseif ($val ==
'BankAccountNumber') {
581 $sizecss =
'minwidth200';
583 } elseif ($val ==
'BankAccountNumberKey') {
585 $sizecss =
'minwidth50';
589 $sizecss =
'undefined';
590 $content =
'undefined';
593 print
'<td>'.$langs->trans($val).
'</td>';
594 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
598 if (isModEnabled(
'paymentbybanktransfer')) {
599 if ($mysoc->isInSEPA()) {
600 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
601 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'>';
608 print
'<table class="border centpercent">';
609 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwner").
'</td>';
610 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'">';
613 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
614 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
615 print(GETPOSTISSET(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') :
$object->owner_address);
616 print
"</textarea></td></tr>";
618 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
619 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
622 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
623 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
626 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
628 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
629 print $form->select_country(GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
636 print
'<table class="border centpercent">';
640 $fieldrequired =
'fieldrequired ';
643 if (isModEnabled(
'accounting')) {
645 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
647 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
648 print $formaccounting->select_account(
$object->account_number,
'account_number', 1, array(), 1, 1);
649 if ($formaccounting->nbaccounts == 0) {
650 $langs->load(
"errors");
651 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
652 print $form->textwithpicto(
'', $htmltext);
656 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
657 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') :
$object->account_number).
'"></td></tr>';
661 if (isModEnabled(
'accounting')) {
663 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyJournal").
'</td>';
665 print $formaccounting->select_journal((
string)
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
673 print $form->buttonsSaveCancel(
"CreateAccount");
682 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account', 0,
'',
'', 0,
'', 1);
687 if ($action ==
'delete') {
688 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
694 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
697 dol_banner_tab(
$object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
699 print
'<div class="fichecenter">';
700 print
'<div class="fichehalfleft">';
701 print
'<div class="underbanner clearboth"></div>';
703 print
'<table class="border centpercent tableforfield">';
706 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
707 print
'<td>'.$object->type_lib[
$object->type].
'</td></tr>';
710 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
712 $selectedcode =
$object->currency_code;
713 if (!$selectedcode) {
714 $selectedcode =
$conf->currency;
716 print $langs->trans(
"Currency".$selectedcode);
720 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
722 $conciliate =
$object->canBeConciliated();
723 if ($conciliate == -2) {
724 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
725 } elseif ($conciliate == -3) {
726 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
728 print(
$object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
732 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
733 print
'<td>'.$object->min_allowed.
'</td></tr>';
735 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
736 print
'<td>'.$object->min_desired.
'</td></tr>';
739 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
741 if (isModEnabled(
'accounting')) {
743 $accountingaccount->fetch(0,
$object->account_number, 1);
745 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
752 if (isModEnabled(
'accounting')) {
753 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
756 if (
$object->fk_accountancy_journal > 0) {
758 $accountingjournal->fetch(
$object->fk_accountancy_journal);
760 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
767 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
772 print
'<div class="fichehalfright">';
773 print
'<div class="underbanner clearboth"></div>';
775 print
'<table class="border tableforfield centpercent">';
778 if (isModEnabled(
'category')) {
779 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
780 print $form->showCategories(
$object->id, Categorie::TYPE_ACCOUNT, 1);
784 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
785 print
'<td>'.dol_htmlentitiesbr(
$object->comment).
'</td></tr>';
790 print
'<table class="border tableforfield centpercent">';
792 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"BankName").
'</td>';
793 print
'<td>'.$object->bank.
'</td></tr>';
796 $bickey =
"BICNumber";
797 if (
$object->getCountryCode() ==
'IN') {
802 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
803 print
'<td>'.getIbanHumanReadable(
$object).
' ';
806 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
808 print
img_picto($langs->trans(
"IbanValid"),
'tick');
814 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
815 print
'<td>'.$object->bic.
' ';
818 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
820 print
img_picto($langs->trans(
"SwiftValid"),
'tick');
828 foreach (
$object->getFieldsToShow() as $val) {
830 if ($val ==
'BankCode') {
831 $content =
$object->code_banque;
832 } elseif ($val ==
'DeskCode') {
833 $content =
$object->code_guichet;
834 } elseif ($val ==
'BankAccountNumber') {
836 } elseif ($val ==
'BankAccountNumberKey') {
840 print
'<tr><td>'.$langs->trans($val).
'</td>';
841 print
'<td>'.$content.
'</td>';
845 if (isModEnabled(
'prelevement')) {
846 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
847 print
'<td>'.$object->ics.
'</td>';
851 if (isModEnabled(
'paymentbybanktransfer')) {
853 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
854 print
'<td>'.$object->ics_transfer.
'</td>';
857 if ($mysoc->isInSEPA()) {
858 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td><td>';
859 print(empty(
$object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes"));
860 print
"</td></tr>\n";
864 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
866 print
"</td></tr>\n";
868 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
869 print nl2br(
$object->owner_address);
870 print
"</td></tr>\n";
872 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
873 print
'<td>'.dol_escape_htmltag(
$object->owner_zip);
876 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
877 print
'<td>'.dol_escape_htmltag(
$object->owner_town);
880 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
883 $langs->load(
"dict");
884 print(empty(
$object->owner_country_code) ?
'' : $langs->convToOutputCharset($langs->transnoentitiesnoconv(
"Country".
$object->owner_country_code)));
894 print
'<div class="clearboth"></div>';
901 print
'<div class="tabsAction">';
903 if ($user->hasRight(
'banque',
'configurer')) {
904 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
907 $canbedeleted =
$object->can_be_deleted();
908 if ($user->hasRight(
'banque',
'configurer') && $canbedeleted) {
909 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.
$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
921 if (
GETPOSTINT(
'id') && $action ==
'edit' && $user->hasRight(
'banque',
'configurer')) {
922 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
924 if (
$conf->use_javascript_ajax) {
925 print
"\n".
'<script type="text/javascript">';
926 print
'jQuery(document).ready(function () {
927 jQuery("#type").change(function() {
928 document.formsoc.action.value="edit";
929 document.formsoc.submit();
933 print
'jQuery(document).ready(function () {
934 jQuery("#selectaccount_country_id").change(function() {
935 document.formsoc.action.value="edit";
936 document.formsoc.submit();
939 print
'</script>'.
"\n";
942 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="post" name="formsoc">';
943 print
'<input type="hidden" name="token" value="'.newToken().
'">';
944 print
'<input type="hidden" name="action" value="update">';
945 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">'.
"\n\n";
946 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
952 print
'<table class="border centpercent tableforfieldcreate">';
955 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
956 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>';
959 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
960 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') :
$object->label).
'"></td></tr>';
963 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
964 print
'<td class="maxwidth200onsmartphone">';
965 $formbank->selectTypeOfBankAccount((GETPOSTISSET(
'type') ?
GETPOSTINT(
'type') :
$object->
type),
'type');
969 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
970 print
'<input type="hidden" value="'.$object->currency_code.
'">';
972 print
'<td class="maxwidth200onsmartphone">';
973 $selectedcode =
$object->currency_code;
974 if (!$selectedcode) {
975 $selectedcode =
$conf->currency;
977 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
978 print $form->selectCurrency((GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
984 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
985 print
'<td class="maxwidth200onsmartphone">';
991 $selectedcode =
$object->country_code;
992 if (GETPOSTISSET(
"account_country_id")) {
993 $selectedcode =
GETPOST(
"account_country_id");
994 } elseif (empty($selectedcode)) {
995 $selectedcode = $mysoc->country_code;
999 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
1000 print
'<td class="maxwidth200onsmartphone">';
1001 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
1003 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1008 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
1009 if ($selectedcode) {
1010 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1011 print $formcompany->select_state(GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
$object->state_id, $selectedcode,
'account_state_id');
1013 print $countrynotdefined;
1020 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1021 print
'<textarea class="flat quatrevingtpercent" name="account_address" rows="'.ROWS_2.
'">';
1023 print
"</textarea></td></tr>";
1027 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
1029 $conciliate =
$object->canBeConciliated();
1030 if ($conciliate == -2) {
1031 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
1032 } elseif ($conciliate == -3) {
1033 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
1035 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro" class="opacitymedium">'.$langs->trans(
"DisableConciliation").
'</label>';
1040 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
1041 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>';
1043 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
1044 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>';
1047 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
1049 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
1050 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") :
$object->url).
'">';
1054 if (isModEnabled(
'category')) {
1055 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1056 print $form->selectCategories(Categorie::TYPE_ACCOUNT,
'categories',
$object);
1061 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
1064 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1065 $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%');
1066 $doleditor->Create();
1070 $parameters = array();
1071 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
1072 print $hookmanager->resPrint;
1073 if (empty($reshook)) {
1074 print
$object->showOptionals($extrafields,
'edit', $parameters);
1083 print
'<table class="border centpercent">';
1086 $tdextra =
' class="titlefieldcreate"';
1089 $tdextra =
' class="fieldrequired titlefieldcreate"';
1092 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1094 if (isModEnabled(
'accounting')) {
1096 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
1097 print $formaccounting->select_account(
$object->account_number,
'account_number', 1, array(), 1, 1);
1098 if ($formaccounting->nbaccounts == 0) {
1099 $langs->load(
"errors");
1100 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
1101 print $form->textwithpicto(
'', $htmltext);
1104 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") :
$object->account_number).
'">';
1109 if (isModEnabled(
'accounting')) {
1111 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1113 print $formaccounting->select_journal((
string)
$object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1123 print
'<table class="border centpercent">';
1126 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1127 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1131 $bickey =
"BICNumber";
1132 if (
$object->getCountryCode() ==
'IN') {
1138 $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';
1139 print $form->textwithpicto($langs->trans($ibankey), $tooltip, 1,
'help',
'', 0, 3,
'iban');
1141 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') :
$object->iban).
'"></td></tr>';
1145 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1146 print $form->textwithpicto($langs->trans($bickey), $tooltip, 1,
'help',
'', 0, 3,
'bic');
1148 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') :
$object->bic).
'"></td></tr>';
1151 foreach (
$object->getFieldsToShow() as $val) {
1153 if ($val ==
'BankCode') {
1154 $name =
'code_banque';
1156 $content =
$object->code_banque;
1157 } elseif ($val ==
'DeskCode') {
1158 $name =
'code_guichet';
1160 $content =
$object->code_guichet;
1161 } elseif ($val ==
'BankAccountNumber') {
1165 } elseif ($val ==
'BankAccountNumberKey') {
1170 $name =
'undefined';
1172 $content =
'undefined';
1175 print
'<tr><td>'.$langs->trans($val).
'</td>';
1176 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1180 if (isModEnabled(
'prelevement')) {
1181 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1182 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') :
$object->ics).
'"></td></tr>';
1185 if (isModEnabled(
'paymentbybanktransfer')) {
1187 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1188 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>';
1190 if ($mysoc->isInSEPA()) {
1191 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
1192 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (
$object->pti_in_ctti ?
' checked ' :
'') .
'>';
1201 print
'<table class="border centpercent">';
1203 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1204 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.(GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') :
$object->owner_name).
'"></td>';
1207 print
'<tr><td class="titlefieldcreate tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1208 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1209 print GETPOSTISSET(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') :
$object->owner_address;
1210 print
"</textarea></td></tr>";
1212 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
1213 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOSTISSET(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') :
$object->owner_zip).
'">';
1216 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
1217 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOSTISSET(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') :
$object->owner_town).
'">';
1220 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
1222 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1223 print $form->select_country(GETPOSTISSET(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') :
$object->owner_country_id,
'owner_country_id');
1231 print $form->buttonsSaveCancel(
"Modify");
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
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, $allowothertags=array())
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, $morecssdiv='')
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.
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|dolcrypt):/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.