Fix: missing type of category
This commit is contained in:
parent
dea518875d
commit
82cff13b66
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -38,6 +38,8 @@ $ref = GETPOST('ref');
|
|||||||
$type = GETPOST('type');
|
$type = GETPOST('type');
|
||||||
$mesg = GETPOST('mesg');
|
$mesg = GETPOST('mesg');
|
||||||
|
|
||||||
|
$removecat = GETPOST('removecat','int');
|
||||||
|
|
||||||
$dbtablename = '';
|
$dbtablename = '';
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +89,7 @@ $result = restrictedArea($user,$objecttype,$objectid,$dbtablename,'','',$fieldid
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Suppression d'un objet d'une categorie
|
//Suppression d'un objet d'une categorie
|
||||||
if ($_REQUEST["removecat"])
|
if ($removecat > 0)
|
||||||
{
|
{
|
||||||
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
@ -113,7 +115,7 @@ if ($_REQUEST["removecat"])
|
|||||||
$result = $object->fetch($objectid);
|
$result = $object->fetch($objectid);
|
||||||
}
|
}
|
||||||
$cat = new Categorie($db);
|
$cat = new Categorie($db);
|
||||||
$result=$cat->fetch($_REQUEST["removecat"]);
|
$result=$cat->fetch($removecat);
|
||||||
|
|
||||||
$result=$cat->del_type($object,$elementtype);
|
$result=$cat->del_type($object,$elementtype);
|
||||||
}
|
}
|
||||||
@ -270,11 +272,11 @@ if ($socid)
|
|||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
if ($soc->client) formCategory($db,$soc,2);
|
if ($soc->client) formCategory($db,$soc,2,$socid);
|
||||||
|
|
||||||
if ($soc->client && $soc->fournisseur) print '<br><br>';
|
if ($soc->client && $soc->fournisseur) print '<br><br>';
|
||||||
|
|
||||||
if ($soc->fournisseur) formCategory($db,$soc,1);
|
if ($soc->fournisseur) formCategory($db,$soc,1,$socid);
|
||||||
}
|
}
|
||||||
else if ($id || $ref)
|
else if ($id || $ref)
|
||||||
{
|
{
|
||||||
@ -424,7 +426,7 @@ else if ($id || $ref)
|
|||||||
* @param int $typeid Type of category (0, 1, 2, 3)
|
* @param int $typeid Type of category (0, 1, 2, 3)
|
||||||
* @return int 0
|
* @return int 0
|
||||||
*/
|
*/
|
||||||
function formCategory($db,$object,$typeid)
|
function formCategory($db,$object,$typeid,$socid=0)
|
||||||
{
|
{
|
||||||
global $user,$langs,$form,$bc;
|
global $user,$langs,$form,$bc;
|
||||||
|
|
||||||
@ -499,7 +501,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
if ($typeid == 3) $permission=$user->rights->adherent->creer;
|
||||||
if ($permission)
|
if ($permission)
|
||||||
{
|
{
|
||||||
print "<a href= '".DOL_URL_ROOT."/categories/categorie.php?".(empty($_REQUEST["socid"])?'id':'socid')."=".$object->id.(empty($_REQUEST["socid"])?"&type=".$typeid."&typeid=".$typeid:'')."&removecat=".$cat->id."'>";
|
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$typeid."&removecat=".$cat->id."'>";
|
||||||
print img_delete($langs->trans("DeleteFromCat")).' ';
|
print img_delete($langs->trans("DeleteFromCat")).' ';
|
||||||
print $langs->trans("DeleteFromCat")."</a>";
|
print $langs->trans("DeleteFromCat")."</a>";
|
||||||
}
|
}
|
||||||
@ -530,7 +532,7 @@ function formCategory($db,$object,$typeid)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
?>
|
$db->close();
|
||||||
|
?>
|
||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,12 +29,13 @@ require("../main.inc.php");
|
|||||||
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/categories/class/categorie.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/treeview.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/lib/treeview.lib.php");
|
||||||
|
|
||||||
$type=(GETPOST('type') ? GETPOST('type') : 0);
|
|
||||||
|
|
||||||
if (!$user->rights->categorie->lire) accessforbidden();
|
|
||||||
|
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
|
if (! $user->rights->categorie->lire) accessforbidden();
|
||||||
|
|
||||||
|
$id=GETPOST('id','int');
|
||||||
|
$type=(GETPOST('type') ? GETPOST('type') : 0);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -88,9 +89,9 @@ print '</td><td valign="top" width="70%">';
|
|||||||
/*
|
/*
|
||||||
* Categories found
|
* Categories found
|
||||||
*/
|
*/
|
||||||
if($_POST['catname'] || $_REQUEST['id'])
|
if($_POST['catname'] || $id > 0)
|
||||||
{
|
{
|
||||||
$cats = $categstatic->rechercher($_REQUEST['id'],$_POST['catname'],$_POST['type']);
|
$cats = $categstatic->rechercher($id,$_POST['catname'],$type);
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
|
||||||
@ -309,7 +310,7 @@ if ($nbofentries == 0)
|
|||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user