/htdocs/compta/bank/fiche.php

https://bitbucket.org/speedealing/speedealing · PHP · 613 lines · 406 code · 115 blank · 92 comment · 79 complexity · eb0392dd9d64d58e66aa7d575a403ef8 MD5 · raw 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-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/compta/bank/fiche.php
  22. * \ingroup banque
  23. * \brief Page to create/view a bank account
  24. */
  25. require 'pre.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
  30. $langs->load("banks");
  31. $langs->load("companies");
  32. $action=GETPOST("action");
  33. // Security check
  34. if (isset($_GET["id"]) || isset($_GET["ref"]))
  35. {
  36. $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
  37. }
  38. $fieldid = isset($_GET["ref"])?'ref':'rowid';
  39. if ($user->societe_id) $socid=$user->societe_id;
  40. $result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
  41. /*
  42. * Actions
  43. */
  44. if ($_POST["action"] == 'add')
  45. {
  46. $error=0;
  47. // Create account
  48. $account = new Account($db,0);
  49. $account->ref = dol_sanitizeFileName(trim($_POST["ref"]));
  50. $account->label = trim($_POST["label"]);
  51. $account->courant = $_POST["type"];
  52. $account->clos = $_POST["clos"];
  53. $account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
  54. $account->url = $_POST["url"];
  55. $account->account_number = trim($_POST["account_number"]);
  56. $account->solde = $_POST["solde"];
  57. $account->date_solde = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
  58. $account->currency_code = trim($_POST["account_currency_code"]);
  59. $account->fk_departement = $_POST["account_departement_id"];
  60. $account->fk_pays = $_POST["account_country_id"];
  61. $account->min_allowed = $_POST["account_min_allowed"];
  62. $account->min_desired = $_POST["account_min_desired"];
  63. $account->comment = trim($_POST["account_comment"]);
  64. if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
  65. {
  66. $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>';
  67. $action='create'; // Force chargement page en mode creation
  68. $error++;
  69. }
  70. if (empty($account->label))
  71. {
  72. $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>';
  73. $action='create'; // Force chargement page en mode creation
  74. $error++;
  75. }
  76. if (! $error)
  77. {
  78. $id = $account->create($user->id);
  79. if ($id > 0)
  80. {
  81. $_GET["id"]=$id; // Force chargement page en mode visu
  82. }
  83. else {
  84. $message='<div class="error">'.$account->error.'</div>';
  85. $action='create'; // Force chargement page en mode creation
  86. }
  87. }
  88. }
  89. if ($_POST["action"] == 'update' && ! $_POST["cancel"])
  90. {
  91. $error=0;
  92. // Update account
  93. $account = new Account($db, $_POST["id"]);
  94. $account->fetch($_POST["id"]);
  95. $account->ref = dol_string_nospecial(trim($_POST["ref"]));
  96. $account->label = trim($_POST["label"]);
  97. $account->courant = $_POST["type"];
  98. $account->clos = $_POST["clos"];
  99. $account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
  100. $account->url = trim($_POST["url"]);
  101. $account->bank = trim($_POST["bank"]);
  102. $account->code_banque = trim($_POST["code_banque"]);
  103. $account->code_guichet = trim($_POST["code_guichet"]);
  104. $account->number = trim($_POST["number"]);
  105. $account->cle_rib = trim($_POST["cle_rib"]);
  106. $account->bic = trim($_POST["bic"]);
  107. $account->iban_prefix = trim($_POST["iban_prefix"]);
  108. $account->domiciliation = trim($_POST["domiciliation"]);
  109. $account->proprio = trim($_POST["proprio"]);
  110. $account->adresse_proprio = trim($_POST["adresse_proprio"]);
  111. $account->account_number = trim($_POST["account_number"]);
  112. $account->currency_code = trim($_POST["account_currency_code"]);
  113. $account->state_id = $_POST["account_departement_id"];
  114. $account->country_id = $_POST["account_country_id"];
  115. $account->min_allowed = $_POST["account_min_allowed"];
  116. $account->min_desired = $_POST["account_min_desired"];
  117. $account->comment = trim($_POST["account_comment"]);
  118. if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
  119. {
  120. $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>';
  121. $action='edit'; // Force chargement page en mode creation
  122. $error++;
  123. }
  124. if (empty($account->label))
  125. {
  126. $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>';
  127. $action='edit'; // Force chargement page en mode creation
  128. $error++;
  129. }
  130. if (! $error)
  131. {
  132. $result = $account->update($user);
  133. if ($result >= 0)
  134. {
  135. $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
  136. }
  137. else
  138. {
  139. $message='<div class="error">'.$account->error.'</div>';
  140. $action='edit'; // Force chargement page edition
  141. }
  142. }
  143. }
  144. if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
  145. {
  146. // Delete
  147. $account = new Account($db);
  148. $account->fetch($_GET["id"]);
  149. $account->delete();
  150. header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
  151. exit;
  152. }
  153. /*
  154. * View
  155. */
  156. $form = new Form($db);
  157. $formbank = new FormBank($db);
  158. $formcompany = new FormCompany($db);
  159. $countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
  160. llxHeader();
  161. // Creation
  162. if ($action == 'create')
  163. {
  164. $account=new Account($db);
  165. print_fiche_titre($langs->trans("NewFinancialAccount"));
  166. dol_htmloutput_mesg($message);
  167. if ($conf->use_javascript_ajax)
  168. {
  169. print "\n".'<script type="text/javascript" language="javascript">';
  170. print 'jQuery(document).ready(function () {
  171. jQuery("#selectaccount_country_id").change(function() {
  172. document.formsoc.action.value="create";
  173. document.formsoc.submit();
  174. });
  175. })';
  176. print '</script>'."\n";
  177. }
  178. print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
  179. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  180. print '<input type="hidden" name="action" value="add">';
  181. print '<input type="hidden" name="clos" value="0">';
  182. print '<table class="border" width="100%">';
  183. // Ref
  184. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Ref").'</td>';
  185. print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'"></td></tr>';
  186. // Label
  187. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
  188. print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$_POST["label"].'"></td></tr>';
  189. // Type
  190. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
  191. print '<td colspan="3">';
  192. print $formbank->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type");
  193. print '</td></tr>';
  194. // Currency
  195. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Currency").'</td>';
  196. print '<td colspan="3">';
  197. $selectedcode=$account->account_currency_code;
  198. if (! $selectedcode) $selectedcode=$conf->currency;
  199. $form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
  200. //print $langs->trans("Currency".$conf->currency);
  201. //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
  202. print '</td></tr>';
  203. // Status
  204. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Status").'</td>';
  205. print '<td colspan="3">';
  206. print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
  207. print '</td></tr>';
  208. // Country
  209. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
  210. print '<td colspan="3">';
  211. $selectedcode='';
  212. if (isset($_POST["account_country_id"]))
  213. {
  214. $selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code;
  215. }
  216. else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
  217. print $form->select_country($selectedcode,'account_country_id');
  218. if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
  219. print '</td></tr>';
  220. // State
  221. print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
  222. if ($selectedcode)
  223. {
  224. $formcompany->select_departement(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:'',$selectedcode,'account_departement_id');
  225. }
  226. else
  227. {
  228. print $countrynotdefined;
  229. }
  230. print '</td></tr>';
  231. // Accountancy code
  232. if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
  233. {
  234. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
  235. print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
  236. }
  237. else
  238. {
  239. print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
  240. print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
  241. }
  242. // Web
  243. print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
  244. print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
  245. // Comment
  246. print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
  247. print '<td colspan="3">';
  248. // Editor wysiwyg
  249. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  250. $doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
  251. $doleditor->Create();
  252. print '</td></tr>';
  253. // Sold
  254. print '<tr><td colspan="4"><b>'.$langs->trans("InitialBankBalance").'...</b></td></tr>';
  255. print '<tr><td valign="top">'.$langs->trans("InitialBankBalance").'</td>';
  256. print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.($_POST["solde"]?$_POST["solde"]:price2num($account->solde)).'"></td></tr>';
  257. print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
  258. print '<td colspan="3">';
  259. $form->select_date(time(), 're', 0, 0, 0, 'formsoc');
  260. print '</td></tr>';
  261. print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
  262. print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->account_min_allowed).'"></td></tr>';
  263. print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
  264. print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>';
  265. print '</table>';
  266. print '<center><br><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></center>';
  267. print '</form>';
  268. }
  269. /* ************************************************************************** */
  270. /* */
  271. /* Visu et edition */
  272. /* */
  273. /* ************************************************************************** */
  274. else
  275. {
  276. if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
  277. {
  278. $account = new Account($db);
  279. if ($_GET["id"])
  280. {
  281. $account->fetch($_GET["id"]);
  282. }
  283. if ($_GET["ref"])
  284. {
  285. $account->fetch(0,$_GET["ref"]);
  286. $_GET["id"]=$account->id;
  287. }
  288. /*
  289. * Affichage onglets
  290. */
  291. // Onglets
  292. $head=bank_prepare_head($account);
  293. dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"),0,'account');
  294. /*
  295. * Confirmation to delete
  296. */
  297. if ($action == 'delete')
  298. {
  299. $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
  300. if ($ret == 'html') print '<br>';
  301. }
  302. print '<table class="border" width="100%">';
  303. $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
  304. // Ref
  305. print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
  306. print '<td colspan="3">';
  307. print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
  308. print '</td></tr>';
  309. // Label
  310. print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
  311. print '<td colspan="3">'.$account->label.'</td></tr>';
  312. // Type
  313. print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
  314. print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
  315. // Currency
  316. print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
  317. print '<td colspan="3">';
  318. $selectedcode=$account->account_currency_code;
  319. if (! $selectedcode) $selectedcode=$conf->currency;
  320. print $langs->trans("Currency".$selectedcode);
  321. print '</td></tr>';
  322. // Status
  323. print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
  324. print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
  325. // Country
  326. print '<tr><td>'.$langs->trans("Country").'</td><td>';
  327. if ($account->fk_pays > 0)
  328. {
  329. $img=picto_from_langcode($account->country_code);
  330. print $img?$img.' ':'';
  331. print getCountry($account->getCountryCode(),0,$db);
  332. }
  333. print '</td></tr>';
  334. // State
  335. print '<tr><td>'.$langs->trans('State').'</td><td>';
  336. if ($account->fk_departement > 0) print getState($account->fk_departement);
  337. print '</td></tr>';
  338. // Conciliate
  339. print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
  340. print '<td colspan="3">';
  341. $conciliate=$account->canBeConciliated();
  342. if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
  343. else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
  344. else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
  345. print '</td></tr>';
  346. // Accountancy code
  347. print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
  348. print '<td colspan="3">'.$account->account_number.'</td></tr>';
  349. print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
  350. print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
  351. print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
  352. print '<td colspan="3">'.$account->min_desired.'</td></tr>';
  353. print '<tr><td valign="top">'.$langs->trans("Web").'</td><td colspan="3">';
  354. if ($account->url) print '<a href="'.$account->url.'" target="_gobank">';
  355. print $account->url;
  356. if ($account->url) print '</a>';
  357. print "</td></tr>\n";
  358. print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
  359. print '<td colspan="3">'.$account->comment.'</td></tr>';
  360. print '</table>';
  361. print '</div>';
  362. /*
  363. * Barre d'actions
  364. */
  365. print '<div class="tabsAction">';
  366. if ($user->rights->banque->configurer)
  367. {
  368. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>';
  369. }
  370. $canbedeleted=$account->can_be_deleted(); // Renvoi vrai si compte sans mouvements
  371. if ($user->rights->banque->configurer && $canbedeleted)
  372. {
  373. print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>';
  374. }
  375. print '</div>';
  376. }
  377. /* ************************************************************************** */
  378. /* */
  379. /* Edition */
  380. /* */
  381. /* ************************************************************************** */
  382. if (GETPOST('id','int') && $action == 'edit' && $user->rights->banque->configurer)
  383. {
  384. $account = new Account($db);
  385. $account->fetch(GETPOST('id','int'));
  386. print_fiche_titre($langs->trans("EditFinancialAccount"));
  387. print "<br>";
  388. if ($message) { print "$message<br>\n"; }
  389. if ($conf->use_javascript_ajax)
  390. {
  391. print "\n".'<script type="text/javascript" language="javascript">';
  392. print 'jQuery(document).ready(function () {
  393. jQuery("#selectaccount_country_id").change(function() {
  394. document.formsoc.action.value="edit";
  395. document.formsoc.submit();
  396. });
  397. })';
  398. print '</script>'."\n";
  399. }
  400. print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post" name="formsoc">';
  401. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  402. print '<input type="hidden" name="action" value="update">';
  403. print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
  404. print '<table class="border" width="100%">';
  405. // Ref
  406. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Ref").'</td>';
  407. print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
  408. // Label
  409. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Label").'</td>';
  410. print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.(isset($_POST["label"])?$_POST["label"]:$account->label).'"></td></tr>';
  411. // Type
  412. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
  413. print '<td colspan="3">';
  414. print $formbank->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type");
  415. print '</td></tr>';
  416. // Currency
  417. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Currency");
  418. print '<input type="hidden" value="'.$account->currency_code.'">';
  419. print '</td>';
  420. print '<td colspan="3">';
  421. $selectedcode=$account->account_currency_code;
  422. if (! $selectedcode) $selectedcode=$conf->currency;
  423. $form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
  424. //print $langs->trans("Currency".$conf->currency);
  425. //print '<input type="hidden" name="account_currency_code" value="'.$conf->currency.'">';
  426. print '</td></tr>';
  427. // Status
  428. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Status").'</td>';
  429. print '<td colspan="3">';
  430. print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
  431. print '</td></tr>';
  432. // Country
  433. $account->country_id=$account->country_id?$account->country_id:$mysoc->country_id;
  434. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
  435. print '<td colspan="3">';
  436. $selectedcode=$account->country_code;
  437. if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
  438. else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
  439. print $form->select_country($selectedcode,'account_country_id');
  440. if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
  441. print '</td></tr>';
  442. // State
  443. print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
  444. if ($selectedcode)
  445. {
  446. print $formcompany->select_state(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:$account->fk_departement,$selectedcode,'account_departement_id');
  447. }
  448. else
  449. {
  450. print $countrynotdefined;
  451. }
  452. print '</td></tr>';
  453. // Conciliable
  454. print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
  455. print '<td colspan="3">';
  456. $conciliate=$account->canBeConciliated();
  457. if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
  458. else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
  459. else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
  460. print '</td></tr>';
  461. // Accountancy code
  462. if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
  463. {
  464. print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
  465. print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
  466. }
  467. else
  468. {
  469. print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
  470. print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
  471. }
  472. // Balance
  473. print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
  474. print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.(isset($_POST["account_min_allowed"])?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>';
  475. print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
  476. print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.(isset($_POST["account_min_desired"])?$_POST["account_min_desired"]:$account->min_desired).'"></td></tr>';
  477. // Web
  478. print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
  479. print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
  480. print '</td></tr>';
  481. // Comment
  482. print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
  483. print '<td colspan="3">';
  484. // Editor wysiwyg
  485. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  486. $doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
  487. $doleditor->Create();
  488. print '</td></tr>';
  489. print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
  490. print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
  491. print '</td></tr>';
  492. print '</table>';
  493. print '</form>';
  494. }
  495. }
  496. $db->close();
  497. llxFooter();
  498. ?>