Fix: Removed not translated combo box.

This commit is contained in:
Laurent Destailleur 2010-06-24 21:10:43 +00:00
parent 018e0cceb2
commit 3e767382e8
6 changed files with 43 additions and 20 deletions

View File

@ -79,6 +79,7 @@ ShowMyTasksOnly=View only tasks i am affected to
TaskRessourceLinks=Ressources
ProjectsDedicatedToThisThirdParty=Projects dedicated to this third party
NoTasks=No tasks for this project
LinkedToAnotherCompany=Linked to other third party
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Project leader
TypeContact_project_external_PROJECTLEADER=Project leader

View File

@ -79,6 +79,7 @@ ShowMyTasksOnly=Ne voir que les tâches qui me sont affectées
TaskRessourceLinks=Affectation ressources
ProjectsDedicatedToThisThirdParty=Projets dédiés à ce tiers
NoTasks=Aucune tâche pour ce projet
LinkedToAnotherCompany=Liés à autre société
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Chef de projet
TypeContact_project_external_PROJECTLEADER=Chef de projet

View File

@ -190,9 +190,11 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid')
$sql.= " WHERE p.entity = ".$conf->entity;
if ($projectsListId) $sql.= " AND p.rowid in (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc='0' OR p.fk_soc IS NULL)";
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc='0' OR p.fk_soc IS NULL)"; // We will filter later
$sql.= " ORDER BY p.title ASC";
//print $sql;
//var_dump($user->rights);
dol_syslog("project.lib::select_projects sql=".$sql);
$resql=$db->query($sql);
if ($resql)
@ -206,24 +208,40 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid')
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$labeltoshow=dol_trunc($obj->ref,12).' - '.dol_trunc($obj->title,12);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && ! $user->rights->societe->lire)
{
print '<option value="'.$obj->rowid.'" selected="true">'.$labeltoshow.'</option>';
// Do nothing
}
else
{
print '<option value="'.$obj->rowid.'"';
if (! $obj->fk_statut > 0)
{
print ' disabled="true"';
$labeltoshow.=' - '.$langs->trans("Draft");
}
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
$labeltoshow=dol_trunc($obj->ref,16);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("SharedProject").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
print '>'.$labeltoshow.'</option>';
if (!empty($selected) && $selected == $obj->rowid && $obj->fk_statut > 0)
{
print '<option value="'.$obj->rowid.'" selected="true">'.$labeltoshow.'</option>';
}
else
{
$disabled=0;
print '<option value="'.$obj->rowid.'"';
if (! $obj->fk_statut > 0)
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("Draft");
}
if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
{
$disabled=1;
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
}
if ($disabled==1) print ' disabled="true"';
else $labeltoshow.=' - '.dol_trunc($obj->title,12);
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
//else $labeltoshow.=' ('.$langs->trans("Private").')';
print '>'.$labeltoshow.'</option>';
}
}
$i++;
}

View File

@ -761,9 +761,10 @@ class Project extends CommonObject
* @param user User object
* @param mode 0=All project I have permission on, 1=Affected to me only, 2=Will return list of all projects
* @param list 0=Return array,1=Return string list
* @param socid 0=No filter on third party, id of third party
* @return array or string
*/
function getProjectsAuthorizedForUser($user,$mode=0,$list=0)
function getProjectsAuthorizedForUser($user,$mode=0,$list=0,$socid=0)
{
global $conf;
@ -775,6 +776,7 @@ class Project extends CommonObject
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sql.= " WHERE p.entity = ".$conf->entity;
if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if ($mode == 2)
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
@ -72,7 +72,7 @@ $projectstatic = new Project($db);
$socstatic = new Societe($db);
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_statut, p.public, p.fk_user_creat";
$sql.= ", p.datec as date_create, p.dateo as date_start, p.datee as date_end";
@ -81,8 +81,8 @@ $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
$sql.= " WHERE p.entity = ".$conf->entity;
if ($mine) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid) $sql.= " AND s.rowid = ".$socid;
//var_dump($user->rights->societe);
if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if ($_GET["search_ref"])
{
$sql.= " AND p.ref LIKE '%".addslashes($_GET["search_ref"])."%'";
@ -98,6 +98,7 @@ if ($_GET["search_societe"])
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
//print $sql;
$var=true;
$resql = $db->query($sql);
if ($resql)

View File

@ -78,7 +78,7 @@ else
}
// Get list of project id allowed to user
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
// Get list of tasks in tasksarray and taskarrayfiltered
// We need all tasks (even not limited to a user because a task to user
// can have a parent that is not affected to him).