dolibarr  16.0.5
card.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4  * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
5  * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
6  * Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
7  * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
8  * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
9  * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
10  * Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <https://www.gnu.org/licenses/>.
24  */
25 
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';
39 if (isModEnabled('categorie')) {
40  require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
41 }
42 if (isModEnabled('accounting')) {
43  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
44 }
45 if (isModEnabled('accounting')) {
46  require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
47 }
48 if (isModEnabled('accounting')) {
49  require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
50 }
51 
52 // Load translation files required by the page
53 $langs->loadLangs(array("banks", "bills", "categories", "companies", "compta"));
54 
55 $action = GETPOST('action', 'aZ09');
56 $cancel = GETPOST('cancel', 'alpha');
57 
58 $object = new Account($db);
59 $extrafields = new ExtraFields($db);
60 
61 // fetch optionals attributes and labels
62 $extrafields->fetch_name_optionals_label($object->table_element);
63 
64 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
65 $hookmanager->initHooks(array('bankcard', 'globalcard'));
66 
67 // Security check
68 $id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
69 $fieldid = GETPOST("id", 'int') ? 'rowid' : 'ref';
70 
71 $result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
72 
73 
74 /*
75  * Actions
76  */
77 
78 $parameters = array();
79 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
80 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
81 
82 if (empty($reshook)) {
83  $backurlforlist = DOL_URL_ROOT.'/compta/bank/list.php';
84 
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;
89  } else {
90  $backtopage = DOL_URL_ROOT.'/compta/bank/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
91  }
92  }
93  }
94 
95  if ($cancel) {
96  if (!empty($backtopageforcancel)) {
97  header("Location: ".$backtopageforcancel);
98  exit;
99  } elseif (!empty($backtopage)) {
100  header("Location: ".$backtopage);
101  exit;
102  }
103  $action = '';
104  }
105 
106  if ($action == 'add') {
107  $error = 0;
108 
109  $db->begin();
110 
111  // Create account
112  $object = new Account($db);
113 
114  $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
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'));
120 
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;
130 
131  $object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
132  $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
133 
134  $object->ics = trim(GETPOST("ics", 'alpha'));
135  $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
136 
137  $account_number = GETPOST('account_number', 'alphanohtml');
138  if (empty($account_number) || $account_number == '-1') {
139  $object->account_number = '';
140  } else {
141  $object->account_number = $account_number;
142  }
143  $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
144  if ($fk_accountancy_journal <= 0) {
145  $object->fk_accountancy_journal = '';
146  } else {
147  $object->fk_accountancy_journal = $fk_accountancy_journal;
148  }
149 
150  $object->solde = price2num(GETPOST("solde"));
151  $object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int'));
152 
153  $object->currency_code = trim(GETPOST("account_currency_code"));
154 
155  $object->state_id = GETPOST("account_state_id", 'int');
156  $object->country_id = GETPOST("account_country_id", 'int');
157 
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'));
161 
162  $object->fk_user_author = $user->id;
163 
164  if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
165  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
166  $action = 'create'; // Force chargement page en mode creation
167  $error++;
168  }
169  if (empty($object->ref)) {
170  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
171  $action = 'create'; // Force chargement page en mode creation
172  $error++;
173  }
174  if (empty($object->label)) {
175  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
176  $action = 'create'; // Force chargement page en mode creation
177  $error++;
178  }
179 
180  // Fill array 'array_options' with data from add form
181  $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
182 
183  if (!$error) {
184  $id = $object->create($user);
185  if ($id > 0) {
186  // Category association
187  $categories = GETPOST('categories', 'array');
188  $object->setCategories($categories);
189 
190  $_GET["id"] = $id; // Force chargement page en mode visu
191 
192  $action = '';
193  } else {
194  $error++;
195  setEventMessages($object->error, $object->errors, 'errors');
196 
197  $action = 'create'; // Force chargement page en mode creation
198  }
199  }
200 
201  if (!$error) {
202  $db->commit();
203  } else {
204  $db->rollback();
205  }
206  }
207 
208  if ($action == 'update') {
209  $error = 0;
210 
211  // Update account
212  $object = new Account($db);
213  $object->fetch(GETPOST("id", 'int'));
214 
215  $object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
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'));
221 
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;
231 
232  $object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
233  $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml'));
234 
235  $object->ics = trim(GETPOST("ics", 'alpha'));
236  $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'));
237 
238  $account_number = GETPOST('account_number', 'alphanohtml');
239  if (empty($account_number) || $account_number == '-1') {
240  $object->account_number = '';
241  } else {
242  $object->account_number = $account_number;
243  }
244  $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
245  if ($fk_accountancy_journal <= 0) {
246  $object->fk_accountancy_journal = '';
247  } else {
248  $object->fk_accountancy_journal = $fk_accountancy_journal;
249  }
250 
251  $object->currency_code = trim(GETPOST("account_currency_code"));
252 
253  $object->state_id = GETPOST("account_state_id", 'int');
254  $object->country_id = GETPOST("account_country_id", 'int');
255 
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'));
259 
260  if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {
261  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors');
262  $action = 'edit'; // Force chargement page en mode creation
263  $error++;
264  }
265  if (empty($object->ref)) {
266  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors');
267  $action = 'edit'; // Force chargement page en mode creation
268  $error++;
269  }
270  if (empty($object->label)) {
271  setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("LabelBankCashAccount")), null, 'errors');
272  $action = 'edit'; // Force chargement page en mode creation
273  $error++;
274  }
275 
276  $db->begin();
277 
278  if (!$error) {
279  // Fill array 'array_options' with data from add form
280  $ret = $extrafields->setOptionalsFromPost(null, $object);
281  }
282 
283  if (!$error) {
284  $result = $object->update($user);
285  if ($result >= 0) {
286  // Category association
287  $categories = GETPOST('categories', 'array');
288  $object->setCategories($categories);
289 
290  $_GET["id"] = GETPOST("id", 'int'); // Force chargement page en mode visu
291  } else {
292  $error++;
293  setEventMessages($object->error, $object->errors, 'errors');
294  $action = 'edit'; // Force chargement page edition
295  }
296  }
297 
298  if (!$error) {
299  $db->commit();
300  } else {
301  $db->rollback();
302  }
303  }
304 
305  if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->banque->configurer) {
306  // Delete
307  $object = new Account($db);
308  $object->fetch(GETPOST("id", "int"));
309  $result = $object->delete($user);
310 
311  if ($result > 0) {
312  setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
313  header("Location: " . DOL_URL_ROOT . "/compta/bank/list.php");
314  exit;
315  } else {
316  setEventMessages($object->error, $object->errors, 'errors');
317  $action = '';
318  }
319  }
320 }
321 
322 /*
323  * View
324  */
325 
326 $form = new Form($db);
327 $formbank = new FormBank($db);
328 $formcompany = new FormCompany($db);
329 if (isModEnabled('accounting')) {
330  $formaccounting = new FormAccounting($db);
331 }
332 
333 $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
334 
335 $title = $langs->trans("FinancialAccount")." - ".$langs->trans("Card");
336 
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';
338 
339 llxHeader("", $title, $help_url);
340 
341 
342 // Creation
343 
344 if ($action == 'create') {
345  $object = new Account($db);
346 
347  print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
348 
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();
355  });
356  jQuery("#selectaccount_country_id").change(function() {
357  document.formsoc.action.value="create";
358  document.formsoc.submit();
359  });
360  })';
361  print '</script>'."\n";
362  }
363 
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">';
368 
369  print dol_get_fiche_head('');
370 
371  print '<table class="border centpercent tableforfieldcreate">';
372 
373  // Ref
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>';
376 
377  // Label
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>';
380 
381  // Type
382  print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
383  print '<td>';
384  $formbank->selectTypeOfBankAccount(GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT, 'type');
385  print '</td></tr>';
386 
387  // Currency
388  print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
389  print '<td>';
390  $selectedcode = $object->currency_code;
391  if (!$selectedcode) {
392  $selectedcode = $conf->currency;
393  }
394  print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
395  //print $langs->trans("Currency".$conf->currency);
396  //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
397  print '</td></tr>';
398 
399  // Status
400  print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
401  print '<td>';
402  print $form->selectarray("clos", $object->status, (GETPOST('clos', 'int') != '' ? GETPOST('clos', 'int') : $object->clos), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth150onsmartphone');
403  print '</td></tr>';
404 
405  // Country
406  $selectedcode = '';
407  if (GETPOSTISSET("account_country_id")) {
408  $selectedcode = GETPOST("account_country_id") ? GETPOST("account_country_id") : $object->country_code;
409  } elseif (empty($selectedcode)) {
410  $selectedcode = $mysoc->country_code;
411  }
412  $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
413 
414  print '<tr><td class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
415  print '<td>';
416  print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id');
417  if ($user->admin) {
418  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
419  }
420  print '</td></tr>';
421 
422  // State
423  print '<tr><td>'.$langs->trans('State').'</td><td>';
424  if ($selectedcode) {
425  print img_picto('', 'state', 'class="pictofixedwidth"');
426  print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : '', $selectedcode, 'account_state_id');
427  } else {
428  print $countrynotdefined;
429  }
430  print '</td></tr>';
431 
432  // Web
433  print '<tr><td>'.$langs->trans("Web").'</td>';
434  print '<td>';
435  print img_picto('', 'globe', 'class="pictofixedwidth"');
436  print '<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
437  print '</td></tr>';
438 
439  // Tags-Categories
440  if (isModEnabled('categorie')) {
441  print '<tr><td>'.$langs->trans("Categories").'</td><td>';
442  $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
443 
444  $arrayselected = array();
445  $c = new Categorie($db);
446  $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
447  if (is_array($cats)) {
448  foreach ($cats as $cat) {
449  $arrayselected[] = $cat->id;
450  }
451  }
452  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
453  print "</td></tr>";
454  }
455 
456  // Comment
457  print '<tr><td>'.$langs->trans("Comment").'</td>';
458  print '<td>';
459  // Editor wysiwyg
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();
463  print '</td></tr>';
464 
465  // Other attributes
466  $parameters = array();
467  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
468  print $hookmanager->resPrint;
469  if (empty($reshook)) {
470  print $object->showOptionals($extrafields, 'create', $parameters);
471  }
472 
473  print '</table>';
474 
475  print '<br>';
476 
477  print '<table class="border centpercent">';
478 
479  // Sold
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>';
482 
483  print '<tr><td>'.$langs->trans("Date").'</td>';
484  print '<td>';
485  print $form->selectDate('', 're', 0, 0, 0, 'formsoc');
486  print '</td></tr>';
487 
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>';
490 
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>';
493 
494  print '</table>';
495  print '<br>';
496 
497  $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value
498  if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
499  print '<table class="border centpercent">';
500 
501  // If bank account
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>';
504  print '</tr>';
505 
506  // Show fields of bank account
507  $sizecss = '';
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') {
518  $name = 'number';
519  $sizecss = 'minwidth200';
520  $content = $object->number;
521  } elseif ($val == 'BankAccountNumberKey') {
522  $name = 'cle_rib';
523  $sizecss = 'minwidth50';
524  $content = $object->cle_rib;
525  }
526 
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>';
529  print '</tr>';
530  }
531  $ibankey = FormBank::getIBANLabel($object);
532  $bickey = "BICNumber";
533  if ($object->getCountryCode() == 'IN') {
534  $bickey = "SWIFT";
535  }
536 
537  // IBAN
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>';
540 
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>';
543 
544  if (isModEnabled('paymentbybanktransfer')) {
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 ') . '>&nbsp;';
547  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
548  print '</td></tr>';
549  }
550 
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>";
555 
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).'">';
558  print '</td></tr>';
559 
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>";
564 
565  print '</table>';
566  print '<br>';
567  }
568 
569  print '<table class="border centpercent">';
570  // Accountancy code
571  $fieldrequired = '';
572  if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
573  $fieldrequired = 'fieldrequired ';
574  }
575 
576  if (isModEnabled('accounting')) {
577  print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
578  print '<td>';
579  print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
580  print '</td></tr>';
581  } else {
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>';
584  }
585 
586  // Accountancy journal
587  if (isModEnabled('accounting')) {
588  print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
589  print '<td>';
590  print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
591  print '</td></tr>';
592  }
593 
594  print '</table>';
595 
596  print dol_get_fiche_end();
597 
598  print $form->buttonsSaveCancel("CreateAccount");
599 
600  print '</form>';
601 } else {
602  /* ************************************************************************** */
603  /* */
604  /* Visu et edition */
605  /* */
606  /* ************************************************************************** */
607 
608  if ((GETPOST("id", 'int') || GETPOST("ref")) && $action != 'edit') {
609  $object = new Account($db);
610  if (GETPOST("id", 'int')) {
611  $object->fetch(GETPOST("id", 'int'));
612  }
613  if (GETPOST("ref")) {
614  $object->fetch(0, GETPOST("ref"));
615  $_GET["id"] = $object->id;
616  }
617 
618  // Show tabs
619  $head = bank_prepare_head($object);
620  print dol_get_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"), -1, 'account');
621 
622  $formconfirm = '';
623 
624  // Confirmation to delete
625  if ($action == 'delete') {
626  $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("DeleteAccount"), $langs->trans("ConfirmDeleteAccount"), "confirm_delete");
627  }
628 
629  // Print form confirm
630  print $formconfirm;
631 
632  $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
633 
634  $morehtmlref = '';
635  dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
636 
637 
638  print '<div class="fichecenter">';
639  print '<div class="fichehalfleft">';
640  print '<div class="underbanner clearboth"></div>';
641 
642  print '<table class="border tableforfield" width="100%">';
643 
644  // Type
645  print '<tr><td class="titlefield">'.$langs->trans("AccountType").'</td>';
646  print '<td>'.$object->type_lib[$object->type].'</td></tr>';
647 
648  // Currency
649  print '<tr><td>'.$langs->trans("Currency").'</td>';
650  print '<td>';
651  $selectedcode = $object->currency_code;
652  if (!$selectedcode) {
653  $selectedcode = $conf->currency;
654  }
655  print $langs->trans("Currency".$selectedcode);
656  print '</td></tr>';
657 
658  // Conciliate
659  print '<tr><td>'.$langs->trans("Conciliable").'</td>';
660  print '<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>';
666  } else {
667  print ($object->rappro == 1 ? $langs->trans("Yes") : ($langs->trans("No").' <span class="opacitymedium">('.$langs->trans("ConciliationDisabled").')</span>'));
668  }
669  print '</td></tr>';
670 
671  print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
672  print '<td>'.$object->min_allowed.'</td></tr>';
673 
674  print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
675  print '<td>'.$object->min_desired.'</td></tr>';
676 
677  // Accountancy code
678  print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
679  print '<td>';
680  if (isModEnabled('accounting')) {
681  $accountingaccount = new AccountingAccount($db);
682  $accountingaccount->fetch('', $object->account_number, 1);
683 
684  print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
685  } else {
686  print $object->account_number;
687  }
688  print '</td></tr>';
689 
690  // Accountancy journal
691  if (isModEnabled('accounting')) {
692  print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
693  print '<td>';
694 
695  if ($object->fk_accountancy_journal > 0) {
696  $accountingjournal = new AccountingJournal($db);
697  $accountingjournal->fetch($object->fk_accountancy_journal);
698 
699  print $accountingjournal->getNomUrl(0, 1, 1, '', 1);
700  }
701  print '</td></tr>';
702  }
703 
704  // Other attributes
705  $cols = 2;
706  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
707 
708  print '</table>';
709 
710  print '</div>';
711  print '<div class="fichehalfright">';
712  print '<div class="underbanner clearboth"></div>';
713 
714  print '<table class="border tableforfield centpercent">';
715 
716  // Categories
717  if (isModEnabled('categorie')) {
718  print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
719  print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
720  print "</td></tr>";
721  }
722 
723  print '<tr><td class="tdtop titlefield">'.$langs->trans("Comment").'</td>';
724  print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
725 
726  print '</table>';
727 
728  if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
729  //print '<div class="underbanner clearboth"></div>';
730 
731  print '<table class="border tableforfield centpercent">';
732 
733  print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("BankName").'</td>';
734  print '<td>'.$object->bank.'</td></tr>';
735 
736  // Show fields of bank account
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;
746  }
747 
748  print '<tr><td>'.$langs->trans($val).'</td>';
749  print '<td>'.$content.'</td>';
750  print '</tr>';
751  }
752 
753  $ibankey = FormBank::getIBANLabel($object);
754  $bickey = "BICNumber";
755  if ($object->getCountryCode() == 'IN') {
756  $bickey = "SWIFT";
757  }
758 
759  print '<tr><td>'.$langs->trans($ibankey).'</td>';
760  print '<td>'.$object->iban.'&nbsp;';
761  if (!empty($object->iban)) {
762  if (!checkIbanForAccount($object)) {
763  print img_picto($langs->trans("IbanNotValid"), 'warning');
764  } else {
765  print img_picto($langs->trans("IbanValid"), 'info');
766  }
767  }
768  print '</td></tr>';
769 
770  print '<tr><td>'.$langs->trans($bickey).'</td>';
771  print '<td>'.$object->bic.'&nbsp;';
772  if (!empty($object->bic)) {
773  if (!checkSwiftForAccount($object)) {
774  print img_picto($langs->trans("SwiftNotValid"), 'warning');
775  } else {
776  print img_picto($langs->trans("SwiftValid"), 'info');
777  }
778  }
779  print '</td></tr>';
780 
781  if (isModEnabled('prelevement')) {
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>';
784  print '</tr>';
785  }
786 
787  // TODO ICS is not used with bank transfer !
788  if (isModEnabled('paymentbybanktransfer')) {
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>';
791  print '</tr>';
792 
793  print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td><td>';
794  print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")) . '&nbsp;';
795  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
796  print "</td></tr>\n";
797  }
798 
799  print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
800  print nl2br($object->domiciliation);
801  print "</td></tr>\n";
802 
803  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td><td>';
804  print $object->proprio;
805  print "</td></tr>\n";
806 
807  print '<tr><td>'.$langs->trans("BankAccountOwnerAddress").'</td><td>';
808  print nl2br($object->owner_address);
809  print "</td></tr>\n";
810 
811  print '</table>';
812  }
813 
814  print '</div>';
815  print '</div>';
816 
817  print '<div class="clearboth"></div>';
818 
819  print dol_get_fiche_end();
820 
821  /*
822  * Action bar
823  */
824  print '<div class="tabsAction">';
825 
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>';
828  }
829 
830  $canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
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>';
833  }
834 
835  print '</div>';
836  }
837 
838  /* ************************************************************************** */
839  /* */
840  /* Edition */
841  /* */
842  /* ************************************************************************** */
843 
844  if (GETPOST('id', 'int') && $action == 'edit' && $user->rights->banque->configurer) {
845  $object = new Account($db);
846  $object->fetch(GETPOST('id', 'int'));
847 
848  print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
849 
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();
856  });
857  })'."\n";
858 
859  print 'jQuery(document).ready(function () {
860  jQuery("#selectaccount_country_id").change(function() {
861  document.formsoc.action.value="edit";
862  document.formsoc.submit();
863  });
864  })';
865  print '</script>'."\n";
866  }
867 
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";
872 
873  print dol_get_fiche_head(array(), 0, '', 0);
874 
875  //print '<div class="underbanner clearboth"></div>';
876 
877  print '<table class="border centpercent tableforfieldcreate">';
878 
879  // Ref
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>';
882 
883  // Label
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>';
886 
887  // Type
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');
891  print '</td></tr>';
892 
893  // Currency
894  print '<tr><td class="fieldrequired">'.$langs->trans("Currency");
895  print '<input type="hidden" value="'.$object->currency_code.'">';
896  print '</td>';
897  print '<td class="maxwidth200onsmartphone">';
898  $selectedcode = $object->currency_code;
899  if (!$selectedcode) {
900  $selectedcode = $conf->currency;
901  }
902  print img_picto('', 'multicurrency', 'class="pictofixedwidth"');
903  print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code');
904  //print $langs->trans("Currency".$conf->currency);
905  //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
906  print '</td></tr>';
907 
908  // Status
909  print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
910  print '<td class="maxwidth200onsmartphone">';
911  print $form->selectarray("clos", $object->status, (GETPOSTISSET("clos") ? GETPOST("clos", "int") : $object->clos));
912  print '</td></tr>';
913 
914  // Country
915  $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id;
916  $selectedcode = $object->country_code;
917  if (GETPOSTISSET("account_country_id")) {
918  $selectedcode = GETPOST("account_country_id");
919  } elseif (empty($selectedcode)) {
920  $selectedcode = $mysoc->country_code;
921  }
922  $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
923 
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');
927  if ($user->admin) {
928  print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
929  }
930  print '</td></tr>';
931 
932  // State
933  print '<tr><td>'.$langs->trans('State').'</td><td class="maxwidth200onsmartphone">';
934  if ($selectedcode) {
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');
937  } else {
938  print $countrynotdefined;
939  }
940  print '</td></tr>';
941 
942  // Conciliable
943  print '<tr><td>'.$langs->trans("Conciliable").'</td>';
944  print '<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").')';
950  } else {
951  print '<input type="checkbox" class="flat" id="norappro" name="norappro"'.(($conciliate > 0) ? '' : ' checked="checked"').'"> <label for="norappro">'.$langs->trans("DisableConciliation").'</label>';
952  }
953  print '</td></tr>';
954 
955  // Balance
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>';
958 
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>';
961 
962  // Web
963  print '<tr><td>'.$langs->trans("Web").'</td>';
964  print '<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).'">';
967  print '</td></tr>';
968 
969  // Tags-Categories
970  if (isModEnabled('categorie')) {
971  print '<tr><td>'.$langs->trans("Categories").'</td><td>';
972  $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
973  $c = new Categorie($db);
974  $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT);
975  if (is_array($cats)) {
976  foreach ($cats as $cat) {
977  $arrayselected[] = $cat->id;
978  }
979  }
980  print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
981  print "</td></tr>";
982  }
983 
984  // Comment
985  print '<tr><td class="tdtop">'.$langs->trans("Comment").'</td>';
986  print '<td>';
987  // Editor wysiwyg
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();
991  print '</td></tr>';
992 
993  // Other attributes
994  $parameters = array();
995  $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
996  print $hookmanager->resPrint;
997  if (empty($reshook)) {
998  print $object->showOptionals($extrafields, 'edit', $parameters);
999  }
1000 
1001  print '</table>';
1002  print '<br>';
1003 
1004 
1005  //print '<div class="underbanner clearboth"></div>';
1006 
1007  print '<table class="border centpercent">';
1008 
1009  // Accountancy code
1010  $tdextra = ' class="titlefieldcreate"';
1011 
1012  if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
1013  $tdextra = ' class="fieldrequired titlefieldcreate"';
1014  }
1015 
1016  print '<tr class="liste_titre_add"><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
1017  print '<td>';
1018  if (isModEnabled('accounting')) {
1019  print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
1020  } else {
1021  print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
1022  }
1023  print '</td></tr>';
1024 
1025  // Accountancy journal
1026  if (isModEnabled('accounting')) {
1027  print '<tr><td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
1028  print '<td>';
1029  print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
1030  print '</td></tr>';
1031  }
1032 
1033  print '</table>';
1034 
1035  $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value
1036  if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) {
1037  print '<br>';
1038 
1039  //print '<div class="underbanner clearboth"></div>';
1040 
1041  print '<table class="border centpercent">';
1042 
1043  // If bank account
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>';
1046  print '</tr>';
1047 
1048  // Show fields of bank account
1049  foreach ($object->getFieldsToShow() as $val) {
1050  if ($val == 'BankCode') {
1051  $name = 'code_banque';
1052  $size = 8;
1053  $content = $object->code_banque;
1054  } elseif ($val == 'DeskCode') {
1055  $name = 'code_guichet';
1056  $size = 8;
1057  $content = $object->code_guichet;
1058  } elseif ($val == 'BankAccountNumber') {
1059  $name = 'number';
1060  $size = 18;
1061  $content = $object->number;
1062  } elseif ($val == 'BankAccountNumberKey') {
1063  $name = 'cle_rib';
1064  $size = 3;
1065  $content = $object->cle_rib;
1066  }
1067 
1068  print '<tr><td>'.$langs->trans($val).'</td>';
1069  print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
1070  print '</tr>';
1071  }
1072 
1073  $ibankey = FormBank::getIBANLabel($object);
1074  $bickey = "BICNumber";
1075  if ($object->getCountryCode() == 'IN') {
1076  $bickey = "SWIFT";
1077  }
1078 
1079  // IBAN
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>';
1082 
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>';
1085 
1086  if (isModEnabled('prelevement')) {
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>';
1089  }
1090 
1091  if (!empty(isModEnabled('paymentbybanktransfer'))) {
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>';
1094 
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 ' : '') . '>&nbsp;';
1097  print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
1098  print '</td></tr>';
1099  }
1100 
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>";
1105 
1106  print '<tr><td>'.$langs->trans("BankAccountOwner").'</td>';
1107  print '<td><input class="maxwidth200onsmartphone" type="text" class="flat" name="proprio" value="'.$object->proprio.'"></td>';
1108  print '</tr>';
1109 
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>";
1114 
1115  print '</table>';
1116  }
1117 
1118  print dol_get_fiche_end();
1119 
1120  print $form->buttonsSaveCancel("Modify");
1121 
1122  print '</form>';
1123  }
1124 }
1125 
1126 // End of page
1127 llxFooter();
1128 $db->close();
Account\TYPE_CURRENT
const TYPE_CURRENT
Current account.
Definition: account.class.php:342
restrictedArea
restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
Definition: security.lib.php:234
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
checkIbanForAccount
checkIbanForAccount(Account $account)
Check IBAN number informations for a bank account.
Definition: bank.lib.php:277
checkSwiftForAccount
checkSwiftForAccount($account)
Check SWIFT informations for a bank account.
Definition: bank.lib.php:261
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
Categorie
Class to manage categories.
Definition: categorie.class.php:47
FormAccounting
Class to manage generation of HTML components for accounting management.
Definition: html.formaccounting.class.php:33
dol_banner_tab
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.
Definition: functions.lib.php:2046
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
FormCompany
Class to build HTML component for third parties management Only common components are here.
Definition: html.formcompany.class.php:40
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
$formconfirm
$formconfirm
if ($action == 'delbookkeepingyear') {
Definition: listbyaccount.php:576
AccountingJournal
Class to manage accounting accounts.
Definition: accountingjournal.class.php:27
dol_string_nospecial
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='')
Clean a string from all punctuation characters to use it as a ref or login.
Definition: functions.lib.php:1376
Account\TYPE_SAVINGS
const TYPE_SAVINGS
Savings account.
Definition: account.class.php:350
bank_prepare_head
bank_prepare_head(Account $object)
Prepare array with list of tabs.
Definition: bank.lib.php:37
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4800
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
AccountingAccount
Class to manage accounting accounts.
Definition: accountingaccount.class.php:36
GETPOSTISSET
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Definition: functions.lib.php:386
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
FormBank
Class to manage generation of HTML components for bank module.
Definition: html.formbank.class.php:32
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
$parameters
$parameters
Actions.
Definition: card.php:78
getCountry
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
Definition: company.lib.php:489
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
FormBank\getIBANLabel
static getIBANLabel(Account $account)
Returns the name of the Iban label.
Definition: html.formbank.class.php:75
dol_mktime
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...
Definition: functions.lib.php:2757
getDolGlobalInt
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Definition: functions.lib.php:93
type
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition: repair.php:119
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59
DolEditor
Class to manage a WYSIWYG editor.
Definition: doleditor.class.php:30
Account
Class to manage bank accounts.
Definition: account.class.php:38