33 require
'../../main.inc.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
54 $langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta",
"withdrawals"));
56 $action =
GETPOST(
'action',
'aZ09');
57 $cancel =
GETPOST(
'cancel',
'alpha');
58 $backtopage =
GETPOST(
'backtopage',
'alpha');
59 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
65 $extrafields->fetch_name_optionals_label($object->table_element);
68 $hookmanager->initHooks(array(
'bankcard',
'globalcard'));
72 $fieldid =
GETPOST(
"id",
'int') ?
'rowid' :
'ref';
76 $object->fetch(
GETPOST(
"id",
'int'));
79 $object->fetch(0,
GETPOST(
"ref"));
83 $result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
91 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
92 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
94 if (empty($reshook)) {
95 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
97 if (empty($backtopage) || ($cancel && empty($id))) {
98 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
99 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
100 $backtopage = $backurlforlist;
102 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
108 if (!empty($backtopageforcancel)) {
109 header(
"Location: ".$backtopageforcancel);
111 } elseif (!empty($backtopage)) {
112 header(
"Location: ".$backtopage);
118 if ($action ==
'add') {
127 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
128 $object->courant =
GETPOST(
"type");
129 $object->clos =
GETPOST(
"clos");
130 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
131 $object->url = trim(
GETPOST(
"url",
'alpha'));
133 $object->bank = trim(
GETPOST(
"bank"));
134 $object->code_banque = trim(
GETPOST(
"code_banque"));
135 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
136 $object->number = trim(
GETPOST(
"number"));
137 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
138 $object->bic = trim(
GETPOST(
"bic"));
139 $object->iban = trim(
GETPOST(
"iban"));
140 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
141 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
143 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
144 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
145 $object->owner_zip = trim(
GETPOST(
"owner_zip",
'alphanohtml'));
146 $object->owner_town = trim(
GETPOST(
"owner_town",
'alphanohtml'));
147 $object->owner_country_id =
GETPOST(
"owner_country_id",
'int');
149 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
150 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
152 $account_number =
GETPOST(
'account_number',
'alphanohtml');
153 if (empty($account_number) || $account_number ==
'-1') {
154 $object->account_number =
'';
156 $object->account_number = $account_number;
158 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
159 if ($fk_accountancy_journal <= 0) {
160 $object->fk_accountancy_journal =
'';
162 $object->fk_accountancy_journal = $fk_accountancy_journal;
169 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
171 $object->state_id =
GETPOST(
"account_state_id",
'int');
172 $object->country_id =
GETPOST(
"account_country_id",
'int');
174 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
175 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
176 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
178 $object->fk_user_author = $user->id;
180 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
181 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
185 if (empty($object->ref)) {
186 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
190 if (empty($object->label)) {
191 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
197 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
200 $id = $object->create($user);
203 $categories =
GETPOST(
'categories',
'array');
204 $object->setCategories($categories);
220 $urltogo = $backtopage ? str_replace(
'__ID__', $object->id, $backtopage) : $backurlforlist;
221 $urltogo = preg_replace(
'/--IDFORBACKTOPAGE--/', $object->id, $urltogo);
223 if (empty($noback)) {
224 header(
"Location: " . $urltogo);
232 if ($action ==
'update') {
237 $object->fetch(
GETPOST(
"id",
'int'));
240 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
241 $object->courant =
GETPOST(
"type");
242 $object->clos =
GETPOST(
"clos");
243 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
244 $object->url = trim(
GETPOST(
"url",
'alpha'));
246 $object->bank = trim(
GETPOST(
"bank"));
247 $object->code_banque = trim(
GETPOST(
"code_banque"));
248 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
249 $object->number = trim(
GETPOST(
"number"));
250 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
251 $object->bic = trim(
GETPOST(
"bic"));
252 $object->iban = trim(
GETPOST(
"iban"));
253 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
254 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
256 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
257 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
258 $object->owner_zip = trim(
GETPOST(
"owner_zip",
'alphanohtml'));
259 $object->owner_town = trim(
GETPOST(
"owner_town",
'alphanohtml'));
260 $object->owner_country_id =
GETPOST(
"owner_country_id",
'int');
262 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
263 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
265 $account_number =
GETPOST(
'account_number',
'alphanohtml');
266 if (empty($account_number) || $account_number ==
'-1') {
267 $object->account_number =
'';
269 $object->account_number = $account_number;
271 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
272 if ($fk_accountancy_journal <= 0) {
273 $object->fk_accountancy_journal =
'';
275 $object->fk_accountancy_journal = $fk_accountancy_journal;
278 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
280 $object->state_id =
GETPOST(
"account_state_id",
'int');
281 $object->country_id =
GETPOST(
"account_country_id",
'int');
283 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
284 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
285 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
287 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
288 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
292 if (empty($object->ref)) {
293 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
297 if (empty($object->label)) {
298 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
307 $ret = $extrafields->setOptionalsFromPost(
null, $object);
311 $result = $object->update($user);
314 $categories =
GETPOST(
'categories',
'array');
315 $object->setCategories($categories);
317 $_GET[
"id"] =
GETPOST(
"id",
'int');
332 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->banque->configurer) {
335 $object->fetch(
GETPOST(
"id",
"int"));
336 $result = $object->delete($user);
340 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
361 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
363 $help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
364 if ($action ==
'create') {
365 $title = $langs->trans(
"NewFinancialAccount");
366 } elseif (!empty($object->ref)) {
367 $title = $object->ref.
" - ".$langs->trans(
"Card");
372 if ($action ==
'create') {
373 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
375 if ($conf->use_javascript_ajax) {
376 print
"\n".
'<script type="text/javascript">';
377 print
'jQuery(document).ready(function () {
378 jQuery("#type").change(function() {
379 document.formsoc.action.value="create";
380 document.formsoc.submit();
382 jQuery("#selectaccount_country_id").change(function() {
383 document.formsoc.action.value="create";
384 document.formsoc.submit();
387 print
'</script>'.
"\n";
390 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
391 print
'<input type="hidden" name="token" value="'.newToken().
'">';
392 print
'<input type="hidden" name="action" value="add">';
393 print
'<input type="hidden" name="clos" value="0">';
394 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
398 print
'<table class="border centpercent tableforfieldcreate">';
401 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
402 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>';
405 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
406 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
409 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
415 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
417 $selectedcode = $object->currency_code;
418 if (!$selectedcode) {
419 $selectedcode = $conf->currency;
421 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
427 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
429 print
$form->selectarray(
"clos", $object->status, (
GETPOST(
'clos',
'int') !=
'' ?
GETPOST(
'clos',
'int') : $object->clos), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150onsmartphone');
435 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") : $object->country_code;
436 } elseif (empty($selectedcode)) {
437 $selectedcode = $mysoc->country_code;
439 $object->country_code =
getCountry($selectedcode, 2);
441 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
443 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
444 print
$form->select_country($selectedcode,
'account_country_id');
446 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
451 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
453 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
454 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
456 print $countrynotdefined;
462 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
463 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
465 print
"</textarea></td></tr>";
469 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
471 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
472 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
477 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
478 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
480 $arrayselected = array();
482 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
483 if (is_array($cats)) {
484 foreach ($cats as $cat) {
485 $arrayselected[] = $cat->id;
488 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
493 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
496 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
497 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") : $object->comment),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_4,
'90%');
498 $doleditor->Create();
503 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
504 print $hookmanager->resPrint;
505 if (empty($reshook)) {
506 print $object->showOptionals($extrafields,
'create',
$parameters);
513 print
'<table class="border centpercent">';
516 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
517 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST(
"solde") ?
GETPOST(
"solde") :
price2num($object->solde)).
'"></td></tr>';
519 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
521 print
$form->selectDate(
'',
're', 0, 0, 0,
'formsoc');
524 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
525 print
'<td><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(GETPOST(
"account_min_allowed") ?
GETPOST(
"account_min_allowed") : $object->min_allowed).
'"></td></tr>';
527 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
528 print
'<td><input size="12" type="text" class="flat" name="account_min_desired" value="'.(GETPOST(
"account_min_desired") ?
GETPOST(
"account_min_desired") : $object->min_desired).
'"></td></tr>';
535 print
'<table class="border centpercent">';
538 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
539 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST(
'bank') ?
GETPOST(
'bank',
'alpha') : $object->bank).
'"></td>';
543 $bickey =
"BICNumber";
544 if ($object->getCountryCode() ==
'IN') {
549 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
550 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') : $object->iban).
'"></td></tr>';
553 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
554 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') : $object->bic).
'"></td></tr>';
558 foreach ($object->getFieldsToShow() as $val) {
560 if ($val ==
'BankCode') {
561 $name =
'code_banque';
562 $sizecss =
'minwidth100';
563 $content = $object->code_banque;
564 } elseif ($val ==
'DeskCode') {
565 $name =
'code_guichet';
566 $sizecss =
'minwidth100';
567 $content = $object->code_guichet;
568 } elseif ($val ==
'BankAccountNumber') {
570 $sizecss =
'minwidth200';
571 $content = $object->number;
572 } elseif ($val ==
'BankAccountNumberKey') {
574 $sizecss =
'minwidth50';
575 $content = $object->cle_rib;
578 print
'<td>'.$langs->trans($val).
'</td>';
579 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
584 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
585 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'>';
591 print
'<table class="border centpercent">';
592 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwner").
'</td>';
593 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $object->proprio).
'">';
596 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
597 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
598 print (
GETPOST(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') : $object->owner_address);
599 print
"</textarea></td></tr>";
601 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
602 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') : $object->owner_zip).
'">';
605 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
606 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') : $object->owner_town).
'">';
609 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
611 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
612 print
$form->select_country(
GETPOST(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') : $object->owner_country_id,
'owner_country_id');
619 print
'<table class="border centpercent">';
622 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
623 $fieldrequired =
'fieldrequired ';
627 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
629 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
630 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
631 if ($formaccounting->nbaccounts == 0) {
632 $langs->load(
"errors");
633 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
634 print
$form->textwithpicto(
'', $htmltext);
638 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
639 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') : $object->account_number).
'"></td></tr>';
644 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
646 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
654 print
$form->buttonsSaveCancel(
"CreateAccount");
659 if ((
GETPOST(
"id",
'int') ||
GETPOST(
"ref")) && $action !=
'edit') {
663 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account', 0,
'',
'', 0,
'', 1);
668 if ($action ==
'delete') {
669 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
675 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
678 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
681 print
'<div class="fichecenter">';
682 print
'<div class="fichehalfleft">';
683 print
'<div class="underbanner clearboth"></div>';
685 print
'<table class="border centpercent tableforfield">';
688 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
689 print
'<td>'.$object->type_lib[$object->type].
'</td></tr>';
692 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
694 $selectedcode = $object->currency_code;
695 if (!$selectedcode) {
696 $selectedcode = $conf->currency;
698 print $langs->trans(
"Currency".$selectedcode);
702 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
704 $conciliate = $object->canBeConciliated();
705 if ($conciliate == -2) {
706 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
707 } elseif ($conciliate == -3) {
708 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
710 print ($object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
714 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
715 print
'<td>'.$object->min_allowed.
'</td></tr>';
717 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
718 print
'<td>'.$object->min_desired.
'</td></tr>';
721 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
725 $accountingaccount->fetch(
'', $object->account_number, 1);
727 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
729 print $object->account_number;
735 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
738 if ($object->fk_accountancy_journal > 0) {
740 $accountingjournal->fetch($object->fk_accountancy_journal);
742 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
749 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
754 print
'<div class="fichehalfright">';
755 print
'<div class="underbanner clearboth"></div>';
757 print
'<table class="border tableforfield centpercent">';
761 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
762 print
$form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
766 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
767 print
'<td>'.dol_htmlentitiesbr($object->comment).
'</td></tr>';
772 print
'<table class="border tableforfield centpercent">';
774 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"BankName").
'</td>';
775 print
'<td>'.$object->bank.
'</td></tr>';
778 $bickey =
"BICNumber";
779 if ($object->getCountryCode() ==
'IN') {
784 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
785 print
'<td>'.getIbanHumanReadable($object).
' ';
786 if (!empty($object->iban)) {
788 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
790 print
img_picto($langs->trans(
"IbanValid"),
'info');
796 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
797 print
'<td>'.$object->bic.
' ';
798 if (!empty($object->bic)) {
800 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
802 print
img_picto($langs->trans(
"SwiftValid"),
'info');
810 foreach ($object->getFieldsToShow() as $val) {
812 if ($val ==
'BankCode') {
813 $content = $object->code_banque;
814 } elseif ($val ==
'DeskCode') {
815 $content = $object->code_guichet;
816 } elseif ($val ==
'BankAccountNumber') {
817 $content = $object->number;
818 } elseif ($val ==
'BankAccountNumberKey') {
819 $content = $object->cle_rib;
822 print
'<tr><td>'.$langs->trans($val).
'</td>';
823 print
'<td>'.$content.
'</td>';
828 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
829 print
'<td>'.$object->ics.
'</td>';
835 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
836 print
'<td>'.$object->ics_transfer.
'</td>';
839 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td><td>';
840 print (empty($object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes"));
841 print
"</td></tr>\n";
844 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
845 print $object->proprio;
846 print
"</td></tr>\n";
848 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
849 print nl2br($object->owner_address);
850 print
"</td></tr>\n";
852 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
853 print
'<td>'.$object->owner_zip;
856 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
857 print
'<td>'.$object->owner_town;
860 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
862 $object->owner_country_code =
dol_getIdFromCode($db, $object->owner_country_id,
'c_country',
'rowid',
'code');
863 $langs->load(
"dict");
864 print (empty($object->owner_country_code) ?
'' : $langs->convToOutputCharset($langs->transnoentitiesnoconv(
"Country".$object->owner_country_code)));
874 print
'<div class="clearboth"></div>';
881 print
'<div class="tabsAction">';
883 if ($user->rights->banque->configurer) {
884 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
887 $canbedeleted = $object->can_be_deleted();
888 if ($user->rights->banque->configurer && $canbedeleted) {
889 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
901 if (
GETPOST(
'id',
'int') && $action ==
'edit' && $user->rights->banque->configurer) {
902 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
904 if ($conf->use_javascript_ajax) {
905 print
"\n".
'<script type="text/javascript">';
906 print
'jQuery(document).ready(function () {
907 jQuery("#type").change(function() {
908 document.formsoc.action.value="edit";
909 document.formsoc.submit();
913 print
'jQuery(document).ready(function () {
914 jQuery("#selectaccount_country_id").change(function() {
915 document.formsoc.action.value="edit";
916 document.formsoc.submit();
919 print
'</script>'.
"\n";
922 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formsoc">';
923 print
'<input type="hidden" name="token" value="'.newToken().
'">';
924 print
'<input type="hidden" name="action" value="update">';
925 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">'.
"\n\n";
926 print
'<input type="hidden" name="backtopage" value="'.$backtopage.
'">';
932 print
'<table class="border centpercent tableforfieldcreate">';
935 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
936 print
'<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') : $object->ref).
'"></td></tr>';
939 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
940 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $object->label).
'"></td></tr>';
943 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
944 print
'<td class="maxwidth200onsmartphone">';
945 $formbank->selectTypeOfBankAccount((
GETPOSTISSET(
'type') ?
GETPOST(
'type',
'int') : $object->type),
'type');
949 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
950 print
'<input type="hidden" value="'.$object->currency_code.
'">';
952 print
'<td class="maxwidth200onsmartphone">';
953 $selectedcode = $object->currency_code;
954 if (!$selectedcode) {
955 $selectedcode = $conf->currency;
957 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
958 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
964 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
965 print
'<td class="maxwidth200onsmartphone">';
970 $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
971 $selectedcode = $object->country_code;
973 $selectedcode =
GETPOST(
"account_country_id");
974 } elseif (empty($selectedcode)) {
975 $selectedcode = $mysoc->country_code;
977 $object->country_code =
getCountry($selectedcode, 2);
979 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
980 print
'<td class="maxwidth200onsmartphone">';
981 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
983 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
988 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
990 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
991 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $object->state_id, $selectedcode,
'account_state_id');
993 print $countrynotdefined;
999 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1000 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
1001 print $object->domiciliation;
1002 print
"</textarea></td></tr>";
1006 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
1008 $conciliate = $object->canBeConciliated();
1009 if ($conciliate == -2) {
1010 print $langs->trans(
"No").
' ('.$langs->trans(
"CashAccount").
')';
1011 } elseif ($conciliate == -3) {
1012 print $langs->trans(
"No").
' ('.$langs->trans(
"Closed").
')';
1014 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro" class="opacitymedium">'.$langs->trans(
"DisableConciliation").
'</label>';
1019 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
1020 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>';
1022 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
1023 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>';
1026 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
1028 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
1029 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") : $object->url).
'">';
1034 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1035 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
1037 $arrayselected = array();
1039 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
1040 if (is_array($cats)) {
1041 foreach ($cats as $cat) {
1042 $arrayselected[] = $cat->id;
1045 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1050 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
1053 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1054 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") : $object->comment),
'', 90,
'dolibarr_notes',
'',
false,
true,
getDolGlobalInt(
'FCKEDITOR_ENABLE_SOCIETE'), ROWS_4,
'95%');
1055 $doleditor->Create();
1060 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
1061 print $hookmanager->resPrint;
1062 if (empty($reshook)) {
1063 print $object->showOptionals($extrafields,
'edit',
$parameters);
1072 print
'<table class="border centpercent">';
1075 $tdextra =
' class="titlefieldcreate"';
1077 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1078 $tdextra =
' class="fieldrequired titlefieldcreate"';
1081 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1084 print
img_picto(
'',
'accounting_account',
'class="pictofixedwidth"');
1085 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
1086 if ($formaccounting->nbaccounts == 0) {
1087 $langs->load(
"errors");
1088 $htmltext = $langs->transnoentitiesnoconv(
"WarningGoOnAccountancySetupToAddAccounts", $langs->transnoentitiesnoconv(
"MenuAccountancy"), $langs->transnoentitiesnoconv(
"Setup"), $langs->transnoentitiesnoconv(
"Chartofaccounts"));
1089 print
$form->textwithpicto(
'', $htmltext);
1092 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") : $object->account_number).
'">';
1098 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1100 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1110 print
'<table class="border centpercent">';
1113 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1114 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1118 $bickey =
"BICNumber";
1119 if ($object->getCountryCode() ==
'IN') {
1125 $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';
1126 print
$form->textwithpicto($langs->trans($ibankey), $tooltip);
1128 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') : $object->iban).
'"></td></tr>';
1132 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1133 print
$form->textwithpicto($langs->trans($bickey), $tooltip);
1135 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') : $object->bic).
'"></td></tr>';
1138 foreach ($object->getFieldsToShow() as $val) {
1140 if ($val ==
'BankCode') {
1141 $name =
'code_banque';
1143 $content = $object->code_banque;
1144 } elseif ($val ==
'DeskCode') {
1145 $name =
'code_guichet';
1147 $content = $object->code_guichet;
1148 } elseif ($val ==
'BankAccountNumber') {
1151 $content = $object->number;
1152 } elseif ($val ==
'BankAccountNumberKey') {
1155 $content = $object->cle_rib;
1158 print
'<tr><td>'.$langs->trans($val).
'</td>';
1159 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1164 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1165 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') : $object->ics).
'"></td></tr>';
1169 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1170 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>';
1172 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
1173 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. ($object->pti_in_ctti ?
' checked ' :
'') .
'>';
1177 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1178 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.
'"></td>';
1184 print
'<table class="border centpercent">';
1186 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1187 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1188 print $object->owner_address;
1189 print
"</textarea></td></tr>";
1191 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
1192 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') : $object->owner_zip).
'">';
1195 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
1196 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') : $object->owner_town).
'">';
1199 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
1201 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1202 print
$form->select_country(
GETPOST(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') : $object->owner_country_id,
'owner_country_id');
1210 print
$form->buttonsSaveCancel(
"Modify");