Fix: Corrige creation categorie
This commit is contained in:
parent
77b72f3521
commit
c3c507a122
@ -49,7 +49,7 @@ else
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Sécurité d'accès client et commerciaux
|
||||
// S<EFBFBD>curit<EFBFBD> d'acc<63>s client et commerciaux
|
||||
$objectid = restrictedArea($user, $type, $objectid);
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ $objectid = restrictedArea($user, $type, $objectid);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
//Suppression d'un objet d'une catégorie
|
||||
//Suppression d'un objet d'une cat<EFBFBD>gorie
|
||||
if ($_REQUEST["removecat"])
|
||||
{
|
||||
if ($_REQUEST["socid"] && $user->rights->societe->creer)
|
||||
@ -77,7 +77,7 @@ if ($_REQUEST["removecat"])
|
||||
$result=$cat->del_type($object,$type);
|
||||
}
|
||||
|
||||
//Ajoute d'un objet dans une catégorie
|
||||
//Ajoute d'un objet dans une cat<EFBFBD>gorie
|
||||
if (isset($_REQUEST["catMere"]) && $_REQUEST["catMere"]>=0)
|
||||
{
|
||||
if ($_REQUEST["socid"] && $user->rights->societe->creer)
|
||||
@ -172,7 +172,7 @@ if ($_GET["socid"])
|
||||
|
||||
print '<tr><td>'.$langs->trans("Web")."</td><td colspan=\"3\"><a href=\"http://$soc->url\" target=\"_blank\">".$soc->url."</a> </td></tr>";
|
||||
|
||||
// Assujeti à TVA ou pas
|
||||
// Assujeti <EFBFBD> TVA ou pas
|
||||
print '<tr>';
|
||||
print '<td nowrap="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
|
||||
print yn($soc->tva_assuj);
|
||||
@ -316,8 +316,11 @@ function formCategory($db,$object,$type,$typeid)
|
||||
|
||||
// Lien supprimer
|
||||
print '<td align="right">';
|
||||
$module = ($type=='fournisseur'?'societe':$type);
|
||||
if ($user->rights->$module->creer)
|
||||
$permission=0;
|
||||
if ($type == 'fournisseur') $permission=$user->rights->societe->creer;
|
||||
if ($type == 'societe') $permission=$user->rights->societe->creer;
|
||||
if ($type == 'product') $permission=$user->rights->produit->creer;
|
||||
if ($permission)
|
||||
{
|
||||
print "<a href= '".DOL_URL_ROOT."/categories/categorie.php?".$nameId."=".$object->id."&typeid=".$typeid."&removecat=".$cat->id."'>";
|
||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
|
||||
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
@ -37,15 +37,15 @@ if (isset ($_REQUEST['choix']))
|
||||
$nbcats = $_REQUEST['choix'];
|
||||
}
|
||||
else
|
||||
{ // par défault, une nouvelle catégorie sera dans une seule catégorie mère
|
||||
{ // par d<EFBFBD>fault, une nouvelle cat<61>gorie sera dans une seule cat<61>gorie m<>re
|
||||
$nbcats = 1;
|
||||
}
|
||||
|
||||
if ($_REQUEST['origin'])
|
||||
{
|
||||
if($_GET['type'] == 0)$idProdOrigin = $_REQUEST['origin'];
|
||||
if($_GET['type'] == 1)$idSupplierOrigin = $_REQUEST['origin'];
|
||||
if($_GET['type'] == 2)$idCompanyOrigin = $_REQUEST['origin'];
|
||||
if ($_GET['type'] == 0) $idProdOrigin = $_REQUEST['origin'];
|
||||
if ($_GET['type'] == 1) $idSupplierOrigin = $_REQUEST['origin'];
|
||||
if ($_GET['type'] == 2) $idCompanyOrigin = $_REQUEST['origin'];
|
||||
|
||||
}
|
||||
|
||||
@ -56,17 +56,22 @@ if ($_REQUEST['origin'])
|
||||
|
||||
if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
{
|
||||
// Action ajout d'une catégorie
|
||||
// Action ajout d'une cat<EFBFBD>gorie
|
||||
if ($_POST["cancel"])
|
||||
{
|
||||
if ($idProdOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin);
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&type='.$_GET["type"]);
|
||||
exit;
|
||||
}
|
||||
if ($idSupplierOrigin || $idCompanyOrigin)
|
||||
if ($idCompanyOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin);
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin.'&type='.$_GET["type"]);
|
||||
exit;
|
||||
}
|
||||
if ($idSupplierOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&type='.$_GET["type"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -104,7 +109,7 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
|
||||
if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
{
|
||||
// Action confirmation de création de la catégorie
|
||||
// Action confirmation de creation categorie
|
||||
if ($_GET["action"] == 'confirmed')
|
||||
{
|
||||
if ($idProdOrigin)
|
||||
@ -112,16 +117,19 @@ if ($_POST["action"] == 'add' && $user->rights->categorie->creer)
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?id='.$idProdOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else if ($idSupplierOrigin || $idCompanyOrigin)
|
||||
if ($idCompanyOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idCompanyOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
if ($idSupplierOrigin)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$result.'&type='.$_POST["type"]);
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/categorie.php?socid='.$idSupplierOrigin.'&mesg='.urlencode($langs->trans("CatCreated")));
|
||||
exit;
|
||||
}
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$result.'&type='.$_POST["type"]);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,7 +141,7 @@ $html = new Form($db);
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
/*
|
||||
* Fiche en mode création
|
||||
* Fiche en mode creation
|
||||
*/
|
||||
if ($_GET["action"] == 'create' || $_POST["addcat"] == 'addcat')
|
||||
{
|
||||
@ -146,10 +154,12 @@ if ($user->rights->categorie->creer)
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?type='.$_GET['type'].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="addcat" value="addcat">';
|
||||
print '<input type="hidden" name="type" value='.$_GET['type'].'>';
|
||||
//print '<input type="hidden" name="id" value="'.$_GET['id'].'">'; Mis dans origin
|
||||
//print '<input type="hidden" name="socid" value="'.$_GET['socid'].'">'; Mis dans origin
|
||||
print '<input type="hidden" name="type" value="'.$_GET['type'].'">';
|
||||
if ($_REQUEST['origin'])
|
||||
{
|
||||
print '<input type="hidden" name="origin" value='.$_REQUEST['origin'].'>';
|
||||
print '<input type="hidden" name="origin" value="'.$_REQUEST['origin'].'">';
|
||||
}
|
||||
print '<input type="hidden" name="nom" value="'.$nom.'">';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user