32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
53 $langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta"));
55 $action =
GETPOST(
'action',
'aZ09');
56 $cancel =
GETPOST(
'cancel',
'alpha');
62 $extrafields->fetch_name_optionals_label($object->table_element);
65 $hookmanager->initHooks(array(
'bankcard',
'globalcard'));
69 $fieldid =
GETPOST(
"id",
'int') ?
'rowid' :
'ref';
71 $result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
79 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
80 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
82 if (empty($reshook)) {
83 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
85 if (empty($backtopage) || ($cancel && empty($id))) {
86 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
87 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
88 $backtopage = $backurlforlist;
90 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
96 if (!empty($backtopageforcancel)) {
97 header(
"Location: ".$backtopageforcancel);
99 } elseif (!empty($backtopage)) {
100 header(
"Location: ".$backtopage);
106 if ($action ==
'add') {
115 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
116 $object->courant =
GETPOST(
"type");
117 $object->clos =
GETPOST(
"clos");
118 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
119 $object->url = trim(
GETPOST(
"url",
'alpha'));
121 $object->bank = trim(
GETPOST(
"bank"));
122 $object->code_banque = trim(
GETPOST(
"code_banque"));
123 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
124 $object->number = trim(
GETPOST(
"number"));
125 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
126 $object->bic = trim(
GETPOST(
"bic"));
127 $object->iban = trim(
GETPOST(
"iban"));
128 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
129 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
131 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
132 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
134 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
135 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
137 $account_number =
GETPOST(
'account_number',
'alphanohtml');
138 if (empty($account_number) || $account_number ==
'-1') {
139 $object->account_number =
'';
141 $object->account_number = $account_number;
143 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
144 if ($fk_accountancy_journal <= 0) {
145 $object->fk_accountancy_journal =
'';
147 $object->fk_accountancy_journal = $fk_accountancy_journal;
153 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
155 $object->state_id =
GETPOST(
"account_state_id",
'int');
156 $object->country_id =
GETPOST(
"account_country_id",
'int');
158 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
159 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
160 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
162 $object->fk_user_author = $user->id;
164 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
165 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
169 if (empty($object->ref)) {
170 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
174 if (empty($object->label)) {
175 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
181 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
184 $id = $object->create($user);
187 $categories =
GETPOST(
'categories',
'array');
188 $object->setCategories($categories);
208 if ($action ==
'update') {
213 $object->fetch(
GETPOST(
"id",
'int'));
216 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
217 $object->courant =
GETPOST(
"type");
218 $object->clos =
GETPOST(
"clos");
219 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
220 $object->url = trim(
GETPOST(
"url",
'alpha'));
222 $object->bank = trim(
GETPOST(
"bank"));
223 $object->code_banque = trim(
GETPOST(
"code_banque"));
224 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
225 $object->number = trim(
GETPOST(
"number"));
226 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
227 $object->bic = trim(
GETPOST(
"bic"));
228 $object->iban = trim(
GETPOST(
"iban"));
229 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
230 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
232 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
233 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
235 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
236 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
238 $account_number =
GETPOST(
'account_number',
'alphanohtml');
239 if (empty($account_number) || $account_number ==
'-1') {
240 $object->account_number =
'';
242 $object->account_number = $account_number;
244 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
245 if ($fk_accountancy_journal <= 0) {
246 $object->fk_accountancy_journal =
'';
248 $object->fk_accountancy_journal = $fk_accountancy_journal;
251 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
253 $object->state_id =
GETPOST(
"account_state_id",
'int');
254 $object->country_id =
GETPOST(
"account_country_id",
'int');
256 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
257 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
258 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
260 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
261 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
265 if (empty($object->ref)) {
266 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
270 if (empty($object->label)) {
271 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
280 $ret = $extrafields->setOptionalsFromPost(
null, $object);
284 $result = $object->update($user);
287 $categories =
GETPOST(
'categories',
'array');
288 $object->setCategories($categories);
290 $_GET[
"id"] =
GETPOST(
"id",
'int');
305 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->banque->configurer) {
308 $object->fetch(
GETPOST(
"id",
"int"));
309 $result = $object->delete($user);
313 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
333 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
335 $title = $langs->trans(
"FinancialAccount").
" - ".$langs->trans(
"Card");
337 $help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
344 if ($action ==
'create') {
347 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
349 if ($conf->use_javascript_ajax) {
350 print
"\n".
'<script type="text/javascript">';
351 print
'jQuery(document).ready(function () {
352 jQuery("#type").change(function() {
353 document.formsoc.action.value="create";
354 document.formsoc.submit();
356 jQuery("#selectaccount_country_id").change(function() {
357 document.formsoc.action.value="create";
358 document.formsoc.submit();
361 print
'</script>'.
"\n";
364 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
365 print
'<input type="hidden" name="token" value="'.newToken().
'">';
366 print
'<input type="hidden" name="action" value="add">';
367 print
'<input type="hidden" name="clos" value="0">';
371 print
'<table class="border centpercent tableforfieldcreate">';
374 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
375 print
'<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
"ref",
'alpha') : $object->ref).
'" maxlength="12" autofocus></td></tr>';
378 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
379 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
382 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
388 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
390 $selectedcode = $object->currency_code;
391 if (!$selectedcode) {
392 $selectedcode = $conf->currency;
394 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
400 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
402 print
$form->selectarray(
"clos", $object->status, (
GETPOST(
'clos',
'int') !=
'' ?
GETPOST(
'clos',
'int') : $object->clos), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150onsmartphone');
408 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") : $object->country_code;
409 } elseif (empty($selectedcode)) {
410 $selectedcode = $mysoc->country_code;
412 $object->country_code =
getCountry($selectedcode, 2);
414 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
416 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
418 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
423 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
425 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
426 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
428 print $countrynotdefined;
433 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
435 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
436 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
441 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
442 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
444 $arrayselected = array();
446 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
447 if (is_array($cats)) {
448 foreach ($cats as $cat) {
449 $arrayselected[] = $cat->id;
452 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
457 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
460 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
461 $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%');
462 $doleditor->Create();
467 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
468 print $hookmanager->resPrint;
469 if (empty($reshook)) {
470 print $object->showOptionals($extrafields,
'create',
$parameters);
477 print
'<table class="border centpercent">';
480 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
481 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST(
"solde") ?
GETPOST(
"solde") :
price2num($object->solde)).
'"></td></tr>';
483 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
485 print
$form->selectDate(
'',
're', 0, 0, 0,
'formsoc');
488 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
489 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>';
491 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
492 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>';
499 print
'<table class="border centpercent">';
502 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
503 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST(
'bank') ?
GETPOST(
'bank',
'alpha') : $object->bank).
'"></td>';
508 foreach ($object->getFieldsToShow() as $val) {
509 if ($val ==
'BankCode') {
510 $name =
'code_banque';
511 $sizecss =
'minwidth100';
512 $content = $object->code_banque;
513 } elseif ($val ==
'DeskCode') {
514 $name =
'code_guichet';
515 $sizecss =
'minwidth100';
516 $content = $object->code_guichet;
517 } elseif ($val ==
'BankAccountNumber') {
519 $sizecss =
'minwidth200';
520 $content = $object->number;
521 } elseif ($val ==
'BankAccountNumberKey') {
523 $sizecss =
'minwidth50';
524 $content = $object->cle_rib;
527 print
'<td>'.$langs->trans($val).
'</td>';
528 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOST($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
532 $bickey =
"BICNumber";
533 if ($object->getCountryCode() ==
'IN') {
538 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
539 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOST(
'iban') ?
GETPOST(
'iban',
'alpha') : $object->iban).
'"></td></tr>';
541 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
542 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST(
'bic') ?
GETPOST(
'bic',
'alpha') : $object->bic).
'"></td></tr>';
545 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td>';
546 print
'<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'> ';
547 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
551 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
552 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
553 print (
GETPOST(
'domiciliation') ?
GETPOST(
'domiciliation') : $object->domiciliation);
554 print
"</textarea></td></tr>";
556 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
557 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $object->proprio).
'">';
560 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
561 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
562 print (
GETPOST(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') : $object->owner_address);
563 print
"</textarea></td></tr>";
569 print
'<table class="border centpercent">';
572 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
573 $fieldrequired =
'fieldrequired ';
577 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
579 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
582 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
583 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') : $object->account_number).
'"></td></tr>';
588 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
590 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
598 print
$form->buttonsSaveCancel(
"CreateAccount");
608 if ((
GETPOST(
"id",
'int') ||
GETPOST(
"ref")) && $action !=
'edit') {
611 $object->fetch(
GETPOST(
"id",
'int'));
614 $object->fetch(0,
GETPOST(
"ref"));
615 $_GET[
"id"] = $object->id;
620 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account');
625 if ($action ==
'delete') {
626 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
632 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
635 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
638 print
'<div class="fichecenter">';
639 print
'<div class="fichehalfleft">';
640 print
'<div class="underbanner clearboth"></div>';
642 print
'<table class="border tableforfield" width="100%">';
645 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
646 print
'<td>'.$object->type_lib[$object->type].
'</td></tr>';
649 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
651 $selectedcode = $object->currency_code;
652 if (!$selectedcode) {
653 $selectedcode = $conf->currency;
655 print $langs->trans(
"Currency".$selectedcode);
659 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
661 $conciliate = $object->canBeConciliated();
662 if ($conciliate == -2) {
663 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
664 } elseif ($conciliate == -3) {
665 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
667 print ($object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
671 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
672 print
'<td>'.$object->min_allowed.
'</td></tr>';
674 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
675 print
'<td>'.$object->min_desired.
'</td></tr>';
678 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
682 $accountingaccount->fetch(
'', $object->account_number, 1);
684 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
686 print $object->account_number;
692 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
695 if ($object->fk_accountancy_journal > 0) {
697 $accountingjournal->fetch($object->fk_accountancy_journal);
699 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
706 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
711 print
'<div class="fichehalfright">';
712 print
'<div class="underbanner clearboth"></div>';
714 print
'<table class="border tableforfield centpercent">';
718 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
719 print
$form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
723 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
724 print
'<td>'.dol_htmlentitiesbr($object->comment).
'</td></tr>';
731 print
'<table class="border tableforfield centpercent">';
733 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"BankName").
'</td>';
734 print
'<td>'.$object->bank.
'</td></tr>';
737 foreach ($object->getFieldsToShow() as $val) {
738 if ($val ==
'BankCode') {
739 $content = $object->code_banque;
740 } elseif ($val ==
'DeskCode') {
741 $content = $object->code_guichet;
742 } elseif ($val ==
'BankAccountNumber') {
743 $content = $object->number;
744 } elseif ($val ==
'BankAccountNumberKey') {
745 $content = $object->cle_rib;
748 print
'<tr><td>'.$langs->trans($val).
'</td>';
749 print
'<td>'.$content.
'</td>';
754 $bickey =
"BICNumber";
755 if ($object->getCountryCode() ==
'IN') {
759 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
760 print
'<td>'.$object->iban.
' ';
761 if (!empty($object->iban)) {
763 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
765 print
img_picto($langs->trans(
"IbanValid"),
'info');
770 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
771 print
'<td>'.$object->bic.
' ';
772 if (!empty($object->bic)) {
774 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
776 print
img_picto($langs->trans(
"SwiftValid"),
'info');
782 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
783 print
'<td>'.$object->ics.
'</td>';
789 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
790 print
'<td>'.$object->ics_transfer.
'</td>';
793 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td><td>';
794 print (empty($object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes")) .
' ';
795 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
796 print
"</td></tr>\n";
799 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
800 print nl2br($object->domiciliation);
801 print
"</td></tr>\n";
803 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
804 print $object->proprio;
805 print
"</td></tr>\n";
807 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
808 print nl2br($object->owner_address);
809 print
"</td></tr>\n";
817 print
'<div class="clearboth"></div>';
824 print
'<div class="tabsAction">';
826 if ($user->rights->banque->configurer) {
827 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
830 $canbedeleted = $object->can_be_deleted();
831 if ($user->rights->banque->configurer && $canbedeleted) {
832 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
844 if (
GETPOST(
'id',
'int') && $action ==
'edit' && $user->rights->banque->configurer) {
846 $object->fetch(
GETPOST(
'id',
'int'));
848 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
850 if ($conf->use_javascript_ajax) {
851 print
"\n".
'<script type="text/javascript">';
852 print
'jQuery(document).ready(function () {
853 jQuery("#type").change(function() {
854 document.formsoc.action.value="edit";
855 document.formsoc.submit();
859 print
'jQuery(document).ready(function () {
860 jQuery("#selectaccount_country_id").change(function() {
861 document.formsoc.action.value="edit";
862 document.formsoc.submit();
865 print
'</script>'.
"\n";
868 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formsoc">';
869 print
'<input type="hidden" name="token" value="'.newToken().
'">';
870 print
'<input type="hidden" name="action" value="update">';
871 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">'.
"\n\n";
877 print
'<table class="border centpercent tableforfieldcreate">';
880 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
881 print
'<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') : $object->ref).
'"></td></tr>';
884 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
885 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $object->label).
'"></td></tr>';
888 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
889 print
'<td class="maxwidth200onsmartphone">';
890 $formbank->selectTypeOfBankAccount((
GETPOSTISSET(
'type') ?
GETPOST(
'type',
'int') : $object->type),
'type');
894 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
895 print
'<input type="hidden" value="'.$object->currency_code.
'">';
897 print
'<td class="maxwidth200onsmartphone">';
898 $selectedcode = $object->currency_code;
899 if (!$selectedcode) {
900 $selectedcode = $conf->currency;
902 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
903 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
909 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
910 print
'<td class="maxwidth200onsmartphone">';
915 $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
916 $selectedcode = $object->country_code;
918 $selectedcode =
GETPOST(
"account_country_id");
919 } elseif (empty($selectedcode)) {
920 $selectedcode = $mysoc->country_code;
922 $object->country_code =
getCountry($selectedcode, 2);
924 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
925 print
'<td class="maxwidth200onsmartphone">';
926 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
928 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
933 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
935 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
936 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $object->state_id, $selectedcode,
'account_state_id');
938 print $countrynotdefined;
943 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
945 $conciliate = $object->canBeConciliated();
946 if ($conciliate == -2) {
947 print $langs->trans(
"No").
' ('.$langs->trans(
"CashAccount").
')';
948 } elseif ($conciliate == -3) {
949 print $langs->trans(
"No").
' ('.$langs->trans(
"Closed").
')';
951 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro">'.$langs->trans(
"DisableConciliation").
'</label>';
956 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
957 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>';
959 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
960 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>';
963 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
965 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
966 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") : $object->url).
'">';
971 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
972 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
974 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
975 if (is_array($cats)) {
976 foreach ($cats as $cat) {
977 $arrayselected[] = $cat->id;
980 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
985 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
988 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
989 $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%');
990 $doleditor->Create();
995 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
996 print $hookmanager->resPrint;
997 if (empty($reshook)) {
998 print $object->showOptionals($extrafields,
'edit',
$parameters);
1007 print
'<table class="border centpercent">';
1010 $tdextra =
' class="titlefieldcreate"';
1012 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1013 $tdextra =
' class="fieldrequired titlefieldcreate"';
1016 print
'<tr class="liste_titre_add"><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1019 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
1021 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") : $object->account_number).
'">';
1027 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1029 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1041 print
'<table class="border centpercent">';
1044 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1045 print
'<td><input size="30" type="text" class="flat" name="bank" value="'.$object->bank.
'"></td>';
1049 foreach ($object->getFieldsToShow() as $val) {
1050 if ($val ==
'BankCode') {
1051 $name =
'code_banque';
1053 $content = $object->code_banque;
1054 } elseif ($val ==
'DeskCode') {
1055 $name =
'code_guichet';
1057 $content = $object->code_guichet;
1058 } elseif ($val ==
'BankAccountNumber') {
1061 $content = $object->number;
1062 } elseif ($val ==
'BankAccountNumberKey') {
1065 $content = $object->cle_rib;
1068 print
'<tr><td>'.$langs->trans($val).
'</td>';
1069 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1074 $bickey =
"BICNumber";
1075 if ($object->getCountryCode() ==
'IN') {
1080 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
1081 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') : $object->iban).
'"></td></tr>';
1083 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
1084 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') : $object->bic).
'"></td></tr>';
1087 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1088 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') : $object->ics).
'"></td></tr>';
1092 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1093 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>';
1095 print
'<tr><td>'.$langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").
'</td>';
1096 print
'<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ?
' checked ' :
'') .
'> ';
1097 print
img_picto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"),
'info');
1101 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1102 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
1103 print $object->domiciliation;
1104 print
"</textarea></td></tr>";
1106 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1107 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.
'"></td>';
1110 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1111 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1112 print $object->owner_address;
1113 print
"</textarea></td></tr>";
1120 print
$form->buttonsSaveCancel(
"Modify");