diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 1dd26f9d1f6..99fef99475e 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * * 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 @@ -21,7 +21,8 @@ * */ -/*! \file htdocs/compta/facture/fiche-rec.php +/** + \file htdocs/compta/facture/fiche-rec.php \ingroup facture \brief Page d'affichage d'une facture récurrent \version $Revision$ @@ -30,53 +31,55 @@ require("./pre.inc.php"); require("./facture-rec.class.php"); +require("../../project.class.php"); $user->getrights('facture'); + if (!$user->rights->facture->lire) accessforbidden(); -require("../../project.class.php"); + llxHeader('','Facture récurrente','ch-facture.html#s-fac-facture-rec'); -/* - * Sécurité accés client - */ +// Sécurité accés client if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } + + /* - * + * Actions */ -if ($_POST["action"] == 'add') -{ - $facturerec = new FactureRec($db, $facid); - $facturerec->titre = $_POST["titre"]; - - if ($facturerec->create($user) > 0) +// Ajout +if ($_POST["action"] == 'add') +{ + $facturerec = new FactureRec($db, $_POST["facid"]); + $facturerec->titre = $_POST["titre"]; + + if ($facturerec->create($user) > 0) { - $facid = $facturerec->id; - $action = ''; + $facid = $facturerec->id; + $action = ''; } - else + else { - $action = "create"; + $action = "create"; } } -/* - * - */ -if ($action == 'delete' && $user->rights->facture->supprimer) +// Suppression +if ($_POST["action"] == 'delete' && $user->rights->facture->supprimer) { - $fac = new FactureRec($db); - $fac->delete($facid); - $facid = 0 ; + $fac = new FactureRec($db); + $fac->delete($_POST["facid"]); + $facid = 0 ; } + /* * */ @@ -87,8 +90,6 @@ $html = new Form($db); * * Mode creation * - * - * ************************************************************************/ if ($_GET["action"] == 'create') {