dolibarr/htdocs/compta/param/comptes/fiche.php

104 lines
2.7 KiB
PHP
Raw Normal View History

2004-12-01 15:54:23 +01:00
<?php
2005-04-04 12:21:52 +02:00
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2005-10-19 07:12:45 +02:00
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
2004-12-01 15:54:23 +01:00
*
* 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
2011-08-01 00:21:57 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2004-12-01 15:54:23 +01:00
*
*/
2005-04-04 12:21:52 +02:00
2005-10-19 07:12:45 +02:00
/**
* \file htdocs/compta/param/comptes/fiche.php
* \ingroup compta
* \brief Page de la fiche des comptes comptables
*/
2004-12-01 15:54:23 +01:00
2010-03-27 03:35:08 +01:00
require("../../../main.inc.php");
2004-12-01 15:54:23 +01:00
$mesg = '';
2005-04-04 12:21:52 +02:00
if ($_POST["action"] == 'add' && $user->rights->compta->ventilation->parametrer)
2004-12-01 15:54:23 +01:00
{
$compte = new ComptaCompte($db);
$compte->numero = $_POST["numero"];
$compte->intitule = $_POST["intitule"];
$e_compte = $compte;
$res = $compte->create($user);
if ($res == 0)
{
Header("Location: liste.php");
}
else
{
if ($res == -3)
{
$_error = 1;
$_GET["action"] = "create";
$_GET["type"] = $_POST["type"];
}
if ($res == -4)
{
$_error = 2;
$_GET["action"] = "create";
$_GET["type"] = $_POST["type"];
}
}
}
2005-10-19 07:12:45 +02:00
llxHeader("","Nouveau compte");
2004-12-01 15:54:23 +01:00
/*
* Creation d'un compte
2004-12-01 15:54:23 +01:00
*
*/
2005-04-04 12:21:52 +02:00
if ($_GET["action"] == 'create' && $user->rights->compta->ventilation->parametrer)
2004-12-01 15:54:23 +01:00
{
2005-10-19 07:12:45 +02:00
$html = new Form($db);
$nbligne=0;
print_fiche_titre($langs->trans("NewAccount"));
print '<form action="fiche.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
2005-10-19 07:12:45 +02:00
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$_GET["type"].'">'."\n";
print '<table class="border" width="100%">';
print '<tr>';
print '<td>'.$langs->trans("AccountNumber").'</td><td><input name="numero" size="20" value="'.$compte->numero.'">';
if ($_error == 1)
2004-12-01 15:54:23 +01:00
{
print "Ce numéro de compte existe déjà";
2004-12-01 15:54:23 +01:00
}
2005-10-19 07:12:45 +02:00
if ($_error == 2)
2004-12-01 15:54:23 +01:00
{
2005-10-19 07:12:45 +02:00
print "Valeur(s) manquante(s)";
2004-12-01 15:54:23 +01:00
}
2005-10-19 07:12:45 +02:00
print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="intitule" size="40" value="'.$compte->intitule.'"></td></tr>';
2004-12-01 15:54:23 +01:00
2005-10-19 07:12:45 +02:00
print '<tr><td>&nbsp;</td><td><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
print '</table>';
print '</form>';
2004-12-01 15:54:23 +01:00
}
$db->close();
llxFooter();
2004-12-01 15:54:23 +01:00
?>