Merge pull request #13021 from mapiolca/patch-29

Fix Compatbility with Multicompany
This commit is contained in:
Laurent Destailleur 2020-02-05 12:39:33 +01:00 committed by GitHub
commit af22eb92d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
* 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
@ -98,7 +99,8 @@ class box_project extends ModeleBoxes
$sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " WHERE p.fk_statut = 1"; // Only open projects
$sql.= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok
$sql.= " AND p.fk_statut = 1"; // Only open projects
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
$sql.= " ORDER BY p.datec DESC";