31 require
'../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formbank.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
38 if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
39 if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
40 if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingaccount.class.php';
41 if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
44 $langs->loadLangs(array(
"banks",
"bills",
"categories",
"companies",
"compta"));
46 $action =
GETPOST(
'action',
'aZ09');
47 $cancel =
GETPOST(
'cancel',
'alpha');
53 $result =
restrictedArea($user,
'banque', $id,
'bank_account&bank_account',
'',
'', $fieldid);
59 $extrafields->fetch_name_optionals_label($object->table_element);
62 $hookmanager->initHooks(array(
'bankcard',
'globalcard'));
68 if ($cancel) $action =
'';
80 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
81 $object->courant = $_POST[
"type"];
82 $object->clos = $_POST[
"clos"];
83 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
84 $object->url = trim(
GETPOST(
"url",
'alpha'));
86 $object->bank = trim($_POST[
"bank"]);
87 $object->code_banque = trim($_POST[
"code_banque"]);
88 $object->code_guichet = trim($_POST[
"code_guichet"]);
89 $object->number = trim($_POST[
"number"]);
90 $object->cle_rib = trim($_POST[
"cle_rib"]);
91 $object->bic = trim($_POST[
"bic"]);
92 $object->iban = trim($_POST[
"iban"]);
93 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"nohtml"));
95 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
96 $object->owner_address = trim(
GETPOST(
"owner_address",
'nohtml'));
98 $account_number =
GETPOST(
'account_number',
'alphanohtml');
99 if (empty($account_number) || $account_number ==
'-1')
101 $object->account_number =
'';
103 $object->account_number = $account_number;
105 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
106 if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal =
''; }
else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
108 $object->solde = $_POST[
"solde"];
111 $object->currency_code = trim($_POST[
"account_currency_code"]);
113 $object->state_id =
GETPOST(
"account_state_id",
'int');
114 $object->country_id =
GETPOST(
"account_country_id",
'int');
116 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
117 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
118 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
120 $object->fk_user_author = $user->id;
122 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
124 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")), null,
'errors');
128 if (empty($object->ref))
130 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")), null,
'errors');
134 if (empty($object->label))
136 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")), null,
'errors');
142 $ret = $extrafields->setOptionalsFromPost(null, $object);
146 $id = $object->create($user);
150 $categories =
GETPOST(
'categories',
'array');
151 $object->setCategories($categories);
172 if ($action ==
'update')
178 $object->fetch(
GETPOST(
"id",
'int'));
181 $object->label = trim(
GETPOST(
"label",
'alphanohtml'));
182 $object->courant = $_POST[
"type"];
183 $object->clos = $_POST[
"clos"];
184 $object->rappro = (
GETPOST(
"norappro",
'alpha') ? 0 : 1);
185 $object->url = trim(
GETPOST(
"url",
'alpha'));
187 $object->bank = trim($_POST[
"bank"]);
188 $object->code_banque = trim($_POST[
"code_banque"]);
189 $object->code_guichet = trim($_POST[
"code_guichet"]);
190 $object->number = trim($_POST[
"number"]);
191 $object->cle_rib = trim($_POST[
"cle_rib"]);
192 $object->bic = trim($_POST[
"bic"]);
193 $object->iban = trim($_POST[
"iban"]);
194 $object->domiciliation = trim(
GETPOST(
"domiciliation",
"nohtml"));
196 $object->proprio = trim(
GETPOST(
"proprio",
'alphanohtml'));
197 $object->owner_address = trim(
GETPOST(
"owner_address",
'nohtml'));
199 $account_number =
GETPOST(
'account_number',
'alpha');
200 if (empty($account_number) || $account_number ==
'-1')
202 $object->account_number =
'';
204 $object->account_number = $account_number;
206 $fk_accountancy_journal =
GETPOST(
'fk_accountancy_journal',
'int');
207 if ($fk_accountancy_journal <= 0) { $object->fk_accountancy_journal =
''; }
else { $object->fk_accountancy_journal = $fk_accountancy_journal; }
209 $object->currency_code = trim($_POST[
"account_currency_code"]);
211 $object->state_id =
GETPOST(
"account_state_id",
'int');
212 $object->country_id =
GETPOST(
"account_country_id",
'int');
214 $object->min_allowed =
GETPOST(
"account_min_allowed",
'int');
215 $object->min_desired =
GETPOST(
"account_min_desired",
'int');
216 $object->comment = trim(
GETPOST(
"account_comment",
'restricthtml'));
218 if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number))
220 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountancyCode")), null,
'errors');
224 if (empty($object->ref))
226 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Ref")), null,
'errors');
230 if (empty($object->label))
232 setEventMessages($langs->transnoentitiesnoconv(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"LabelBankCashAccount")), null,
'errors');
242 $ret = $extrafields->setOptionalsFromPost(null, $object);
247 $result = $object->update($user);
251 $categories =
GETPOST(
'categories',
'array');
252 $object->setCategories($categories);
254 $_GET[
"id"] = $_POST[
"id"];
270 if ($action ==
'confirm_delete' && $_POST[
"confirm"] ==
"yes" && $user->rights->banque->configurer)
274 $object->fetch(
GETPOST(
"id",
"int"));
275 $result = $object->delete($user);
280 header(
"Location: ".DOL_URL_ROOT.
"/compta/bank/list.php");
293 $form =
new Form($db);
296 if (!empty($conf->accounting->enabled)) $formaccounting =
new FormAccounting($db);
298 $countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
300 $title = $langs->trans(
"FinancialAccount").
" - ".$langs->trans(
"Card");
307 if ($action ==
'create')
313 if ($conf->use_javascript_ajax)
315 print "\n".
'<script type="text/javascript" language="javascript">';
316 print 'jQuery(document).ready(function () {
317 jQuery("#selecttype").change(function() {
318 document.formsoc.action.value="create";
319 document.formsoc.submit();
321 jQuery("#selectaccount_country_id").change(function() {
322 document.formsoc.action.value="create";
323 document.formsoc.submit();
326 print '</script>'.
"\n";
329 print '<form action="'.$_SERVER[
"PHP_SELF"].
'" name="formsoc" method="post">';
330 print '<input type="hidden" name="token" value="'.newToken().
'">';
331 print '<input type="hidden" name="action" value="add">';
332 print '<input type="hidden" name="clos" value="0">';
336 print '<table class="border centpercent">';
339 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
340 print '<td><input size="8" type="text" class="flat" name="ref" value="'.dol_escape_htmltag(
GETPOST(
"ref") ?
GETPOST(
"ref",
'alpha') : $object->ref).
'" maxlength="12" autofocus></td></tr>';
343 print '<tr><td class="fieldrequired">'.$langs->trans(
"LabelBankCashAccount").
'</td>';
344 print '<td><input type="text" class="flat maxwidth150onsmartphone" name="label" value="'.dol_escape_htmltag(
GETPOST(
"label",
'alpha')).
'"></td></tr>';
347 print '<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
353 print '<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
355 $selectedcode = $object->currency_code;
356 if (!$selectedcode) $selectedcode = $conf->currency;
357 print $form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
363 print '<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
365 print $form->selectarray(
"clos", $object->status, (
GETPOST(
"clos",
'int') !=
'' ?
GETPOST(
"clos",
'int') : $object->clos), 0, 0, 0,
'', 0, 0, 0,
'',
'maxwidth150onsmartphone');
371 $selectedcode =
GETPOST(
"account_country_id") ?
GETPOST(
"account_country_id") : $object->country_code;
372 } elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code;
373 $object->country_code =
getCountry($selectedcode, 2);
375 print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
377 print $form->select_country($selectedcode, 'account_country_id');
378 if ($user->admin)
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
382 print '<tr><td>'.$langs->trans('State').'</td><td>';
385 $formcompany->select_departement(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") :
'', $selectedcode,
'account_state_id');
387 print $countrynotdefined;
392 print '<tr><td>'.$langs->trans(
"Web").
'</td>';
393 print '<td><input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST(
"url").
'"></td></tr>';
396 if ($conf->categorie->enabled)
398 print '<tr><td>'.$langs->trans(
"Categories").
'</td><td>';
399 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
401 $arrayselected = array();
403 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
406 foreach ($cats as $cat) {
407 $arrayselected[] = $cat->id;
410 print img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
415 print '<tr><td>'.$langs->trans(
"Comment").
'</td>';
418 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
419 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") : $object->comment),
'', 90,
'dolibarr_notes',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4,
'90%');
420 $doleditor->Create();
424 $parameters = array();
425 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
426 print $hookmanager->resPrint;
429 print $object->showOptionals($extrafields,
'edit', $parameters);
436 print '<table class="border centpercent">';
439 print '<tr><td class="titlefieldcreate">'.$langs->trans(
"InitialBankBalance").
'</td>';
440 print '<td><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST(
"solde") ?
GETPOST(
"solde") :
price2num($object->solde)).
'"></td></tr>';
442 print '<tr><td>'.$langs->trans(
"Date").
'</td>';
444 print $form->selectDate(
'',
're', 0, 0, 0,
'formsoc');
447 print '<tr><td>'.$langs->trans(
"BalanceMinimalAllowed").
'</td>';
448 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>';
450 print '<tr><td>'.$langs->trans(
"BalanceMinimalDesired").
'</td>';
451 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>';
458 print '<table class="border centpercent">';
461 print '<tr><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
462 print '<td><input type="text" class="flat minwidth150" name="bank" value="'.(GETPOST(
'bank') ?
GETPOST(
'bank',
'alpha') : $object->bank).
'"></td>';
467 foreach ($object->getFieldsToShow() as $val) {
468 if ($val ==
'BankCode') {
469 $name =
'code_banque';
470 $sizecss =
'minwidth100';
471 $content = $object->code_banque;
472 } elseif ($val ==
'DeskCode') {
473 $name =
'code_guichet';
474 $sizecss =
'minwidth100';
475 $content = $object->code_guichet;
476 } elseif ($val ==
'BankAccountNumber') {
478 $sizecss =
'minwidth200';
479 $content = $object->number;
480 } elseif ($val ==
'BankAccountNumberKey') {
482 $sizecss =
'minwidth50';
483 $content = $object->cle_rib;
486 print '<td>'.$langs->trans($val).
'</td>';
487 print '<td><input type="text" class="flat '.$sizecss.
'" name="'.$name.
'" value="'.(
GETPOST($name) ?
GETPOST($name,
'alpha') : $content).
'"></td>';
491 $bickey =
"BICNumber";
492 if ($object->getCountryCode() ==
'IN') $bickey =
"SWIFT";
495 print '<tr><td>'.$langs->trans($ibankey).
'</td>';
496 print '<td><input maxlength="34" type="text" class="flat minwidth300" name="iban" value="'.(GETPOST(
'iban') ?
GETPOST(
'iban',
'alpha') : $object->iban).
'"></td></tr>';
498 print '<tr><td>'.$langs->trans($bickey).
'</td>';
499 print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST(
'bic') ?
GETPOST(
'bic',
'alpha') : $object->bic).
'"></td></tr>';
501 print '<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
502 print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
504 print "</textarea></td></tr>";
506 print '<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
507 print '<td><input type="text" class="flat minwidth300" name="proprio" value="'.(GETPOST(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $object->proprio).
'">';
510 print '<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
511 print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
512 print (
GETPOST(
'owner_address') ?
GETPOST(
'owner_address',
'alpha') : $object->owner_address);
513 print "</textarea></td></tr>";
519 print '<table class="border centpercent">';
522 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) $fieldrequired =
'fieldrequired ';
524 if (!empty($conf->accounting->enabled))
526 print '<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
528 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
531 print '<tr><td class="'.$fieldrequired.
'titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
532 print '<td><input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
'account_number',
'alpha') : $object->account_number).
'"></td></tr>';
536 if (!empty($conf->accounting->enabled))
538 print '<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
540 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
548 print '<div class="center">';
549 print '<input type="submit" class="button" value="'.$langs->trans(
"CreateAccount").
'">';
550 print ' ';
551 print '<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
562 if (($_GET[
"id"] || $_GET[
"ref"]) && $action !=
'edit') {
566 $object->fetch($_GET[
"id"]);
570 $object->fetch(0, $_GET[
"ref"]);
571 $_GET[
"id"] = $object->id;
581 if ($action ==
'delete')
583 $formconfirm = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
"DeleteAccount"), $langs->trans(
"ConfirmDeleteAccount"),
"confirm_delete");
589 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
592 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
595 print '<div class="fichecenter">';
596 print '<div class="fichehalfleft">';
597 print '<div class="underbanner clearboth"></div>';
599 print '<table class="border tableforfield" width="100%">';
602 print '<tr><td class="titlefield">'.$langs->trans(
"AccountType").
'</td>';
603 print '<td>'.$object->type_lib[$object->type].
'</td></tr>';
606 print '<tr><td>'.$langs->trans(
"Currency").
'</td>';
608 $selectedcode = $object->currency_code;
609 if (!$selectedcode) $selectedcode = $conf->currency;
610 print $langs->trans(
"Currency".$selectedcode);
614 print '<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
616 $conciliate = $object->canBeConciliated();
617 if ($conciliate == -2)
print $langs->trans(
"No").
' <span class="opacitymedium">('.$langs->trans(
"CashAccount").
')</span>';
618 elseif ($conciliate == -3)
print $langs->trans("No").' <span class="opacitymedium">('.$langs->trans("Closed").')</span>';
619 else print ($object->rappro == 1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
622 print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
623 print '<td>'.$object->min_allowed.'</td></tr>';
625 print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
626 print '<td>'.$object->min_desired.'</td></tr>';
629 print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
631 if (!empty($conf->accounting->enabled)) {
633 $accountingaccount->fetch(
'', $object->account_number, 1);
635 print $accountingaccount->getNomUrl(0, 1, 1,
'', 1);
637 print $object->account_number;
642 if (!empty($conf->accounting->enabled))
644 print '<tr><td>'.$langs->trans(
"AccountancyJournal").
'</td>';
647 if ($object->fk_accountancy_journal > 0) {
649 $accountingjournal->fetch($object->fk_accountancy_journal);
651 print $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
658 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
663 print '<div class="fichehalfright">';
664 print '<div class="ficheaddleft">';
665 print '<div class="underbanner clearboth"></div>';
667 print '<table class="border tableforfield centpercent">';
670 if ($conf->categorie->enabled) {
671 print '<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td><td>';
672 print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
676 print '<tr><td class="tdtop titlefield">'.$langs->trans(
"Comment").
'</td>';
677 print '<td>'.dol_htmlentitiesbr($object->comment).
'</td></tr>';
683 print '<div class="underbanner clearboth"></div>';
685 print '<table class="border tableforfield centpercent">';
687 print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"BankName").
'</td>';
688 print '<td>'.$object->bank.
'</td></tr>';
691 foreach ($object->getFieldsToShow() as $val) {
692 if ($val ==
'BankCode') {
693 $content = $object->code_banque;
694 } elseif ($val ==
'DeskCode') {
695 $content = $object->code_guichet;
696 } elseif ($val ==
'BankAccountNumber') {
697 $content = $object->number;
698 } elseif ($val ==
'BankAccountNumberKey') {
699 $content = $object->cle_rib;
702 print '<tr><td>'.$langs->trans($val).
'</td>';
703 print '<td>'.$content.
'</td>';
708 $bickey =
"BICNumber";
709 if ($object->getCountryCode() ==
'IN') $bickey =
"SWIFT";
711 print '<tr><td>'.$langs->trans($ibankey).
'</td>';
712 print '<td>'.$object->iban.
' ';
713 if (!empty($object->iban)) {
722 print '<tr><td>'.$langs->trans($bickey).
'</td>';
723 print '<td>'.$object->bic.
' ';
724 if (!empty($object->bic)) {
733 print '<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
734 print nl2br($object->domiciliation);
735 print "</td></tr>\n";
737 print '<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td><td>';
738 print $object->proprio;
739 print "</td></tr>\n";
741 print '<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
742 print nl2br($object->owner_address);
743 print "</td></tr>\n";
752 print '<div class="clearboth"></div>';
759 print '<div class="tabsAction">';
761 if ($user->rights->banque->configurer)
763 print '<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
766 $canbedeleted = $object->can_be_deleted();
767 if ($user->rights->banque->configurer && $canbedeleted)
769 print '<a class="butActionDelete" href="'.$_SERVER[
"PHP_SELF"].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Delete").
'</a>';
781 if (
GETPOST(
'id',
'int') && $action ==
'edit' && $user->rights->banque->configurer)
784 $object->fetch(
GETPOST(
'id',
'int'));
788 if ($conf->use_javascript_ajax)
790 print "\n".
'<script type="text/javascript" language="javascript">';
791 print 'jQuery(document).ready(function () {
792 jQuery("#selecttype").change(function() {
793 document.formsoc.action.value="edit";
794 document.formsoc.submit();
798 print 'jQuery(document).ready(function () {
799 jQuery("#selectaccount_country_id").change(function() {
800 document.formsoc.action.value="edit";
801 document.formsoc.submit();
804 print '</script>'.
"\n";
807 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post" name="formsoc">';
808 print '<input type="hidden" name="token" value="'.newToken().
'">';
809 print '<input type="hidden" name="action" value="update">';
810 print '<input type="hidden" name="id" value="'.$_REQUEST[
"id"].
'">'.
"\n\n";
816 print '<table class="border centpercent">';
819 print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
820 print '<td><input type="text" class="flat maxwidth200" name="ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
"ref") ?
GETPOST(
"ref") : $object->ref).
'"></td></tr>';
823 print '<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td>';
824 print '<td><input type="text" class="flat minwidth300" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
"label") ?
GETPOST(
"label") : $object->label).
'"></td></tr>';
827 print '<tr><td class="fieldrequired">'.$langs->trans(
"AccountType").
'</td>';
828 print '<td class="maxwidth200onsmartphone">';
829 $formbank->selectTypeOfBankAccount((
GETPOSTISSET(
"type") ?
GETPOST(
"type") : $object->type),
"type");
833 print '<tr><td class="fieldrequired">'.$langs->trans(
"Currency");
834 print '<input type="hidden" value="'.$object->currency_code.
'">';
836 print '<td class="maxwidth200onsmartphone">';
837 $selectedcode = $object->currency_code;
838 if (!$selectedcode) $selectedcode = $conf->currency;
839 print $form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
845 print '<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
846 print '<td class="maxwidth200onsmartphone">';
851 $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
852 $selectedcode = $object->country_code;
854 elseif (empty($selectedcode)) $selectedcode = $mysoc->country_code;
855 $object->country_code =
getCountry($selectedcode, 2);
857 print '<tr><td class="fieldrequired">'.$langs->trans("Country").'</td>';
858 print '<td class="maxwidth200onsmartphone">';
859 print $form->select_country($selectedcode, 'account_country_id');
860 if ($user->admin)
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
864 print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
867 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOST(
"account_state_id") : $object->state_id, $selectedcode,
'account_state_id');
869 print $countrynotdefined;
874 print '<tr><td>'.$langs->trans(
"Conciliable").
'</td>';
876 $conciliate = $object->canBeConciliated();
877 if ($conciliate == -2)
print $langs->trans(
"No").
' ('.$langs->trans(
"CashAccount").
')';
878 elseif ($conciliate == -3)
print $langs->trans("No").' ('.$langs->trans("Closed").')';
879 else print '<input
type="checkbox" class="flat"
name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> '.$langs->trans("DisableConciliation");
883 print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
884 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>';
886 print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
887 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>';
890 print '<tr><td>'.$langs->trans("Web").'</td>';
895 if ($conf->categorie->enabled)
897 print '<tr><td class="tdtop">'.$langs->trans(
"Categories").
'</td><td>';
898 $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT,
'',
'parent', 64, 0, 1);
900 $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
903 foreach ($cats as $cat) {
904 $arrayselected[] = $cat->id;
907 print img_picto(
'',
'category').$form->multiselectarray(
'categories', $cate_arbo, $arrayselected,
'', 0,
'quatrevingtpercent widthcentpercentminusx', 0, 0);
912 print '<tr><td class="tdtop">'.$langs->trans(
"Comment").
'</td>';
915 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
916 $doleditor =
new DolEditor(
'account_comment', (
GETPOST(
"account_comment") ?
GETPOST(
"account_comment") : $object->comment),
'', 90,
'dolibarr_notes',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_4,
'95%');
917 $doleditor->Create();
921 $parameters = array();
922 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
923 print $hookmanager->resPrint;
926 print $object->showOptionals($extrafields,
'edit', $parameters);
935 print '<table class="border centpercent">';
938 $tdextra =
' class="titlefieldcreate"';
940 if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
941 $tdextra =
' class="fieldrequired titlefieldcreate"';
944 print '<tr class="liste_titre_add"><td'.$tdextra.
'>'.$langs->trans(
"AccountancyCode").
'</td>';
946 if (!empty($conf->accounting->enabled)) {
947 print $formaccounting->select_account($object->account_number,
'account_number', 1,
'', 1, 1);
949 print '<input type="text" name="account_number" value="'.(GETPOST(
"account_number") ?
GETPOST(
"account_number") : $object->account_number).
'">';
954 if (!empty($conf->accounting->enabled))
956 print '<tr><td class="fieldrequired">'.$langs->trans(
"AccountancyJournal").
'</td>';
958 print $formaccounting->select_journal($object->fk_accountancy_journal,
'fk_accountancy_journal', 4, 1, 0, 0);
970 print '<table class="border centpercent">';
973 print '<tr class="liste_titre_add"><td class="titlefieldcreate">'.$langs->trans(
"BankName").
'</td>';
974 print '<td><input size="30" type="text" class="flat" name="bank" value="'.$object->bank.
'"></td>';
978 foreach ($object->getFieldsToShow() as $val) {
979 if ($val ==
'BankCode') {
980 $name =
'code_banque';
982 $content = $object->code_banque;
983 } elseif ($val ==
'DeskCode') {
984 $name =
'code_guichet';
986 $content = $object->code_guichet;
987 } elseif ($val ==
'BankAccountNumber') {
990 $content = $object->number;
991 } elseif ($val ==
'BankAccountNumberKey') {
994 $content = $object->cle_rib;
997 print '<tr><td>'.$langs->trans($val).
'</td>';
998 print '<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1003 $bickey =
"BICNumber";
1004 if ($object->getCountryCode() ==
'IN') $bickey =
"SWIFT";
1007 print '<tr><td>'.$langs->trans($ibankey).
'</td>';
1008 print '<td><input class="minwidth300 maxwidth200onsmartphone" maxlength="34" type="text" class="flat" name="iban" value="'.$object->iban.
'"></td></tr>';
1010 print '<tr><td>'.$langs->trans($bickey).
'</td>';
1011 print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="11" type="text" class="flat" name="bic" value="'.$object->bic.
'"></td></tr>';
1013 print '<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1014 print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.
'">';
1015 print $object->domiciliation;
1016 print "</textarea></td></tr>";
1018 print '<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1019 print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.
'"></td>';
1022 print '<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1023 print '<textarea class="flat quatrevingtpercent" name="owner_address" rows="'.ROWS_2.
'">';
1024 print $object->owner_address;
1025 print "</textarea></td></tr>";
1032 print '<div class="center">';
1033 print '<input value="'.$langs->trans(
"Modify").
'" type="submit" class="button">';
1034 print ' ';
1035 print '<input name="cancel" value="'.$langs->trans(
"Cancel").
'" type="submit" class="button button-cancel">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
bank_prepare_head(Account $object)
Prepare array with list of tabs.
const TYPE_CURRENT
Current account.
checkSwiftForAccount($account)
Check SWIFT informations for a bank account.
$conf db name
Only used if Module[ID]Name translation string is not found.
Class to manage bank accounts.
dol_string_nospecial($str, $newstr= '_', $badcharstoreplace= '')
Clean a string from all punctuation characters to use it as a ref or login.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!GETPOST('transkey', 'alphanohtml')&&!GETPOST('transphrase', 'alphanohtml')) else
View.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
checkIbanForAccount($account)
Check IBAN number informations for a bank account.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
const TYPE_SAVINGS
Savings account.
Class to manage accounting accounts.
Class to manage accounting accounts.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.