2
0
forked from Wavyzz/dolibarr

Added types constants to categories

This commit is contained in:
Raphaël Doursenaud
2015-05-23 18:52:31 +02:00
parent 995a2c127d
commit ee808cdfd7
27 changed files with 309 additions and 273 deletions

View File

@@ -1,13 +1,14 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* 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
@@ -83,8 +84,8 @@ function societe_prepare_head(Societe $object)
//show categorie tab
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
$type = 2;
if ($object->fournisseur) $type = 1;
$type = Categorie::TYPE_CUSTOMER;
if ($object->fournisseur) $type = Categorie::TYPE_SUPPLIER;
$head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?socid='.$object->id."&type=".$type;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';

View File

@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* 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
@@ -88,7 +89,7 @@ function contact_prepare_head(Contact $object)
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
$type = 4;
$type = Categorie::TYPE_CONTACT;
$head[$tab][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type;
$head[$tab][1] = $langs->trans('Categories');
$head[$tab][2] = 'category';

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* 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
@@ -70,7 +71,8 @@ function member_prepare_head(Adherent $object)
// Show category tab
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=3';
$type = Categorie::TYPE_MEMBER;
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;

View File

@@ -6,7 +6,7 @@
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
*
@@ -1099,7 +1099,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$categstatic=new Categorie($db);
// recovering the list of all the categories linked to product
$tblcateg=$categstatic->containing($idprod,0);
$tblcateg=$categstatic->containing($idprod, Categorie::TYPE_PRODUCT);
foreach ($tblcateg as $cate)
{
// Adding the descriptions if they are filled

View File

@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* 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
@@ -60,7 +61,8 @@ function product_prepare_head($object)
/* No more required. Replaced with new multiselect component
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=0';
$type = Categorie::TYPE_PRODUCT;
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type;
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;