Fix: erreur à la suppression d'une catégorie

This commit is contained in:
Regis Houssin 2007-06-16 20:22:38 +00:00
parent ecffa15fa5
commit 24e8092e4b
2 changed files with 9 additions and 7 deletions

View File

@ -97,7 +97,7 @@ if($_POST['catname'] || $_REQUEST['id'])
{ {
$var = ! $var; $var = ! $var;
print "\t<tr ".$bc[$var].">\n"; print "\t<tr ".$bc[$var].">\n";
print "\t\t<td><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n"; print "\t\t<td><a href='viewcat.php?id=".$cat->id."&amp;type=".$type."'>".$cat->label."</a></td>\n";
print "\t\t<td>".$cat->description."</td>\n"; print "\t\t<td>".$cat->description."</td>\n";
print "\t</tr>\n"; print "\t</tr>\n";
} }
@ -170,7 +170,7 @@ if ($conf->use_javascript)
$newelement=array( $newelement=array(
'text' => $cate_arbo[$key]['label'], 'text' => $cate_arbo[$key]['label'],
//'link' => $_SERVER["PHP_SELF"].'?id='.$cate_arbo[$key]['id'], //'link' => $_SERVER["PHP_SELF"].'?id='.$cate_arbo[$key]['id'],
'link' => DOL_URL_ROOT.'/categories/viewcat.php?id='.$cate_arbo[$key]['id'], 'link' => DOL_URL_ROOT.'/categories/viewcat.php?id='.$cate_arbo[$key]['id'].'&amp;type='.$type,
'icon' => $icon, 'icon' => $icon,
'expandedIcon' => $expandedIcon 'expandedIcon' => $expandedIcon
); );
@ -240,7 +240,7 @@ else
{ {
$var = ! $var; $var = ! $var;
print "\t<tr ".$bc[$var].">\n"; print "\t<tr ".$bc[$var].">\n";
print '<td><a href="viewcat.php?id='.$cate_arbo[$key]['id'].'">'.$cate_arbo[$key]['fulllabel'].'</a></td>'; print '<td><a href="viewcat.php?id='.$cate_arbo[$key]['id'].'&amp;type='.$type.'">'.$cate_arbo[$key]['fulllabel'].'</a></td>';
print '<td>'.$c->get_desc($cate_arbo[$key]['id']).'</td>'; print '<td>'.$c->get_desc($cate_arbo[$key]['id']).'</td>';
print "\t</tr>\n"; print "\t</tr>\n";
} }

View File

@ -33,6 +33,8 @@ if ($_REQUEST['id'] == "")
exit(); exit();
} }
$type=$_GET['type'];
// Securite // Securite
$user->getrights('categorie'); $user->getrights('categorie');
if (! $user->rights->categorie->lire) if (! $user->rights->categorie->lire)
@ -78,7 +80,7 @@ if ($mesg) print $mesg.'<br>';
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$c->id; $head[$h][0] = DOL_URL_ROOT.'/categories/viewcat.php?id='.$c->id.'&amp;type='.$type;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
@ -91,7 +93,7 @@ dolibarr_fiche_head($head, 'card', $langs->trans("Category"));
*/ */
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete'); $html->form_confirm($_SERVER["PHP_SELF"].'?id='.$c->id.'&amp;type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
print '<br />'; print '<br />';
} }
@ -134,7 +136,7 @@ if ($user->rights->categorie->creer)
if ($user->rights->categorie->supprimer) if ($user->rights->categorie->supprimer)
{ {
print "<a class='butActionDelete' href='".DOL_URL_ROOT."/categories/viewcat.php?action=delete&amp;id=".$c->id."'>".$langs->trans("Delete")."</a>"; print "<a class='butActionDelete' href='".DOL_URL_ROOT."/categories/viewcat.php?action=delete&amp;id=".$c->id."&amp;type=".$type."'>".$langs->trans("Delete")."</a>";
} }
print "</div>"; print "</div>";
@ -161,7 +163,7 @@ else
$i++; $i++;
$var=!$var; $var=!$var;
print "\t<tr ".$bc[$var].">\n"; print "\t<tr ".$bc[$var].">\n";
print "\t\t<td nowrap=\"nowrap\"><a href='viewcat.php?id=".$cat->id."'>".$cat->label."</a></td>\n"; print "\t\t<td nowrap=\"nowrap\"><a href='viewcat.php?id=".$cat->id."&amp;type=".$type."'>".$cat->label."</a></td>\n";
print "\t\t<td>".$cat->description."</td>\n"; print "\t\t<td>".$cat->description."</td>\n";
if ($cat->visible == 1) if ($cat->visible == 1)