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');
63 $extrafields->fetch_name_optionals_label($object->table_element);
66 $hookmanager->initHooks(array(
'bankcard',
'globalcard'));
70 $fieldid =
GETPOST(
"id",
'int') ?
'rowid' :
'ref';
74 $object->fetch(
GETPOST(
"id",
'int'));
77 $object->fetch(0,
GETPOST(
"ref"));
81 $result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
89 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
90 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
92 if (empty($reshook)) {
93 $backurlforlist = DOL_URL_ROOT.
'/compta/bank/list.php';
95 if (empty($backtopage) || ($cancel && empty($id))) {
96 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
97 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
98 $backtopage = $backurlforlist;
100 $backtopage = DOL_URL_ROOT.
'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
106 if (!empty($backtopageforcancel)) {
107 header(
"Location: ".$backtopageforcancel);
109 } elseif (!empty($backtopage)) {
110 header(
"Location: ".$backtopage);
116 if ($action ==
'add') {
125 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
126 $object->courant =
GETPOST(
"type");
127 $object->clos =
GETPOST(
"clos");
128 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
129 $object->url = trim(
GETPOST(
"url",
'alpha'));
131 $object->bank = trim(
GETPOST(
"bank"));
132 $object->code_banque = trim(
GETPOST(
"code_banque"));
133 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
134 $object->number = trim(
GETPOST(
"number"));
135 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
136 $object->bic = trim(
GETPOST(
"bic"));
137 $object->iban = trim(
GETPOST(
"iban"));
138 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
139 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
141 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
142 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
143 $object->owner_zip = trim(
GETPOST(
"owner_zip",
'alphanohtml'));
144 $object->owner_town = trim(
GETPOST(
"owner_town",
'alphanohtml'));
145 $object->owner_country_id =
GETPOST(
"owner_country_id",
'int');
147 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
148 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
150 $account_number =
GETPOST(
'account_number',
'alphanohtml');
151 if (empty($account_number) || $account_number ==
'-1') {
152 $object->account_number =
'';
154 $object->account_number = $account_number;
156 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
157 if ($fk_accountancy_journal <= 0) {
158 $object->fk_accountancy_journal =
'';
160 $object->fk_accountancy_journal = $fk_accountancy_journal;
166 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
168 $object->state_id =
GETPOST(
"account_state_id",
'int');
169 $object->country_id =
GETPOST(
"account_country_id",
'int');
171 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
172 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
173 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
175 $object->fk_user_author = $user->id;
177 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
178 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
182 if (empty($object->ref)) {
183 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
187 if (empty($object->label)) {
188 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
194 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
197 $id = $object->create($user);
200 $categories =
GETPOST(
'categories',
'array');
201 $object->setCategories($categories);
221 if ($action ==
'update') {
226 $object->fetch(
GETPOST(
"id",
'int'));
229 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
230 $object->courant =
GETPOST(
"type");
231 $object->clos =
GETPOST(
"clos");
232 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
233 $object->url = trim(
GETPOST(
"url",
'alpha'));
235 $object->bank = trim(
GETPOST(
"bank"));
236 $object->code_banque = trim(
GETPOST(
"code_banque"));
237 $object->code_guichet = trim(
GETPOST(
"code_guichet"));
238 $object->number = trim(
GETPOST(
"number"));
239 $object->cle_rib = trim(
GETPOST(
"cle_rib"));
240 $object->bic = trim(
GETPOST(
"bic"));
241 $object->iban = trim(
GETPOST(
"iban"));
242 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"alphanohtml"));
243 $object->pti_in_ctti = empty(
GETPOST(
"pti_in_ctti")) ? 0 : 1;
245 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
246 $object->owner_address = trim(
GETPOST(
"owner_address",
'alphanohtml'));
247 $object->owner_zip = trim(
GETPOST(
"owner_zip",
'alphanohtml'));
248 $object->owner_town = trim(
GETPOST(
"owner_town",
'alphanohtml'));
249 $object->owner_country_id =
GETPOST(
"owner_country_id",
'int');
251 $object->ics = trim(
GETPOST(
"ics",
'alpha'));
252 $object->ics_transfer = trim(
GETPOST(
"ics_transfer",
'alpha'));
254 $account_number =
GETPOST(
'account_number',
'alphanohtml');
255 if (empty($account_number) || $account_number ==
'-1') {
256 $object->account_number =
'';
258 $object->account_number = $account_number;
260 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
261 if ($fk_accountancy_journal <= 0) {
262 $object->fk_accountancy_journal =
'';
264 $object->fk_accountancy_journal = $fk_accountancy_journal;
267 $object->currency_code = trim(
GETPOST(
"account_currency_code"));
269 $object->state_id =
GETPOST(
"account_state_id",
'int');
270 $object->country_id =
GETPOST(
"account_country_id",
'int');
272 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
273 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
274 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
276 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
277 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")),
null,
'errors');
281 if (empty($object->ref)) {
282 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")),
null,
'errors');
286 if (empty($object->label)) {
287 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")),
null,
'errors');
296 $ret = $extrafields->setOptionalsFromPost(
null, $object);
300 $result = $object->update($user);
303 $categories =
GETPOST(
'categories',
'array');
304 $object->setCategories($categories);
306 $_GET[
"id"] =
GETPOST(
"id",
'int');
321 if ($action ==
'confirm_delete' &&
GETPOST(
"confirm") ==
"yes" && $user->rights->banque->configurer) {
324 $object->fetch(
GETPOST(
"id",
"int"));
325 $result = $object->delete($user);
329 header(
"Location: " . DOL_URL_ROOT .
"/compta/bank/list.php");
350 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
352 $help_url =
'EN:Module_Banks_and_Cash|FR:Module_Banques_et_Caisses|ES:Módulo_Bancos_y_Cajas|DE:Modul_Banken_und_Barbestände';
353 if ($action ==
'create') {
354 $title = $langs->trans(
"NewFinancialAccount");
355 } elseif (!empty($object->ref)) {
356 $title = $object->ref.
" - ".$langs->trans(
"Card");
361 if ($action ==
'create') {
362 print
load_fiche_titre($langs->trans(
"NewFinancialAccount"),
'',
'bank_account');
364 if ($conf->use_javascript_ajax) {
365 print
"\n".
'<script type="text/javascript">';
366 print
'jQuery(document).ready(function () {
367 jQuery("#type").change(function() {
368 document.formsoc.action.value="create";
369 document.formsoc.submit();
371 jQuery("#selectaccount_country_id").change(function() {
372 document.formsoc.action.value="create";
373 document.formsoc.submit();
376 print
'</script>'.
"\n";
379 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
380 print
'<input type="hidden" name="token" value="'.newToken().
'">';
381 print
'<input type="hidden" name="action" value="add">';
382 print
'<input type="hidden" name="clos" value="0">';
386 print
'<table class="border centpercent tableforfieldcreate">';
389 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
390 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>';
393 print
'<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
394 print
'<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'"></td></tr>';
397 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
403 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
405 $selectedcode = $object->currency_code;
406 if (!$selectedcode) {
407 $selectedcode = $conf->currency;
409 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
415 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
417 print
$form->selectarray(
"clos", $object->status, (
GETPOST(
'clos',
'int') !=
'' ?
GETPOST(
'clos',
'int') : $object->clos), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150onsmartphone');
423 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") : $object->country_code;
424 } elseif (empty($selectedcode)) {
425 $selectedcode = $mysoc->country_code;
427 $object->country_code =
getCountry($selectedcode, 2);
429 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
431 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
432 print
$form->select_country($selectedcode,
'account_country_id');
434 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
439 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
441 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
442 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
444 print $countrynotdefined;
450 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
451 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
453 print
"</textarea></td></tr>";
457 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
459 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
460 print
'<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'">';
465 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
466 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
468 $arrayselected = array();
470 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
471 if (is_array($cats)) {
472 foreach ($cats as $cat) {
473 $arrayselected[] = $cat->id;
476 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
481 print
'<tr><td>'.$langs->trans(
"Comment").
'</td>';
484 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
485 $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%');
486 $doleditor->Create();
491 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
492 print $hookmanager->resPrint;
493 if (empty($reshook)) {
494 print $object->showOptionals($extrafields,
'create',
$parameters);
501 print
'<table class="border centpercent">';
504 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
505 print
'<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST(
"solde") ?
GETPOST(
"solde") :
price2num($object->solde)).
'"></td></tr>';
507 print
'<tr><td>'.$langs->trans(
"Date").
'</td>';
509 print
$form->selectDate(
'',
're', 0, 0, 0,
'formsoc');
512 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
513 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>';
515 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
516 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>';
523 print
'<table class="border centpercent">';
526 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
527 print
'<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST(
'bank') ?
GETPOST(
'bank',
'alpha') : $object->bank).
'"></td>';
532 foreach ($object->getFieldsToShow() as $val) {
534 if ($val ==
'BankCode') {
535 $name =
'code_banque';
536 $sizecss =
'minwidth100';
537 $content = $object->code_banque;
538 } elseif ($val ==
'DeskCode') {
539 $name =
'code_guichet';
540 $sizecss =
'minwidth100';
541 $content = $object->code_guichet;
542 } elseif ($val ==
'BankAccountNumber') {
544 $sizecss =
'minwidth200';
545 $content = $object->number;
546 } elseif ($val ==
'BankAccountNumberKey') {
548 $sizecss =
'minwidth50';
549 $content = $object->cle_rib;
552 print
'<td>'.$langs->trans($val).
'</td>';
553 print
'<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOSTISSET($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
557 $bickey =
"BICNumber";
558 if ($object->getCountryCode() ==
'IN') {
563 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
564 print
'<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alpha') : $object->iban).
'"></td></tr>';
566 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
567 print
'<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alpha') : $object->bic).
'"></td></tr>';
570 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
571 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. (empty(
GETPOST(
'pti_in_ctti')) ?
'' :
' checked ') .
'>';
577 print
'<table class="border centpercent">';
578 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwner").
'</td>';
579 print
'<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $object->proprio).
'">';
582 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
583 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
584 print (
GETPOST(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') : $object->owner_address);
585 print
"</textarea></td></tr>";
587 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
588 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') : $object->owner_zip).
'">';
591 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
592 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') : $object->owner_town).
'">';
595 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
597 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
598 print
$form->select_country(
GETPOST(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') : $object->owner_country_id,
'owner_country_id');
605 print
'<table class="border centpercent">';
608 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
609 $fieldrequired =
'fieldrequired ';
613 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
615 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
618 print
'<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
619 print
'<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') : $object->account_number).
'"></td></tr>';
624 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
626 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
634 print
$form->buttonsSaveCancel(
"CreateAccount");
639 if ((
GETPOST(
"id",
'int') ||
GETPOST(
"ref")) && $action !=
'edit') {
642 print
dol_get_fiche_head($head,
'bankname', $langs->trans(
"FinancialAccount"), -1,
'account');
647 if ($action ==
'delete') {
648 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
654 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
657 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
660 print
'<div class="fichecenter">';
661 print
'<div class="fichehalfleft">';
662 print
'<div class="underbanner clearboth"></div>';
664 print
'<table class="border tableforfield" width="100%">';
667 print
'<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
668 print
'<td>'.$object->type_lib[$object->type].
'</td></tr>';
671 print
'<tr><td>'.$langs->trans(
"Currency").
'</td>';
673 $selectedcode = $object->currency_code;
674 if (!$selectedcode) {
675 $selectedcode = $conf->currency;
677 print $langs->trans(
"Currency".$selectedcode);
681 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
683 $conciliate = $object->canBeConciliated();
684 if ($conciliate == -2) {
685 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
686 } elseif ($conciliate == -3) {
687 print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"Closed").
')</span>';
689 print ($object->rappro == 1 ? $langs->trans(
"Yes") : ($langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"ConciliationDisabled").
')</span>'));
693 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
694 print
'<td>'.$object->min_allowed.
'</td></tr>';
696 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
697 print
'<td>'.$object->min_desired.
'</td></tr>';
700 print
'<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
704 $accountingaccount->fetch(
'', $object->account_number, 1);
706 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
708 print $object->account_number;
714 print
'<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
717 if ($object->fk_accountancy_journal > 0) {
719 $accountingjournal->fetch($object->fk_accountancy_journal);
721 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
728 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
733 print
'<div class="fichehalfright">';
734 print
'<div class="underbanner clearboth"></div>';
736 print
'<table class="border tableforfield centpercent">';
740 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
741 print
$form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
745 print
'<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
746 print
'<td>'.dol_htmlentitiesbr($object->comment).
'</td></tr>';
751 print
'<table class="border tableforfield centpercent">';
753 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"BankName").
'</td>';
754 print
'<td>'.$object->bank.
'</td></tr>';
757 foreach ($object->getFieldsToShow() as $val) {
759 if ($val ==
'BankCode') {
760 $content = $object->code_banque;
761 } elseif ($val ==
'DeskCode') {
762 $content = $object->code_guichet;
763 } elseif ($val ==
'BankAccountNumber') {
764 $content = $object->number;
765 } elseif ($val ==
'BankAccountNumberKey') {
766 $content = $object->cle_rib;
769 print
'<tr><td>'.$langs->trans($val).
'</td>';
770 print
'<td>'.$content.
'</td>';
775 $bickey =
"BICNumber";
776 if ($object->getCountryCode() ==
'IN') {
780 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
781 print
'<td>'.getIbanHumanReadable($object).
' ';
782 if (!empty($object->iban)) {
784 print
img_picto($langs->trans(
"IbanNotValid"),
'warning');
786 print
img_picto($langs->trans(
"IbanValid"),
'info');
791 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
792 print
'<td>'.$object->bic.
' ';
793 if (!empty($object->bic)) {
795 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning');
797 print
img_picto($langs->trans(
"SwiftValid"),
'info');
803 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
804 print
'<td>'.$object->ics.
'</td>';
810 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
811 print
'<td>'.$object->ics_transfer.
'</td>';
814 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td><td>';
815 print (empty($object->pti_in_ctti) ? $langs->trans(
"No") : $langs->trans(
"Yes"));
816 print
"</td></tr>\n";
819 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
820 print $object->proprio;
821 print
"</td></tr>\n";
823 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
824 print nl2br($object->owner_address);
825 print
"</td></tr>\n";
827 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
828 print
'<td>'.$object->owner_zip;
831 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
832 print
'<td>'.$object->owner_town;
835 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
837 $object->owner_country_code =
dol_getIdFromCode($db, $object->owner_country_id,
'c_country',
'rowid',
'code');
838 $langs->load(
"dict");
839 print (empty($object->owner_country_code) ?
'' : $langs->convToOutputCharset($langs->transnoentitiesnoconv(
"Country".$object->owner_country_code)));
849 print
'<div class="clearboth"></div>';
856 print
'<div class="tabsAction">';
858 if ($user->rights->banque->configurer) {
859 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
862 $canbedeleted = $object->can_be_deleted();
863 if ($user->rights->banque->configurer && $canbedeleted) {
864 print
'<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
876 if (
GETPOST(
'id',
'int') && $action ==
'edit' && $user->rights->banque->configurer) {
877 print
load_fiche_titre($langs->trans(
"EditFinancialAccount"),
'',
'bank_account');
879 if ($conf->use_javascript_ajax) {
880 print
"\n".
'<script type="text/javascript">';
881 print
'jQuery(document).ready(function () {
882 jQuery("#type").change(function() {
883 document.formsoc.action.value="edit";
884 document.formsoc.submit();
888 print
'jQuery(document).ready(function () {
889 jQuery("#selectaccount_country_id").change(function() {
890 document.formsoc.action.value="edit";
891 document.formsoc.submit();
894 print
'</script>'.
"\n";
897 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formsoc">';
898 print
'<input type="hidden" name="token" value="'.newToken().
'">';
899 print
'<input type="hidden" name="action" value="update">';
900 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
'int').
'">'.
"\n\n";
906 print
'<table class="border centpercent tableforfieldcreate">';
909 print
'<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
910 print
'<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'ref') ?
GETPOST(
'ref',
'alpha') : $object->ref).
'"></td></tr>';
913 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
914 print
'<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $object->label).
'"></td></tr>';
917 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
918 print
'<td class="maxwidth200onsmartphone">';
919 $formbank->selectTypeOfBankAccount((
GETPOSTISSET(
'type') ?
GETPOST(
'type',
'int') : $object->type),
'type');
923 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
924 print
'<input type="hidden" value="'.$object->currency_code.
'">';
926 print
'<td class="maxwidth200onsmartphone">';
927 $selectedcode = $object->currency_code;
928 if (!$selectedcode) {
929 $selectedcode = $conf->currency;
931 print
img_picto(
'',
'multicurrency',
'class="pictofixedwidth"');
932 print
$form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
938 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
939 print
'<td class="maxwidth200onsmartphone">';
944 $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
945 $selectedcode = $object->country_code;
947 $selectedcode =
GETPOST(
"account_country_id");
948 } elseif (empty($selectedcode)) {
949 $selectedcode = $mysoc->country_code;
951 $object->country_code =
getCountry($selectedcode, 2);
953 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Country").
'</td>';
954 print
'<td class="maxwidth200onsmartphone">';
955 print
img_picto(
'',
'country',
'class="pictofixedwidth"').$form->select_country($selectedcode,
'account_country_id');
957 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
962 print
'<tr><td>'.$langs->trans(
'State').
'</td><td class="maxwidth200onsmartphone">';
964 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
965 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $object->state_id, $selectedcode,
'account_state_id');
967 print $countrynotdefined;
973 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
974 print
'<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
975 print $object->domiciliation;
976 print
"</textarea></td></tr>";
980 print
'<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
982 $conciliate = $object->canBeConciliated();
983 if ($conciliate == -2) {
984 print $langs->trans(
"No").
' ('.$langs->trans(
"CashAccount").
')';
985 } elseif ($conciliate == -3) {
986 print $langs->trans(
"No").
' ('.$langs->trans(
"Closed").
')';
988 print
'<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ?
'' :
' checked="checked"').
'"> <label for="norappro" class="opacitymedium">'.$langs->trans(
"DisableConciliation").
'</label>';
993 print
'<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
994 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>';
996 print
'<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
997 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>';
1000 print
'<tr><td>'.$langs->trans(
"Web").
'</td>';
1002 print
img_picto(
'',
'globe',
'class="pictofixedwidth"');
1003 print
'<input class="maxwidth200onsmartphone" type="text" class="flat" name="url" value="'.(GETPOSTISSET(
"url") ?
GETPOST(
"url") : $object->url).
'">';
1008 print
'<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
1009 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
1011 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
1012 if (is_array($cats)) {
1013 foreach ($cats as $cat) {
1014 $arrayselected[] = $cat->id;
1017 print
img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
1022 print
'<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
1025 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1026 $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%');
1027 $doleditor->Create();
1032 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
1033 print $hookmanager->resPrint;
1034 if (empty($reshook)) {
1035 print $object->showOptionals($extrafields,
'edit',
$parameters);
1044 print
'<table class="border centpercent">';
1047 $tdextra =
' class="titlefieldcreate"';
1049 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1050 $tdextra =
' class="fieldrequired titlefieldcreate"';
1053 print
'<tr><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
1056 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
1058 print
'<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") : $object->account_number).
'">';
1064 print
'<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
1066 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
1076 print
'<table class="border centpercent">';
1079 print
'<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
1080 print
'<td><input type="text" class="flat width300" name="bank" value="'.$object->bank.
'"></td>';
1084 foreach ($object->getFieldsToShow() as $val) {
1086 if ($val ==
'BankCode') {
1087 $name =
'code_banque';
1089 $content = $object->code_banque;
1090 } elseif ($val ==
'DeskCode') {
1091 $name =
'code_guichet';
1093 $content = $object->code_guichet;
1094 } elseif ($val ==
'BankAccountNumber') {
1097 $content = $object->number;
1098 } elseif ($val ==
'BankAccountNumberKey') {
1101 $content = $object->cle_rib;
1104 print
'<tr><td>'.$langs->trans($val).
'</td>';
1105 print
'<td><input type="text" class="flat '.$css.
'" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
1110 $bickey =
"BICNumber";
1111 if ($object->getCountryCode() ==
'IN') {
1116 print
'<tr><td>'.$langs->trans($ibankey).
'</td>';
1117 print
'<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.(GETPOSTISSET(
'iban') ?
GETPOST(
'iban',
'alphanohtml') : $object->iban).
'"></td></tr>';
1119 print
'<tr><td>'.$langs->trans($bickey).
'</td>';
1120 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.(GETPOSTISSET(
'bic') ?
GETPOST(
'bic',
'alphanohtml') : $object->bic).
'"></td></tr>';
1123 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"ICS"), $langs->trans(
"ICS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"StandingOrder")).
')').
'</td>';
1124 print
'<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics" value="'.(GETPOSTISSET(
'ics') ?
GETPOST(
'ics',
'alphanohtml') : $object->ics).
'"></td></tr>';
1128 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"IDS"), $langs->trans(
"IDS").
' ('.$langs->trans(
"UsedFor", $langs->transnoentitiesnoconv(
"BankTransfer")).
')').
'</td>';
1129 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>';
1131 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation"), $langs->trans(
"SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp")).
'</td>';
1132 print
'<td><input type="checkbox" class="flat" name="pti_in_ctti"'. ($object->pti_in_ctti ?
' checked ' :
'') .
'>';
1136 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1137 print
'<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.
'"></td>';
1143 print
'<table class="border centpercent">';
1145 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1146 print
'<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1147 print $object->owner_address;
1148 print
"</textarea></td></tr>";
1150 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerZip").
'</td>';
1151 print
'<td><input type="text" class="flat maxwidth100" name="owner_zip" value="'.(GETPOST(
'owner_zip') ?
GETPOST(
'owner_zip',
'alpha') : $object->owner_zip).
'">';
1154 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerTown").
'</td>';
1155 print
'<td><input type="text" class="flat maxwidth200" name="owner_town" value="'.(GETPOST(
'owner_town') ?
GETPOST(
'owner_town',
'alpha') : $object->owner_town).
'">';
1158 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerCountry").
'</td>';
1160 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1161 print
$form->select_country(
GETPOST(
'owner_country_id') ?
GETPOST(
'owner_country_id',
'alpha') : $object->owner_country_id,
'owner_country_id');
1169 print
$form->buttonsSaveCancel(
"Modify");