Ajout confirmation suppression categorie
This commit is contained in:
parent
93b5d4602f
commit
7a1b1f30ac
@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
|
||||||
*
|
|
||||||
* 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$
|
|
||||||
*/
|
|
||||||
|
|
||||||
require "./pre.inc.php";
|
|
||||||
|
|
||||||
if (!$user->rights->categorie->supprimer) accessforbidden();
|
|
||||||
|
|
||||||
|
|
||||||
llxHeader("","",$langs->trans("Categories"));
|
|
||||||
|
|
||||||
print_titre($langs->trans("CategoriesArea"));
|
|
||||||
|
|
||||||
print '<table border="0" width="100%">';
|
|
||||||
|
|
||||||
print '<tr><td valign="top" width="30%">';
|
|
||||||
|
|
||||||
|
|
||||||
$cat = new Categorie ($db, $_REQUEST['id']);
|
|
||||||
|
|
||||||
if (!isset ($_REQUEST['valid']))
|
|
||||||
{
|
|
||||||
print "<p>Veuillez valider la suppression de la catégorie ".$cat->label." : <a href='".$_SERVER['PHP_SELF']."?id=".$cat->id."&valid=true'>supprimer la catégorie ".$cat->label."</a></p>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($cat->remove () < 0)
|
|
||||||
{
|
|
||||||
print "<p>Impossible de supprimer la catégorie ".$cat->label.".</p>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "<p>La catégorie ".$cat->label." a été supprimée.</p>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</td></tr></table>';
|
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
|
||||||
?>
|
|
||||||
@ -26,17 +26,41 @@
|
|||||||
|
|
||||||
require "./pre.inc.php";
|
require "./pre.inc.php";
|
||||||
|
|
||||||
$user->getrights('categorie');
|
if ($_REQUEST['id'] == "")
|
||||||
|
{
|
||||||
|
dolibarr_print_error('','Missing parameter id');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Securite
|
||||||
|
$user->getrights('categorie');
|
||||||
if (! $user->rights->categorie->lire)
|
if (! $user->rights->categorie->lire)
|
||||||
{
|
{
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['id'] == "")
|
$mesg='';
|
||||||
|
|
||||||
|
$c = new Categorie($db);
|
||||||
|
$c->fetch($_REQUEST['id']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($user->rights->categorie->supprimer && $_POST["action"] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
dolibarr_print_error('','Missing parameter id');
|
if ($c->remove() >= 0)
|
||||||
exit();
|
{
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/categories/index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$c->error.'</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -45,8 +69,10 @@ if ($_REQUEST['id'] == "")
|
|||||||
* Affichage fiche categorie
|
* Affichage fiche categorie
|
||||||
*/
|
*/
|
||||||
llxHeader ("","",$langs->trans("Categories"));
|
llxHeader ("","",$langs->trans("Categories"));
|
||||||
|
$html=new Form($db);
|
||||||
|
|
||||||
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
$c = new Categorie ($db, $_REQUEST['id']);
|
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head = array();
|
$head = array();
|
||||||
@ -59,6 +85,15 @@ $h++;
|
|||||||
dolibarr_fiche_head($head, 'card', $langs->trans("Category"));
|
dolibarr_fiche_head($head, 'card', $langs->trans("Category"));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Confirmation suppression
|
||||||
|
*/
|
||||||
|
if ($_GET['action'] == 'delete' && $resteapayer <= 0)
|
||||||
|
{
|
||||||
|
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
||||||
|
print '<br />';
|
||||||
|
}
|
||||||
|
|
||||||
print '<table border="0" width="100%" class="border">';
|
print '<table border="0" width="100%" class="border">';
|
||||||
|
|
||||||
print '<tr><td width="20%" class="notopnoleft">';
|
print '<tr><td width="20%" class="notopnoleft">';
|
||||||
@ -98,7 +133,7 @@ if ($user->rights->categorie->creer)
|
|||||||
|
|
||||||
if ($user->rights->categorie->supprimer)
|
if ($user->rights->categorie->supprimer)
|
||||||
{
|
{
|
||||||
print "<a class='butActionDelete' href='delete.php?id=".$c->id."'>".$langs->trans("Delete")."</a>";
|
print "<a class='butActionDelete' href='".DOL_URL_ROOT."/categories/viewcat.php?action=delete&id=".$c->id."'>".$langs->trans("Delete")."</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user