On spare les caractrisitque de comptes financiers en 2 onglets. Un pour les carac gnrales et un pour les carac propres au pays.
This commit is contained in:
parent
58ae1770de
commit
f894bc0f3e
@ -59,6 +59,11 @@ class Account
|
||||
|
||||
var $account_number;
|
||||
|
||||
var $currency_code;
|
||||
var $min_allowed;
|
||||
var $min_desired;
|
||||
var $comment;
|
||||
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
@ -261,6 +266,10 @@ class Account
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Verification parametres
|
||||
if (! $this->min_allowed) $this->min_allowed=0;
|
||||
if (! $this->min_desired) $this->min_desired=0;
|
||||
|
||||
// Chargement librairie pour acces fonction controle RIB
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/bank.lib.php';
|
||||
|
||||
@ -275,7 +284,16 @@ class Account
|
||||
return -1;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account (datec, ref, label, account_number) values (now(),'" . addslashes($this->ref) . "', '" . addslashes($this->label) . "','" . addslashes($this->account_number) . "');";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_account (";
|
||||
$sql.= "datec, ref, label, account_number, currency_code,";
|
||||
$sql.= "min_allowed, min_desired,";
|
||||
$sql.= "comment";
|
||||
$sql.= ") values (";
|
||||
$sql.= "now(),'" . addslashes($this->ref) . "', '" . addslashes($this->label) . "',";
|
||||
$sql.= "'".addslashes($this->account_number) . "','".$this->currency_code."',";
|
||||
$sql.= "min_allowed=".price2num($this->min_allowed).",min_desired=".price2num($this->min_desired).",";
|
||||
$sql.= "comment='".addslashes($this->comment)."'";
|
||||
$sql.= ")";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -285,7 +303,7 @@ class Account
|
||||
if ( $this->update() )
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, label, amount, fk_account, datev, dateo, fk_type, rappro) ";
|
||||
$sql .= " VALUES (now(),'".$langs->trans("Balance")."','" . ereg_replace(',','.',$this->solde) . "','$this->id','".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);";
|
||||
$sql .= " VALUES (now(),'".$langs->trans("Balance")."','" . price2num($this->solde) . "','$this->id','".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);";
|
||||
$this->db->query($sql);
|
||||
}
|
||||
return $this->id;
|
||||
@ -293,23 +311,79 @@ class Account
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$this->error=$langs->trans("ErrorBankLabelAlreadyExists");
|
||||
dolibarr_syslog($this->error);
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->error()." sql=".$sql;
|
||||
dolibarr_syslog($this->error);
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Mise a jour compte
|
||||
* \brief Mise a jour compte, partie generale
|
||||
* \param user Object utilisateur qui modifie
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update($user='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
dolibarr_syslog("Account.class::update");
|
||||
|
||||
if (! $this->ref)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref"));
|
||||
return -1;
|
||||
}
|
||||
if (! $this->label) $this->label = "???";
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
|
||||
|
||||
$sql .= " ref = '".addslashes($this->ref)."'";
|
||||
$sql .= ",label = '".addslashes($this->label)."'";
|
||||
|
||||
$sql .= ",courant = ".$this->courant;
|
||||
$sql .= ",clos = ".$this->clos;
|
||||
$sql .= ",rappro = ".$this->rappro;
|
||||
$sql .= ",url = ".($this->url?"'".$this->url."'":"null");
|
||||
$sql .= ",account_number = '".$this->account_number."'";
|
||||
|
||||
$sql .= ",currency_code = '".$this->currency_code."'";
|
||||
|
||||
$sql .= ",min_allowed = '".price2num($this->min_allowed)."'";
|
||||
$sql .= ",min_desired = '".price2num($this->min_desired)."'";
|
||||
$sql .= ",comment = '".addslashes($this->comment)."'";
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("Account.class::update sql=$sql");
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db.' sql='.$sql;
|
||||
dolibarr_print_error($this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* \brief Mise a jour compte, partie RIB
|
||||
* \param user Object utilisateur qui modifie
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function update_rib($user='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -329,16 +403,9 @@ class Account
|
||||
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Ref"));
|
||||
return -1;
|
||||
}
|
||||
if (! $this->label) $this->label = "???";
|
||||
$this->account_number=trim($this->account_number);
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
|
||||
|
||||
$sql .= " bank = '".addslashes($this->bank)."'";
|
||||
$sql .= ",ref = '".addslashes($this->ref)."'";
|
||||
$sql .= ",label = '".addslashes($this->label)."'";
|
||||
|
||||
$sql .= ",code_banque='".$this->code_banque."'";
|
||||
$sql .= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql .= ",number='".$this->number."'";
|
||||
@ -348,27 +415,24 @@ class Account
|
||||
$sql .= ",domiciliation='".addslashes($this->domiciliation)."'";
|
||||
$sql .= ",proprio = '".addslashes($this->proprio)."'";
|
||||
$sql .= ",adresse_proprio = '".addslashes($this->adresse_proprio)."'";
|
||||
$sql .= ",courant = ".$this->courant;
|
||||
$sql .= ",clos = ".$this->clos;
|
||||
$sql .= ",rappro = ".$this->rappro;
|
||||
$sql .= ",url = ".($this->url?"'".$this->url."'":"null");
|
||||
$sql .= ",account_number = '".$this->account_number."'";
|
||||
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
dolibarr_syslog("Account.class::update_rib sql=$sql");
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($this->db);
|
||||
return 0;
|
||||
$this->error=$this->db.' sql='.$sql;
|
||||
dolibarr_print_error($this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* \brief Charge en memoire depuis la base le compte
|
||||
* \param id Id du compte à récupérer
|
||||
@ -379,7 +443,8 @@ class Account
|
||||
$sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,";
|
||||
$sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix,";
|
||||
$sql.= " domiciliation, proprio, adresse_proprio,";
|
||||
$sql.= " account_number";
|
||||
$sql.= " account_number, currency_code,";
|
||||
$sql.= " min_allowed, min_desired, comment";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
|
||||
@ -411,6 +476,11 @@ class Account
|
||||
$this->adresse_proprio = $obj->adresse_proprio;
|
||||
|
||||
$this->account_number = $obj->account_number;
|
||||
|
||||
$this->currency_code = $obj->currency_code;
|
||||
$this->min_allowed = $obj->min_allowed;
|
||||
$this->min_desired = $obj->min_desired;
|
||||
$this->comment = $obj->comment;
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
306
htdocs/compta/bank/bankid_fr.php
Normal file
306
htdocs/compta/bank/bankid_fr.php
Normal file
@ -0,0 +1,306 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/bank/bankid_fr.php
|
||||
\ingroup banque
|
||||
\brief Fiche création compte bancaire
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
|
||||
$langs->load("banks");
|
||||
|
||||
$user->getrights('banque');
|
||||
|
||||
if (!$user->admin && !$user->rights->banque)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
{
|
||||
// Modification
|
||||
$account = new Account($db, $_POST["id"]);
|
||||
$account->fetch($_POST["id"]);
|
||||
|
||||
$account->bank = trim($_POST["bank"]);
|
||||
$account->code_banque = trim($_POST["code_banque"]);
|
||||
$account->code_guichet = trim($_POST["code_guichet"]);
|
||||
$account->number = trim($_POST["number"]);
|
||||
$account->cle_rib = trim($_POST["cle_rib"]);
|
||||
$account->bic = trim($_POST["bic"]);
|
||||
$account->iban_prefix = trim($_POST["iban_prefix"]);
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->adresse_proprio = trim($_POST["adresse_proprio"]);
|
||||
|
||||
if ($account->id)
|
||||
{
|
||||
$result = $account->update_rib($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
{
|
||||
$message='<div class="error">'.$account->error().'</div>';
|
||||
$_GET["action"]='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
{
|
||||
// Modification
|
||||
$account = new Account($db, $_GET["id"]);
|
||||
$account->delete($_GET["id"]);
|
||||
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Affichage page en mode création */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["id"] && $_GET["action"] != 'edit')
|
||||
{
|
||||
$account = new Account($db, $_GET["id"]);
|
||||
$account->fetch($_GET["id"]);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = 'fiche.php?id='.$account->id;
|
||||
$head[$h][1] = $langs->trans("AccountCard");
|
||||
$head[$h][2] = 'bankname';
|
||||
$h++;
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
$head[$h][0] = 'bankid_fr.php?id='.$account->id;
|
||||
$head[$h][1] = $langs->trans("RIB");
|
||||
$head[$h][2] = 'bankid';
|
||||
$h++;
|
||||
}
|
||||
|
||||
dolibarr_fiche_head($head, 'bankid', $langs->trans("FinancialAccount"));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression
|
||||
*/
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">'.$account->ref.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$account->label.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
print '<tr><td>Code Banque</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>Code Guichet</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>Numéro</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>Clé RIB</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="3">'.$account->iban_prefix.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="3">'.$account->bic.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print nl2br($account->domiciliation);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
|
||||
print $account->proprio;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print nl2br($account->adresse_proprio);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Edit").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["id"] && $_GET["action"] == 'edit' && $user->rights->banque->configurer)
|
||||
{
|
||||
$account = new Account($db, $_GET["id"]);
|
||||
$account->fetch($_GET["id"]);
|
||||
|
||||
print_titre($langs->trans("EditFinancialAccount"));
|
||||
print "<br>";
|
||||
|
||||
if ($message) { print "$message<br>\n"; }
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">'.$account->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$account->label;
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">'.$account->type_lib[$account->type];
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$account->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
// If bank account
|
||||
print '<tr><td colspan="4"><b>'.$langs->trans("IfBankAccount").'...</b></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>Code Banque</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>Code Guichet</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<td>Numéro</td>';
|
||||
print '<td><input size="15" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<td>Clé RIB</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="3"><input size="24" type="text" class="flat" name="iban_prefix" value="'.$account->iban_prefix.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="3"><input size="24" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"adresse_proprio\" rows=\"2\" cols=\"40\">";
|
||||
print $account->adresse_proprio;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
}
|
||||
|
||||
print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
|
||||
print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@ -62,17 +62,25 @@ if ($_POST["action"] == 'add')
|
||||
$account->iban_prefix = $_POST["iban_prefix"];
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->adresse_proprio = trim($_POST["adresse_proprio"]);
|
||||
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
|
||||
$account->solde = $_POST["solde"];
|
||||
$account->date_solde = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||
$account->solde = $_POST["solde"];
|
||||
$account->date_solde = mktime(12,0,0,$_POST["remonth"],$_POST["reday"],$_POST["reyear"]);
|
||||
|
||||
$account->currency_code = trim($_POST["account_currency_code"]);
|
||||
|
||||
$account->min_allowed = $_POST["account_min_allowed"];
|
||||
$account->min_desired = $_POST["account_min_desired"];
|
||||
$account->comment = trim($_POST["account_comment"]);
|
||||
|
||||
if ($account->label) {
|
||||
if ($account->label)
|
||||
{
|
||||
$id = $account->create($user->id);
|
||||
if ($id > 0) {
|
||||
if ($id > 0)
|
||||
{
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
}
|
||||
else {
|
||||
@ -96,33 +104,39 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
$account->courant = $_POST["type"];
|
||||
$account->clos = $_POST["clos"];
|
||||
$account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"]=='on')?0:1;
|
||||
$account->url = $_POST["url"];
|
||||
$account->url = trim($_POST["url"]);
|
||||
|
||||
$account->bank = trim($_POST["bank"]);
|
||||
$account->code_banque = $_POST["code_banque"];
|
||||
$account->code_guichet = $_POST["code_guichet"];
|
||||
$account->number = $_POST["number"];
|
||||
$account->cle_rib = $_POST["cle_rib"];
|
||||
$account->bic = $_POST["bic"];
|
||||
$account->iban_prefix = $_POST["iban_prefix"];
|
||||
$account->domiciliation = $_POST["domiciliation"];
|
||||
$account->code_banque = trim($_POST["code_banque"]);
|
||||
$account->code_guichet = trim($_POST["code_guichet"]);
|
||||
$account->number = trim($_POST["number"]);
|
||||
$account->cle_rib = trim($_POST["cle_rib"]);
|
||||
$account->bic = trim($_POST["bic"]);
|
||||
$account->iban_prefix = trim($_POST["iban_prefix"]);
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
|
||||
$account->proprio = $_POST["proprio"];
|
||||
$account->adresse_proprio = $_POST["adresse_proprio"];
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->adresse_proprio = trim($_POST["adresse_proprio"]);
|
||||
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
|
||||
$account->currency_code = trim($_POST["account_currency_code"]);
|
||||
|
||||
$account->min_allowed = $_POST["account_min_allowed"];
|
||||
$account->min_desired = $_POST["account_min_desired"];
|
||||
$account->comment = trim($_POST["account_comment"]);
|
||||
|
||||
if ($account->label)
|
||||
{
|
||||
$result = $account->update($user);
|
||||
if (! $result)
|
||||
if ($result >= 0)
|
||||
{
|
||||
$message='<div class="error">'.$account->error().'</div>';
|
||||
$_GET["action"]='edit'; // Force chargement page edition
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
$message='<div class="error">'.$account->error().'</div>';
|
||||
$_GET["action"]='edit'; // Force chargement page edition
|
||||
}
|
||||
} else {
|
||||
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->trans("LabelBankCashAccount")).'</div>';
|
||||
@ -141,6 +155,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user-
|
||||
}
|
||||
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
@ -158,7 +173,7 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
if ($message) { print "$message<br>\n"; }
|
||||
|
||||
print '<form action="fiche.php" name="createbankaccount" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" name="createbankaccount" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="clos" value="0">';
|
||||
|
||||
@ -173,7 +188,6 @@ if ($_GET["action"] == 'create')
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$form=new Form($db);
|
||||
print $form->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type");
|
||||
print '</td></tr>';
|
||||
|
||||
@ -188,15 +202,43 @@ if ($_GET["action"] == 'create')
|
||||
print '<input type="hidden" name="account_number" value="'.$account->account_number.'">';
|
||||
}
|
||||
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
/*
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->monnaie;
|
||||
$form->select_currency($selectedcode, 'account_currency_code');
|
||||
*/
|
||||
print $langs->trans("Currency".$conf->monnaie);
|
||||
print '</td></tr>';
|
||||
|
||||
// Web
|
||||
print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
|
||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3"><textarea cols="70" class="flat" name="account_comment">'.$account->comment.'</textarea></td></tr>';
|
||||
|
||||
// Solde
|
||||
print '<tr><td colspan="4"><b>'.$langs->trans("InitialBankBalance").'...</b></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="0.00"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.price2num($account->solde).'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$html=new Form($db);
|
||||
$html->select_date(time(), 're', 0, 0, 0, 'createbankaccount');
|
||||
$form->select_date(time(), 're', 0, 0, 0, 'createbankaccount');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.$account->account_min_allowed.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.$account->account_min_desired.'"></td></tr>';
|
||||
|
||||
|
||||
// If bank account
|
||||
print '<tr><td colspan="4"><b>'.$langs->trans("IfBankAccount").'...</b></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Conciliation").'</td>';
|
||||
@ -228,9 +270,6 @@ if ($_GET["action"] == 'create')
|
||||
print "<textarea class=\"flat\" name=\"adresse_proprio\" rows=\"2\" cols=\"40\">".$_POST["adresse_proprio"];
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
|
||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$_POST["url"].'"></td></tr>';
|
||||
|
||||
print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("CreateAccount").'" type="submit" class="button"></td></tr>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
@ -250,27 +289,36 @@ else
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = "fiche.php?id=$account->id";
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = 'fiche.php?id='.$account->id;
|
||||
$head[$h][1] = $langs->trans("AccountCard");
|
||||
$head[$h][2] = 'bankname';
|
||||
$h++;
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
$head[$h][0] = 'bankid_fr.php?id='.$account->id;
|
||||
$head[$h][1] = $langs->trans("RIB");
|
||||
$head[$h][2] = 'bankid';
|
||||
$h++;
|
||||
}
|
||||
|
||||
dolibarr_fiche_head($head, $hselected, $langs->trans("FinancialAccount"));
|
||||
dolibarr_fiche_head($head, 'bankname', $langs->trans("FinancialAccount"));
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression
|
||||
*/
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$form->form_confirm($_SERVER["PHP_SELF"]."?id=$account->id",$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
|
||||
$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
|
||||
print '<br />';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">'.$account->ref.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
@ -294,41 +342,31 @@ else
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">'.$account->account_number.'</td></tr>';
|
||||
}
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
/*
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->monnaie;
|
||||
$form->select_currency($selectedcode, 'account_currency_code');
|
||||
*/
|
||||
print $langs->trans("Currency".$conf->monnaie);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Code Banque</td><td>Code Guichet</td><td>Numéro</td><td>Clé RIB</td></tr>';
|
||||
print '<tr><td>'.$account->code_banque.'</td>';
|
||||
print '<td>'.$account->code_guichet.'</td>';
|
||||
print '<td>'.$account->number.'</td>';
|
||||
print '<td>'.$account->cle_rib.'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
||||
print '<td colspan="3">'.$account->min_allowed.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="3">'.$account->iban_prefix.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="3">'.$account->bic.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print nl2br($account->domiciliation);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
|
||||
print $account->proprio;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print nl2br($account->adresse_proprio);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
|
||||
print '<td colspan="3">'.$account->min_desired.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Web").'</td><td colspan="3">';
|
||||
print '<a href="'.$account->url.'" target="_gobank">'.$account->url.'</a>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">'.$account->comment.'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
@ -342,13 +380,13 @@ else
|
||||
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?action=edit&id='.$account->id.'">'.$langs->trans("Edit").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Edit").'</a>';
|
||||
}
|
||||
|
||||
$canbedeleted=$account->can_be_deleted(); // Renvoi vrai si compte sans mouvements
|
||||
if ($user->rights->banque->configurer && $canbedeleted)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$account->id.'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -371,7 +409,7 @@ else
|
||||
|
||||
if ($message) { print "$message<br>\n"; }
|
||||
|
||||
print '<form action="fiche.php?id='.$account->id.'" method="post">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n";
|
||||
|
||||
@ -411,42 +449,32 @@ else
|
||||
print '<input type="hidden" name="account_number" value="'.$account->account_number.'">';
|
||||
}
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Bank").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Code Banque</td><td>Code Guichet</td><td>Numéro</td><td>Clé RIB</td></tr>';
|
||||
print '<tr><td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '<td><input size="15" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||
print '<td colspan="3"><input size="24" type="text" class="flat" name="iban_prefix" value="'.$account->iban_prefix.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||
print '<td colspan="3"><input size="24" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"adresse_proprio\" rows=\"2\" cols=\"40\">";
|
||||
print $account->adresse_proprio;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
|
||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$account->url.'">';
|
||||
print '</td></tr>';
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency");
|
||||
print '<input type="hidden" value="'.$account->currency_code.'">';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
/*
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->monnaie;
|
||||
$form->select_currency($selectedcode, 'account_currency_code');
|
||||
*/
|
||||
print $langs->trans("Currency".$conf->monnaie);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalAllowed").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.$account->min_allowed.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BalanceMinimalDesired").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.$account->min_desired.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Web").'</td>';
|
||||
print '<td colspan="3"><input size="50" type="text" class="flat" name="url" value="'.$account->url.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3"><textarea cols="70" class="flat" name="account_comment">'.$account->comment.'</textarea></td></tr>';
|
||||
|
||||
}
|
||||
|
||||
print '<tr><td align="center" colspan="4"><input value="'.$langs->trans("Modify").'" type="submit" class="button">';
|
||||
print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
|
||||
|
||||
@ -65,7 +65,7 @@ function llxHeader($head = "")
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/index.php",$langs->trans("Bank"));
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/index.php",$langs->trans("MenuBankCash"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/search.php",$langs->trans("SearchTransaction"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/budget.php",$langs->trans("ByCategories"));
|
||||
@ -78,7 +78,7 @@ function llxHeader($head = "")
|
||||
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/config.php",$langs->trans("Setup"));
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/config.php",$langs->trans("MenuSetupBank"));
|
||||
}
|
||||
|
||||
if ($conf->global->COMPTA_ONLINE_PAYMENT_BPLC)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user