* Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2008 Laurent Destailleur * Copytight (C) 2005-2009 Regis Houssin * * 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. */ /** * \file htdocs/compta/bank/bankid_fr.php * \ingroup banque * \brief Fiche creation compte bancaire * \version $Id$ */ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php"); $langs->load("banks"); // Security check if (isset($_GET["id"]) || isset($_GET["ref"])) { $id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:''); } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); /* * 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 = trim($_POST["iban_prefix"]); $account->iban_prefix = trim($_POST["iban_prefix"]); // deprecated $account->domiciliation = trim($_POST["domiciliation"]); $account->proprio = trim($_POST["proprio"]); $account->adresse_proprio = trim($_POST["adresse_proprio"]); if ($account->id) { $result = $account->update_bban($user); if ($result >= 0) { $_GET["id"]=$_POST["id"]; // Force chargement page en mode visu } else { $message='
'.$account->error().'
'; $_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; } /* * View */ llxHeader(); $form = new Form($db); /* ************************************************************************** */ /* */ /* Affichage page en mode creation */ /* */ /* ************************************************************************** */ if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit') { $account = new Account($db); if ($_GET["id"]) { $result=$account->fetch($_GET["id"]); } if ($_GET["ref"]) { $result=$account->fetch(0,$_GET["ref"]); $_GET["id"]=$account->id; } /* * Affichage onglets */ // Onglets $head=bank_prepare_head($account); dol_fiche_head($head, 'bankid', $langs->trans("FinancialAccount"),0,'account'); /* * Confirmation de la suppression */ if ($_GET["action"] == 'delete') { $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete"); if ($ret == 'html') print '
'; } // Check BBAN if (! checkBanForAccount($account)) { print '
'.$langs->trans("RIBControlError").'

'; } print ''; // Ref print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if ($account->type == 0 || $account->type == 1) { print ''; print ''; if ($account->useDetailedBBAN()) { print ''; print ''; print ''; print ''; print ''; print ''; } print ''; print ''; print ''; if ($account->useDetailedBBAN()) { print ''; print ''; print ''; } print ''; print ''; print ''; print ''; print '\n"; print '\n"; print '\n"; } print '
'.$langs->trans("Ref").''; print $form->showrefnav($account,'ref','',1,'ref'); print '
'.$langs->trans("Label").''.$account->label.'
'.$langs->trans("AccountType").''.$account->type_lib[$account->type].'
'.$langs->trans("Status").''.$account->getLibStatut(4).'
'.$langs->trans("BankName").''.$account->bank.'
'.$langs->trans("BankCode").''.$account->code_banque.'
'.$langs->trans("DeskCode").''.$account->code_guichet.'
'.$langs->trans("BankAccountNumber").''.$account->number.'
'.$langs->trans("BankAccountNumberKey").''.$account->cle_rib.'
'.$langs->trans("IBAN").''.$account->iban_prefix.'
'.$langs->trans("BIC").''.$account->bic.'
'.$langs->trans("BankAccountDomiciliation").''; print nl2br($account->domiciliation); print "
'.$langs->trans("BankAccountOwner").''; print $account->proprio; print "
'.$langs->trans("BankAccountOwnerAddress").''; print nl2br($account->adresse_proprio); print "
'; print "\n\n"; /* * Barre d'actions * */ print '
'; if ($user->rights->banque->configurer) { print 'id.'">'.$langs->trans("Modify").''; } print '
'; } /* ************************************************************************** */ /* */ /* 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 "
"; if ($message) { print "$message
\n"; } print '
'; print ''; print ''; print ''."\n\n"; print ''; // Ref print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if ($account->type == 0 || $account->type == 1) { // If bank account print ''; print ''; print ''; // BBAN if ($account->useDetailedBBAN()) { print ''; print ''; print ''; print ''; print ''; print ''; } print ''; print ''; print ''; if ($account->useDetailedBBAN()) { print ''; print ''; print ''; } // IBAN print ''; print ''; print ''; print ''; print '"; print ''; print ''; print '"; } print ''; print '
'.$langs->trans("Ref").''.$account->ref; print '
'.$langs->trans("Label").''.$account->label; print '
'.$langs->trans("AccountType").''.$account->type_lib[$account->type]; print '
'.$langs->trans("Status").''.$account->getLibStatut(4); print '
'.$langs->trans("Bank").'
'.$langs->trans("BankCode").'
'.$langs->trans("DeskCode").'
'.$langs->trans("BankAccountNumber").'
'.$langs->trans("BankAccountNumberKey").'
'.$langs->trans("IBAN").'
'.$langs->trans("BIC").'
'.$langs->trans("BankAccountDomiciliation").''; print "
'.$langs->trans("BankAccountOwner").''; print '
'.$langs->trans("BankAccountOwnerAddress").''; print "
'; print '   '; print '
'; print '
'; } $db->close(); llxFooter('$Date$ - $Revision$'); ?>