PageRenderTime 149ms CodeModel.GetById 60ms app.highlight 46ms RepoModel.GetById 35ms app.codeStats 0ms

/htdocs/compta/bank/fiche.php

https://github.com/asterix14/dolibarr
PHP | 612 lines | 402 code | 114 blank | 96 comment | 79 complexity | e92fa3ba52dabd974193f98331220e0d 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-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  5 * Copytight (C) 2005-2009 Regis Houssin        <regis@dolibarr.fr>
  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 2 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/**
 22 *	    \file       htdocs/compta/bank/fiche.php
 23 *      \ingroup    banque
 24 *		\brief      Page to create/view a bank account
 25 */
 26
 27require("./pre.inc.php");
 28require_once(DOL_DOCUMENT_ROOT."/core/lib/bank.lib.php");
 29require_once(DOL_DOCUMENT_ROOT."/core/lib/company.lib.php");
 30require_once(DOL_DOCUMENT_ROOT."/core/class/html.formcompany.class.php");
 31
 32$langs->load("banks");
 33$langs->load("companies");
 34
 35$action=GETPOST("action");
 36
 37// Security check
 38if (isset($_GET["id"]) || isset($_GET["ref"]))
 39{
 40	$id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
 41}
 42$fieldid = isset($_GET["ref"])?'ref':'rowid';
 43if ($user->societe_id) $socid=$user->societe_id;
 44$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid);
 45
 46
 47/*
 48 * Actions
 49 */
 50if ($_POST["action"] == 'add')
 51{
 52    $error=0;
 53
 54    // Create account
 55    $account = new Account($db,0);
 56
 57    $account->ref           = dol_sanitizeFileName(trim($_POST["ref"]));
 58    $account->label         = trim($_POST["label"]);
 59    $account->courant       = $_POST["type"];
 60    $account->clos          = $_POST["clos"];
 61    $account->rappro        = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
 62    $account->url           = $_POST["url"];
 63
 64    $account->account_number  = trim($_POST["account_number"]);
 65
 66    $account->solde           = $_POST["solde"];
 67    $account->date_solde      = dol_mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
 68
 69    $account->currency_code   = trim($_POST["account_currency_code"]);
 70
 71    $account->fk_departement  = $_POST["account_departement_id"];
 72    $account->fk_pays         = $_POST["account_country_id"];
 73
 74    $account->min_allowed     = $_POST["account_min_allowed"];
 75    $account->min_desired     = $_POST["account_min_desired"];
 76    $account->comment         = trim($_POST["account_comment"]);
 77
 78    if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
 79    {
 80        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>';
 81        $action='create';       // Force chargement page en mode creation
 82        $error++;
 83    }
 84
 85    if (empty($account->label))
 86    {
 87        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>';
 88        $action='create';       // Force chargement page en mode creation
 89        $error++;
 90    }
 91
 92    if (! $error)
 93    {
 94        $id = $account->create($user->id);
 95        if ($id > 0)
 96        {
 97            $_GET["id"]=$id;            // Force chargement page en mode visu
 98        }
 99        else {
100            $message='<div class="error">'.$account->error.'</div>';
101            $action='create';   // Force chargement page en mode creation
102        }
103    }
104}
105
106if ($_POST["action"] == 'update' && ! $_POST["cancel"])
107{
108    $error=0;
109
110    // Update account
111    $account = new Account($db, $_POST["id"]);
112    $account->fetch($_POST["id"]);
113
114    $account->ref             = dol_string_nospecial(trim($_POST["ref"]));
115    $account->label           = trim($_POST["label"]);
116    $account->courant         = $_POST["type"];
117    $account->clos            = $_POST["clos"];
118    $account->rappro          = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
119    $account->url             = trim($_POST["url"]);
120
121    $account->bank            = trim($_POST["bank"]);
122    $account->code_banque     = trim($_POST["code_banque"]);
123    $account->code_guichet    = trim($_POST["code_guichet"]);
124    $account->number          = trim($_POST["number"]);
125    $account->cle_rib         = trim($_POST["cle_rib"]);
126    $account->bic             = trim($_POST["bic"]);
127    $account->iban_prefix     = trim($_POST["iban_prefix"]);
128    $account->domiciliation   = trim($_POST["domiciliation"]);
129
130    $account->proprio 	      = trim($_POST["proprio"]);
131    $account->adresse_proprio = trim($_POST["adresse_proprio"]);
132
133    $account->account_number  = trim($_POST["account_number"]);
134
135    $account->currency_code   = trim($_POST["account_currency_code"]);
136
137    $account->fk_departement  = $_POST["account_departement_id"];
138    $account->fk_pays         = $_POST["account_country_id"];
139
140
141    $account->min_allowed     = $_POST["account_min_allowed"];
142    $account->min_desired     = $_POST["account_min_desired"];
143    $account->comment         = trim($_POST["account_comment"]);
144
145    if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
146    {
147        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountancyCode")).'</div>';
148        $action='edit';       // Force chargement page en mode creation
149        $error++;
150    }
151
152    if (empty($account->label))
153    {
154        $message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("LabelBankCashAccount")).'</div>';
155        $action='edit';       // Force chargement page en mode creation
156        $error++;
157    }
158
159    if (! $error)
160    {
161        $result = $account->update($user);
162        if ($result >= 0)
163        {
164            $_GET["id"]=$_POST["id"];   // Force chargement page en mode visu
165        }
166        else
167        {
168            $message='<div class="error">'.$account->error.'</div>';
169            $action='edit';     // Force chargement page edition
170        }
171    }
172}
173
174if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
175{
176    // Modification
177    $account = new Account($db, $_GET["id"]);
178    $account->delete($_GET["id"]);
179
180    header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
181    exit;
182}
183
184
185/*
186 * View
187 */
188
189$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
190
191llxHeader();
192
193$form = new Form($db);
194$formcompany = new FormCompany($db);
195
196/* ************************************************************************** */
197/*                                                                            */
198/* Affichage page en mode creation                                            */
199/*                                                                            */
200/* ************************************************************************** */
201
202if ($action == 'create')
203{
204	$account=new Account($db);
205
206	print_fiche_titre($langs->trans("NewFinancialAccount"));
207
208	dol_htmloutput_mesg($message);
209
210    if ($conf->use_javascript_ajax)
211    {
212        print "\n".'<script type="text/javascript" language="javascript">';
213        print 'jQuery(document).ready(function () {
214                    jQuery("#selectaccount_country_id").change(function() {
215                        document.formsoc.action.value="create";
216                        document.formsoc.submit();
217                    });
218               })';
219        print '</script>'."\n";
220    }
221
222	print '<form action="'.$_SERVER["PHP_SELF"].'" name="formsoc" method="post">';
223	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
224	print '<input type="hidden" name="action" value="add">';
225	print '<input type="hidden" name="clos" value="0">';
226
227	print '<table class="border" width="100%">';
228
229	// Ref
230	print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Ref").'</td>';
231	print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'"></td></tr>';
232
233	// Label
234	print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
235	print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$_POST["label"].'"></td></tr>';
236
237	// Type
238	print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
239	print '<td colspan="3">';
240	print $form->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type");
241	print '</td></tr>';
242
243	// Currency
244	print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Currency").'</td>';
245	print '<td colspan="3">';
246	$selectedcode=$account->account_currency_code;
247	if (! $selectedcode) $selectedcode=$conf->monnaie;
248	$form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
249	//print $langs->trans("Currency".$conf->monnaie);
250	//print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
251	print '</td></tr>';
252
253	// Status
254    print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Status").'</td>';
255    print '<td colspan="3">';
256    print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
257    print '</td></tr>';
258
259	// Country
260	print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
261	print '<td colspan="3">';
262	$selectedcode='';
263	if (isset($_POST["account_country_id"]))
264	{
265		$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->pays_code;
266	}
267	else if (empty($selectedcode)) $selectedcode=$mysoc->pays_code;
268	$form->select_pays($selectedcode,'account_country_id');
269	if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
270	print '</td></tr>';
271
272	// State
273	print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
274	if ($selectedcode)
275	{
276		$formcompany->select_departement(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:'',$selectedcode,'account_departement_id');
277	}
278	else
279	{
280		print $countrynotdefined;
281	}
282	print '</td></tr>';
283
284	// Accountancy code
285    if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)
286    {
287        print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
288        print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
289    }
290    else
291    {
292        print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
293        print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
294    }
295
296	// Web
297	print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
298	print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
299
300	// Comment
301	print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
302	print '<td colspan="3">';
303    // Editor wysiwyg
304	require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
305	$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
306	$doleditor->Create();
307	print '</td></tr>';
308
309	// Sold
310	print '<tr><td colspan="4"><b>'.$langs->trans("InitialBankBalance").'...</b></td></tr>';
311
312	print '<tr><td valign="top">'.$langs->trans("InitialBankBalance").'</td>';
313	print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.($_POST["solde"]?$_POST["solde"]:price2num($account->solde)).'"></td></tr>';
314
315	print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
316	print '<td colspan="3">';
317	$form->select_date(time(), 're', 0, 0, 0, 'formsoc');
318	print '</td></tr>';
319
320	print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
321	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>';
322
323	print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
324	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>';
325
326	print '</table>';
327
328	print '<center><br><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></center>';
329
330	print '</form>';
331}
332/* ************************************************************************** */
333/*                                                                            */
334/* Visu et edition                                                            */
335/*                                                                            */
336/* ************************************************************************** */
337else
338{
339    if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
340	{
341		$account = new Account($db);
342		if ($_GET["id"])
343		{
344			$account->fetch($_GET["id"]);
345		}
346		if ($_GET["ref"])
347		{
348			$account->fetch(0,$_GET["ref"]);
349			$_GET["id"]=$account->id;
350		}
351
352		/*
353		* Affichage onglets
354		*/
355
356		// Onglets
357		$head=bank_prepare_head($account);
358		dol_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"),0,'account');
359
360		/*
361		* Confirmation to delete
362		*/
363		if ($action == 'delete')
364		{
365			$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
366			if ($ret == 'html') print '<br>';
367		}
368
369		print '<table class="border" width="100%">';
370
371		// Ref
372		print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
373		print '<td colspan="3">';
374		print $form->showrefnav($account,'ref','',1,'ref');
375		print '</td></tr>';
376
377		// Label
378		print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
379		print '<td colspan="3">'.$account->label.'</td></tr>';
380
381		// Type
382		print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
383		print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
384
385		// Currency
386		print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
387		print '<td colspan="3">';
388		$selectedcode=$account->account_currency_code;
389		if (! $selectedcode) $selectedcode=$conf->monnaie;
390		print $langs->trans("Currency".$selectedcode);
391		print '</td></tr>';
392
393		// Status
394		print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
395		print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
396
397		// Country
398		print '<tr><td>'.$langs->trans("Country").'</td><td>';
399		if ($account->fk_pays > 0)
400		{
401			$img=picto_from_langcode($account->pays_code);
402			print $img?$img.' ':'';
403			print getCountry($account->getCountryCode(),0,$db);
404		}
405		print '</td></tr>';
406
407		// State
408		print '<tr><td>'.$langs->trans('State').'</td><td>';
409		if ($account->fk_departement > 0) print getState($account->fk_departement);
410		print '</td></tr>';
411
412		// Conciliate
413		print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
414		print '<td colspan="3">';
415		$conciliate=$account->canBeConciliated();
416		if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
417        else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
418		else print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
419		print '</td></tr>';
420
421		// Accountancy code
422		print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
423		print '<td colspan="3">'.$account->account_number.'</td></tr>';
424
425		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
426		print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
427
428		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
429		print '<td colspan="3">'.$account->min_desired.'</td></tr>';
430
431		print '<tr><td valign="top">'.$langs->trans("Web").'</td><td colspan="3">';
432		if ($account->url) print '<a href="'.$account->url.'" target="_gobank">';
433		print $account->url;
434		if ($account->url) print '</a>';
435		print "</td></tr>\n";
436
437		print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
438		print '<td colspan="3">'.$account->comment.'</td></tr>';
439
440		print '</table>';
441
442		print '</div>';
443
444
445		/*
446		 * Barre d'actions
447		 */
448		print '<div class="tabsAction">';
449
450		if ($user->rights->banque->configurer)
451		{
452			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>';
453		}
454
455		$canbedeleted=$account->can_be_deleted();   // Renvoi vrai si compte sans mouvements
456		if ($user->rights->banque->configurer && $canbedeleted)
457		{
458			print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>';
459		}
460
461		print '</div>';
462
463	}
464
465    /* ************************************************************************** */
466    /*                                                                            */
467    /* Edition                                                                    */
468    /*                                                                            */
469    /* ************************************************************************** */
470
471    if (GETPOST("id") && $action == 'edit' && $user->rights->banque->configurer)
472    {
473        $account = new Account($db);
474        $account->fetch(GETPOST("id"));
475
476        print_fiche_titre($langs->trans("EditFinancialAccount"));
477        print "<br>";
478
479        if ($message) { print "$message<br>\n"; }
480
481        if ($conf->use_javascript_ajax)
482        {
483            print "\n".'<script type="text/javascript" language="javascript">';
484            print 'jQuery(document).ready(function () {
485                        jQuery("#selectaccount_country_id").change(function() {
486                            document.formsoc.action.value="edit";
487                            document.formsoc.submit();
488                        });
489                   })';
490            print '</script>'."\n";
491        }
492
493        print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post" name="formsoc">';
494        print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
495        print '<input type="hidden" name="action" value="update">';
496        print '<input type="hidden" name="id" value="'.$_REQUEST["id"].'">'."\n\n";
497
498        print '<table class="border" width="100%">';
499
500		// Ref
501		print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Ref").'</td>';
502		print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
503
504		// Label
505        print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Label").'</td>';
506        print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.(isset($_POST["label"])?$_POST["label"]:$account->label).'"></td></tr>';
507
508        // Type
509        print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
510        print '<td colspan="3">';
511		print $form->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type");
512        print '</td></tr>';
513
514		// Currency
515		print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Currency");
516		print '<input type="hidden" value="'.$account->currency_code.'">';
517		print '</td>';
518		print '<td colspan="3">';
519		$selectedcode=$account->account_currency_code;
520		if (! $selectedcode) $selectedcode=$conf->monnaie;
521		$form->select_currency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
522		//print $langs->trans("Currency".$conf->monnaie);
523		//print '<input type="hidden" name="account_currency_code" value="'.$conf->monnaie.'">';
524		print '</td></tr>';
525
526		// Status
527        print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Status").'</td>';
528        print '<td colspan="3">';
529        print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
530        print '</td></tr>';
531
532		// Country
533		$account->pays_id=$account->pays_id?$account->pays_id:$mysoc->pays_id;
534		print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
535		print '<td colspan="3">';
536		$selectedcode=$account->pays_code;
537		if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
538		else if (empty($selectedcode)) $selectedcode=$mysoc->pays_code;
539		$form->select_pays($selectedcode,'account_country_id');
540		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
541		print '</td></tr>';
542
543		// State
544		print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
545		if ($selectedcode)
546		{
547			$formcompany->select_departement(isset($_POST["account_departement_id"])?$_POST["account_departement_id"]:$account->fk_departement,$selectedcode,'account_departement_id');
548		}
549		else
550		{
551			print $countrynotdefined;
552		}
553		print '</td></tr>';
554
555		// Conciliable
556        print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
557        print '<td colspan="3">';
558        $conciliate=$account->canBeConciliated();
559        if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
560        else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
561        else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
562        print '</td></tr>';
563
564        // Accountancy code
565        if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)
566        {
567            print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountancyCode").'</td>';
568            print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
569        }
570        else
571        {
572            print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
573            print '<td colspan="3"><input type="text" name="account_number" value="'.(isset($_POST["account_number"])?$_POST["account_number"]:$account->account_number).'"></td></tr>';
574        }
575
576		// Balance
577		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
578		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>';
579
580		print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
581		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>';
582
583		// Web
584        print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
585        print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.(isset($_POST["url"])?$_POST["url"]:$account->url).'">';
586        print '</td></tr>';
587
588		// Comment
589		print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
590		print '<td colspan="3">';
591	   // Editor wysiwyg
592		require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
593		$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);
594		$doleditor->Create();
595		print '</td></tr>';
596
597        print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
598        print ' &nbsp; <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
599        print '</td></tr>';
600        print '</table>';
601
602        print '</form>';
603	}
604
605}
606
607
608
609$db->close();
610
611llxFooter();
612?>