New: works on sharings between entities
Fix: we check if all dependencies are ok
This commit is contained in:
parent
15fe7b5bd8
commit
2bea3ee5cc
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 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
|
||||||
@ -290,6 +290,17 @@ if ($resql)
|
|||||||
dol_include_once($sourcefile);
|
dol_include_once($sourcefile);
|
||||||
$box=new $boxname($db,$obj->note);
|
$box=new $boxname($db,$obj->note);
|
||||||
|
|
||||||
|
$enabled=true;
|
||||||
|
if ($box->depends && sizeof($box->depends) > 0)
|
||||||
|
{
|
||||||
|
foreach($box->depends as $module)
|
||||||
|
{
|
||||||
|
if (empty($conf->$module->enabled)) $enabled=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($enabled)
|
||||||
|
{
|
||||||
//if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
//if (in_array($obj->rowid, $actives) && $box->box_multiple <> 1)
|
||||||
if (in_array($obj->rowid, $actives))
|
if (in_array($obj->rowid, $actives))
|
||||||
{
|
{
|
||||||
@ -326,6 +337,8 @@ if ($resql)
|
|||||||
|
|
||||||
print '</tr></form>';
|
print '</tr></form>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class box_contracts extends ModeleBoxes {
|
|||||||
var $boxcode="lastcontracts";
|
var $boxcode="lastcontracts";
|
||||||
var $boximg="object_contract";
|
var $boximg="object_contract";
|
||||||
var $boxlabel;
|
var $boxlabel;
|
||||||
var $depends = array("contrat"); // conf->propal->enabled
|
var $depends = array("contrat"); // conf->contrat->enabled
|
||||||
|
|
||||||
var $db;
|
var $db;
|
||||||
var $param;
|
var $param;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 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
|
||||||
@ -73,7 +73,7 @@ class box_produits extends ModeleBoxes {
|
|||||||
{
|
{
|
||||||
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy";
|
$sql = "SELECT p.rowid, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||||
$sql.= " WHERE p.entity = ".$conf->entity;
|
$sql.= ' WHERE p.entity IN (0,'.(! empty($conf->entities['product']) ? $conf->entities['product'] : $conf->entity).')';
|
||||||
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 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
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2007 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -2746,7 +2746,7 @@ class Product extends CommonObject
|
|||||||
$sql.= " WHERE p.fk_product_type <> 1";
|
$sql.= " WHERE p.fk_product_type <> 1";
|
||||||
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
if (!$user->rights->produit->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 0)';
|
||||||
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
if (!$user->rights->service->hidden) $sql.=' AND (p.hidden=0 OR p.fk_product_type != 1)';
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= ' AND p.entity IN (0,'.(! empty($conf->entities['product']) ? $conf->entities['product'] : $conf->entity).')';
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user