2
0
forked from Wavyzz/dolibarr

Major enhancement of project module

This commit is contained in:
Laurent Destailleur
2009-01-14 23:36:51 +00:00
parent 54449e3465
commit e40fe712cd
29 changed files with 1159 additions and 770 deletions

View File

@@ -13,6 +13,7 @@ For users:
- New: No limit on free text on PDF generated documents.
- New: Can force login value when creating a user from a member.
- New: Can clone a commercial proposal.
- New: Major enhancement of project module.
- Fix: Failed to go on the future view of bank transaction if there is no
future bank transaction already wrote.
- Fix: Bad ref in supplier list.

View File

@@ -55,7 +55,7 @@ class FactureFournisseur extends Facture
var $statut;
//! 1 si facture payee COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant)
var $paye;
var $author;
var $libelle;
var $date;
@@ -123,7 +123,7 @@ class FactureFournisseur extends Facture
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn (facnumber, libelle, fk_soc, datec, datef, note, fk_user_author, date_lim_reglement) ';
$sql .= " VALUES ('".addslashes($number)."','".addslashes($this->libelle)."',";
$sql .= $this->socid.", ".$this->db->idate(mktime()).",'".$this->db->idate($this->date)."','".addslashes($this->note)."', ".$user->id.",'".$this->db->idate($this->date_echeance)."');";
dolibarr_syslog("FactureFournisseur::create sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@@ -133,13 +133,13 @@ class FactureFournisseur extends Facture
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.');';
dolibarr_syslog("FactureFournisseur::create sql=".$sql, LOG_DEBUG);
$resql_insert=$this->db->query($sql);
if ($resql_insert)
{
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$this->updateline($idligne,
$this->lignes[$i]->description,
$this->lignes[$i]->pu_ht,
@@ -241,7 +241,7 @@ class FactureFournisseur extends Facture
if ($result < 0)
{
$this->error=$this->db->error();
dolibarr_syslog('FactureFournisseur::Fetch Error '.$this->error, LOG_ERROR);
dolibarr_syslog('FactureFournisseur::Fetch Error '.$this->error, LOG_ERR);
return -3;
}
return 1;
@@ -263,7 +263,7 @@ class FactureFournisseur extends Facture
}
}
/**
* \brief Load this->lignes
* \return int 1 si ok, < 0 si erreur
@@ -319,8 +319,8 @@ class FactureFournisseur extends Facture
return -3;
}
}
/**
* \brief Recup<75>re l'objet fournisseur li<6C> <20> la facture
*
@@ -339,7 +339,7 @@ class FactureFournisseur extends Facture
function delete($rowid)
{
$this->db->begin();
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';';
dolibarr_syslog("FactureFournisseur sql=".$sql);
$resql = $this->db->query($sql);
@@ -398,7 +398,7 @@ class FactureFournisseur extends Facture
function set_valid($user)
{
global $conf,$langs;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
@@ -410,7 +410,7 @@ class FactureFournisseur extends Facture
if ($resql)
{
$error=0;
// Si activé on décrémente le produit principal et ses composants à la validation de facture
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)
{
@@ -428,7 +428,7 @@ class FactureFournisseur extends Facture
}
}
}
if ($error == 0)
{
// Appel des triggers
@@ -438,7 +438,7 @@ class FactureFournisseur extends Facture
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
if ($error == 0)
{
$this->db->commit();
@@ -487,7 +487,7 @@ class FactureFournisseur extends Facture
// Nettoyage param<61>tres
if ($txtva == '') $txtva=0;
$txtva=price2num($txtva);
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.');';
@@ -560,7 +560,7 @@ class FactureFournisseur extends Facture
$result=$product->fetch($idproduct);
$product_type=$product->type;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det ';
$sql.= 'SET ';
$sql.= 'description =\''.addslashes($label).'\'';
@@ -651,7 +651,7 @@ class FactureFournisseur extends Facture
dolibarr_print_error($this->db);
}
}
/**
* \brief Charge indicateurs this->nbtodo et this->nbtodolate de tableau de bord
@@ -663,7 +663,7 @@ class FactureFournisseur extends Facture
global $conf, $user;
$now=gmmktime();
$this->nbtodo=$this->nbtodolate=0;
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin';
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user";
@@ -701,9 +701,9 @@ class FactureFournisseur extends Facture
function getNomUrl($withpicto=0,$option='')
{
global $langs;
$result='';
$lien = '<a href="'.DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$this->id.'">';
$lienfin='</a>';
@@ -712,7 +712,7 @@ class FactureFournisseur extends Facture
return $result;
}
/**
* \brief Initialise la facture avec valeurs fictives al<61>atoire
* Sert <20> g<>n<EFBFBD>rer une facture pour l'aperu des mod<6F>les ou demo
@@ -786,7 +786,7 @@ class FactureFournisseur extends Facture
$this->total_tva = $xnbp*19.6;
$this->total_ttc = $xnbp*119.6;
}
/**
* \brief Load an object from its id and create a new one in database
* \param fromid Id of object to clone
@@ -807,7 +807,7 @@ class FactureFournisseur extends Facture
$object->fetch($fromid);
$object->id=0;
$object->statut=0;
// Clear fields
$object->ref_supplier=$langs->trans("CopyOf").' '.$object->ref_supplier;
$object->author = $user->id;
@@ -819,7 +819,7 @@ class FactureFournisseur extends Facture
$object->ref_client = '';
$object->close_code = '';
$object->close_note = '';
// Create clone
$result=$object->create($user);
@@ -832,9 +832,9 @@ class FactureFournisseur extends Facture
if (! $error)
{
}
// End
@@ -849,6 +849,6 @@ class FactureFournisseur extends Facture
return -1;
}
}
}
?>

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
@@ -153,6 +153,102 @@ class FormOther
}
}
/**
* \brief Retourn list of project and tasks
* \param selected Pre-selected value
* \param modeproject 1 to restrict on projects owned by user
* \param modetask 1 to restrict on tasks associated to user
* \param htmlname Name of html select
*/
function selectProjectTasks($selected='',$htmlname='task_parent', $modeproject=0, $modetask=0)
{
global $user;
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
//print $modeproject.'-'.$modetask;
$project=new Project($this->db);
$tasksarray=$project->getTasksArray($modetask?$user:0, $modeproject?$user:0);
if ($tasksarray)
{
print '<select class="flat" name="'.$htmlname.'">';
print '<option value="0" selected="true">&nbsp;</option>';
$j=0;
$level=0;
PLineSelect($j, 0, $tasksarray, $level);
print '</select>';
}
}
}
/**
* Enter description here...
*
* @param unknown_type $inc
* @param unknown_type $parent
* @param unknown_type $lines
* @param unknown_type $level
*/
function PLineSelect(&$inc, $parent, $lines, &$level)
{
global $langs;
$lastprojectid=0;
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_parent == $parent)
{
$var = !$var;
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
{
print '<option value="'.$lines[$i]->projectid.'_0">';
print $langs->trans("Project").' '.$lines[$i]->projectref;
if ($lines[$i]->name || $lines[$i]->fistname)
{
//print ' ('.$lines[$i]->name.($lines[$i]->name && $lines[$i]->firstname?' ':'').$lines[$i]->firstname.')';
}
else
{
print ' ('.$langs->trans("SharedProject").')';
}
//print '-'.$parent.'-'.$lines[$i]->projectid.'-'.$lastprojectid;
print "</option>\n";
$lastprojectid=$lines[$i]->projectid;
$inc++;
}
print '<option value="'.$lines[$i]->projectid.'_'.$lines[$i]->id.'">';
print $langs->trans("Project").' '.$lines[$i]->projectref;
if ($lines[$i]->name || $lines[$i]->fistname)
{
//print ' ('.$lines[$i]->name.($lines[$i]->name && $lines[$i]->firstname?' ':'').$lines[$i]->firstname.')';
}
else
{
print ' ('.$langs->trans("SharedProject").')';
}
if ($lines[$i]->id) print ' > ';
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print $lines[$i]->title."</option>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLineSelect($inc, $lines[$i]->id, $lines, $level);
$level--;
}
}
}
?>

View File

@@ -766,13 +766,19 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
}
}

View File

@@ -735,13 +735,19 @@ class MenuLeft {
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
}
}

View File

@@ -241,13 +241,33 @@ insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`,
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 1);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$newmenu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3600__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/comm/clients.php?leftmenu=projects', 'NewProject', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/liste.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 1);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/tasks', 'Tasks', 0, 'projects', '$user->rights->projet->lire', '', 2, 1);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/mytasks.php', 'MyTasks', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity', 'Activity', 0, 'projects', '$user->rights->projet->lire', '', 2, 2);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/myactivity.php', 'MyActivity', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/fiche.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/liste.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3610__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects&mode=mine', 'MyProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3611__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/fiche.php?leftmenu=projects&action=create&mode=mine', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3612__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/liste.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/fiche.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&mode=mine', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/fiche.php?leftmenu=projects&action=create&mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3900__+MAX_llx_menu__, 'tools', '', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/fiche.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0);

View File

@@ -81,9 +81,9 @@ if ($_POST["action"] == "set")
{
if (! eregi('^db_pass',$cle)) dolibarr_install_syslog("Choice for ".$cle." = ".$valeur);
}
// Show title of step
print '<h3>'.$langs->trans("ConfigurationFile").'</h3>';
print '<h3>'.$langs->trans("ConfigurationFile").'</h3>';
print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
// Check parameter main_dir
@@ -92,7 +92,7 @@ if ($_POST["action"] == "set")
if (! is_dir($main_dir))
{
dolibarr_install_syslog("etape1: Repertoire '".$main_dir."' inexistant ou non accessible");
print "<tr><td>";
print $langs->trans("ErrorDirDoesNotExists",$main_dir).'<br>';
print $langs->trans("ErrorWrongValueForParameter",$langs->trans("WebPagesDirectory")).'<br>';
@@ -108,7 +108,7 @@ if ($_POST["action"] == "set")
if (! $error)
{
dolibarr_install_syslog("etape1: Directory '".$main_dir."' exists");
require_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php");
}
@@ -125,7 +125,7 @@ if ($_POST["action"] == "set")
{
create_exdir($main_data_dir);
}
if (! is_dir($main_data_dir))
{
print "<tr><td>".$langs->trans("ErrorDirDoesNotExists",$main_data_dir);
@@ -148,7 +148,7 @@ if ($_POST["action"] == "set")
$dir[6] = "$main_data_dir/rapport";
$dir[7] = "$main_data_dir/rss";
$dir[8] = "$main_data_dir/logo";
// Boucle sur chaque r<>pertoire de dir[] pour les cr<63>er s'ils nexistent pas
for ($i = 0 ; $i < sizeof($dir) ; $i++)
{
@@ -190,14 +190,14 @@ if ($_POST["action"] == "set")
{
$error+=write_conf_file($conffile);
}
/**
* Create database and admin user database
*/
if (! $error)
{
conf($dolibarr_main_document_root);
$userroot=isset($_POST["db_user_root"])?$_POST["db_user_root"]:"";
$passroot=isset($_POST["db_pass_root"])?$_POST["db_pass_root"]:"";
@@ -223,16 +223,16 @@ if ($_POST["action"] == "set")
{
$databasefortest='mssql';
}
// Creation handler de base, verification du support et connexion
$db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot,$databasefortest,$conf->db->port);
if ($db->error)
{
{
print '<div class="error">'.$db->error.'</div>';
$error++;
}
if (! $error)
{
if ($db->connected)
@@ -241,7 +241,7 @@ if ($_POST["action"] == "set")
if ($result > 0)
{
print '<tr><td>';
print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user;
@@ -269,7 +269,7 @@ if ($_POST["action"] == "set")
print '<td>'.$langs->trans("Error").' '.$db->error()."</td></tr>";
}
}
$db->close();
}
else
@@ -280,7 +280,7 @@ if ($_POST["action"] == "set")
print '</td>';
print '<td>'.$langs->trans("Error").'</td>';
print '</tr>';
// Affiche aide diagnostique
print '<tr><td colspan="2"><br>';
print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect",$dolibarr_main_db_user,$dolibarr_main_db_host,$userroot);
@@ -288,13 +288,13 @@ if ($_POST["action"] == "set")
print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
print '</td></tr>';
$error++;
}
}
} // Fin si "creation utilisateur"
/*
* If database creation is asked, we create it
*/
@@ -312,7 +312,7 @@ if ($_POST["action"] == "set")
print $dolibarr_main_db_name;
print '</td>';
print "<td>".$langs->trans("OK")."</td></tr>";
$check1=$db->getDefaultCharacterSetDatabase();
$check2=$db->getDefaultCollationDatabase();
dolibarr_install_syslog('etape1: Note that default server was charset='.$check1.' collation='.$check2, LOG_DEBUG);
@@ -406,7 +406,7 @@ if ($_POST["action"] == "set")
print $langs->trans("OK");
print "</td></tr>";
dolibarr_install_syslog("etape1: connexion to database ".$conf->db->name.", bu user : ".$conf->db->user." has failed", LOG_ERROR);
dolibarr_install_syslog("etape1: connexion to database ".$conf->db->name.", bu user : ".$conf->db->user." has failed", LOG_ERR);
print "<tr><td>";
print $langs->trans("DatabaseConnection")." : ";
print $dolibarr_main_db_name;
@@ -464,7 +464,7 @@ function write_conf_file($conffile)
global $dolibarr_smarty_libs_dir,$dolibarr_smarty_compile,$dolibarr_smarty_cache;
$error=0;
$fp = fopen("$conffile", "w");
if($fp)
{
@@ -482,34 +482,34 @@ function write_conf_file($conffile)
fputs($fp, '$dolibarr_main_url_root="'.$_POST["main_url"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_document_root="'.$main_dir.'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_data_root="'.$main_data_dir.'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_host="'.$_POST["db_host"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_port="'.$_POST["db_port"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_name="'.$_POST["db_name"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_user="'.$_POST["db_user"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_pass="'.$_POST["db_pass"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_type="'.$_POST["db_type"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_character_set="'.$_POST["dolibarr_main_db_character_set"].'";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_collation="'.$_POST["dolibarr_main_db_collation"].'";');
fputs($fp,"\n");
@@ -527,17 +527,17 @@ function write_conf_file($conffile)
/* Preparation integration SMARTY */
fputs($fp, '$dolibarr_smarty_libs_dir="";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_smarty_compile="";');
fputs($fp,"\n");
fputs($fp, '$dolibarr_smarty_cache="";');
fputs($fp,"\n");
/* Fin Smarty*/
fputs($fp, '?>');
fclose($fp);
if (file_exists("$conffile"))
{
include("$conffile"); // On force rechargement. Ne pas mettre include_once !
@@ -554,7 +554,7 @@ function write_conf_file($conffile)
$error++;
}
}
return $error;
}

View File

@@ -327,8 +327,8 @@ Permission32=Create/modify products/services
Permission33=Command products/services
Permission34=Delete products/services
Permission36=Export products/services
Permission41=Read projects
Permission42=Create/modify projects
Permission41=Read projects and tasks
Permission42=Create/modify projects, edit tasks for my projects
Permission44=Delete projects
Permission61=Read interventions
Permission62=Create/modify interventions

View File

@@ -1,6 +1,7 @@
# Dolibarr language file - en_US - projects
Project=Project
Projects=Projects
SharedProject=Shared project
Myprojects=My projects
ProjectsArea=Projects area
NewProject=New project
@@ -30,8 +31,11 @@ NewTask=New task
AddTask=Add task
AddDuration=Add duration
Activity=Activity
Activities=Tasks/activities
MyActivity=My activity
MyActivities=My tasks/activities
DurationEffective=Effective duration
MyProjects=My projects
Time=Time
ListProposalsAssociatedProject=Lists of the commercial proposals associated with the project
ListOrdersAssociatedProject=Lists of the orders associated with the project
@@ -42,4 +46,6 @@ ListContractAssociatedProject=List of contracts associated with the project
ActivityOnProjectThisWeek=Activity on project this week
ActivityOnProjectThisMonth=Activity on project this month
ActivityOnProjectThisYear=Activity on project this year
ChildOfTaks=child of task
ChildOfTaks=Child of project/task
NotOwnerOfProject=Not owner of this private project
AffectedTo=Affected to

View File

@@ -326,8 +326,8 @@ Permission32=Cr
Permission33=Commander les produits/services
Permission34=Supprimer les produits/services
Permission36=Exporter les produits/services
Permission41=Consulter les projets
Permission42=Cr<43>er/modifier les projets
Permission41=Consulter les projets et t<>ches
Permission42=Cr<43>er/modifier les projets, <20>diter t<>ches de mes projets
Permission44=Supprimer les projets
Permission61=Consulter les interventions
Permission62=Cr<43>er/modifier les interventions

View File

@@ -1,6 +1,7 @@
# Dolibarr language file - fr_FR - projects
Project=Projet
Projects=Projets
SharedProject=Projet partag<61>
Myprojects=Mes projets
ProjectsArea=Espace projet
NewProject=Nouveau projet
@@ -30,7 +31,10 @@ NewTask=Nouvelle t
AddTask=Cr<43>er t<>che
AddDuration=Ajouter la dur<75>e
Activity=Activit<69>
Activities=T<>ches/activit<69>s
MyActivity=Mon activit<69>
MyActivities=Mes t<>ches/activit<69>s
MyProjects=Mes projets
DurationEffective=Dur<75>e effective
Time=Temps
ListProposalsAssociatedProject=Liste des propositions commerciales associ<63>es au projet
@@ -42,4 +46,6 @@ ListContractAssociatedProject=Liste des contrats associ
ActivityOnProjectThisWeek=Activit<69> sur les projets cette semaine
ActivityOnProjectThisMonth=Activit<69> sur les projets ce mois
ActivityOnProjectThisYear=Activit<69> sur les projets cette ann<6E>e
ChildOfTaks=fille de la tache
ChildOfTaks=Fille du projet/t<>che
NotOwnerOfProject=Non responsable de ce projet priv<69>
AffectedTo=Affect<63> <20>

View File

@@ -125,7 +125,7 @@ function dol_string_unaccent($str)
OOOOOUUUY
aaaaaceeee
iiiidnooooo
uuuyy");
uuuyy");
$string = strtr($string, array("\xC4"=>"Ae", "\xC6"=>"AE", "\xD6"=>"Oe", "\xDC"=>"Ue", "\xDE"=>"TH", "\xDF"=>"ss", "\xE4"=>"ae", "\xE6"=>"ae", "\xF6"=>"oe", "\xFC"=>"ue", "\xFE"=>"th"));
return $string;
}
@@ -185,7 +185,7 @@ function dol_syslog($message, $level=LOG_INFO)
// If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_LOGTOHTML))
{
$conf->logbuffer[]=strftime("%Y-%m-%d %H:%M:%S",time())." ".$message;
$conf->logbuffer[]=strftime("%Y-%m-%d %H:%M:%S",time())." ".$message;
}
// If syslog module enabled
@@ -395,7 +395,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='')
// If date undefined or "", we return ""
if (strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
// Analyse de la date (deprecated)
if (eregi('^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?',$time,$reg))
{
@@ -672,7 +672,7 @@ function dol_print_size($size)
function dol_print_url($url,$target='_blank',$max=32)
{
if (empty($url)) return '';
$link='<a href="';
if (! eregi('^http',$url)) $link.='http://';
$link.=$url;
@@ -695,13 +695,13 @@ function dol_print_url($url,$target='_blank',$max=32)
function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64)
{
global $conf,$user,$langs;
$newemail=$email;
if (empty($email)) return '&nbsp;';
if (! ValidEmail($email)) return "Bad email";
if (! empty($addlink))
{
$newemail='<a href="';
@@ -710,7 +710,7 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64)
$newemail.='">';
$newemail.=dol_trunc($email,$max);
$newemail.='</a>';
if (($cid || $socid) && $conf->agenda->enabled && $user->rights->agenda->myactions->create)
{
$type='AC_EMAIL';
@@ -718,7 +718,7 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64)
$newemail='<table class="nobordernopadding"><tr><td>'.$newemail.' </td><td>&nbsp;'.$link.'</td></tr></table>';
}
}
return $newemail;
}
@@ -741,7 +741,7 @@ function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$s
function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ="&nbsp;")
{
global $conf,$user,$langs;
// Clean phone parameter
$phone = ereg_replace("[ .-]","",trim($phone));
if (empty($phone)) { return ''; }
@@ -770,14 +770,14 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
}
}
if (! empty($addlink))
{
if ($conf->clicktodial->enabled)
{
if (empty($user->clicktodial_loaded)) $user->fetch_clicktodial();
if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured';
if (empty($conf->global->CLICKTODIAL_URL)) $urlmask='ErrorClickToDialModuleNotConfigured';
else $urlmask=$conf->global->CLICKTODIAL_URL;
$url = sprintf($urlmask, urlencode($phone), urlencode($user->clicktodial_poste), urlencode($user->clicktodial_login), urlencode($user->clicktodial_password));
$newphone='<a href="'.$url.'">'.$newphone.'</a>';
@@ -806,7 +806,7 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
function dol_strlen($string,$stringencoding='')
{
global $langs;
if (empty($stringencoding)) $stringencoding=$langs->charset_output;
$ret='';
@@ -833,7 +833,7 @@ function dol_strlen($string,$stringencoding='')
function dol_substr($string,$start,$length,$stringencoding='')
{
global $langs;
if (empty($stringencoding)) $stringencoding=$langs->charset_output;
$ret='';
@@ -1101,8 +1101,8 @@ function img_delete($alt = "default")
/**
* \brief Affiche logo help avec curseur "?"
* \param usehelpcursor
* \param usealttitle
* \param usehelpcursor
* \param usealttitle
* \return string Retourne tag img
*/
function img_help($usehelpcursor=1,$usealttitle=1)
@@ -1111,7 +1111,7 @@ function img_help($usehelpcursor=1,$usealttitle=1)
$s ='<img ';
if ($usehelpcursor) $s.='style="cursor: help;" ';
$s.='src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/info.png" border="0"';
if ($usealttitle)
if ($usealttitle)
{
if (is_string($usealttitle)) $s.=' alt="'.$usealttitle.'" title="'.$usealttitle.'"';
else $s.=' alt="'.$langs->trans("Info").'" title="'.$langs->trans("Info").'"';
@@ -1567,8 +1567,8 @@ function dol_print_error($db='',$error='')
if ($_SERVER['DOCUMENT_ROOT']) // Mode web
{
print $langs->trans("DolibarrHasDetectedError").".<br>\n";
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
print "You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n";
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
print "You use an experimental level of features, so please do NOT report any bugs, anywhere, until going back to MAIN_FEATURES_LEVEL = 0.<br>\n";
print $langs->trans("InformationToHelpDiagnose").":<br><br>\n";
print "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";;
@@ -1612,7 +1612,7 @@ function dol_print_error($db='',$error='')
if ($error)
{
$langs->load("errors");
if (is_array($error)) $errors=$error;
else $errors=array($error);
@@ -1630,7 +1630,7 @@ function dol_print_error($db='',$error='')
$syslog.=", msg=".$msg;
}
}
dolibarr_syslog("Error ".$syslog, LOG_ERR);
}
@@ -1717,7 +1717,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
* \param begin ("" par defaut)
* \param options ("" par defaut)
* \param td options de l'attribut td ("" par defaut)
* \param sortfield nom du champ sur lequel est effectue le tri du tableau
* \param sortfield field currently used to sort
* \param sortorder ordre du tri
*/
function print_liste_field_titre($name, $file, $field, $begin="", $options="", $td="", $sortfield="", $sortorder="")
@@ -1727,7 +1727,7 @@ function print_liste_field_titre($name, $file, $field, $begin="", $options="", $
// Le champ de tri est mis en evidence.
// Exemple si (sortfield,field)=("nom","xxx.nom") ou (sortfield,field)=("nom","nom")
if ($sortfield == $field || $sortfield == ereg_replace("^[^\.]+\.","",$field))
if ($field && ($sortfield == $field || $sortfield == ereg_replace("^[^\.]+\.","",$field)))
{
print '<td class="liste_titre_sel" '. $td.'>';
}
@@ -1829,7 +1829,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
}
print '<table width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
$pagelist = '';
// Left
@@ -2109,17 +2109,17 @@ function price2num($amount,$rounding='',$alreadysqlnb=-1)
// Convert value to universal number format (no thousand separator, '.' as decimal separator)
if ($alreadysqlnb != 1) // If not a PHP number or unknown, we change format
{
//print 'ZZ'.$nbofdec.'=>'.$amount.'<br>';
//print 'ZZ'.$nbofdec.'=>'.$amount.'<br>';
// Convert amount to format with dolibarr dec and thousand (this is because PHP convert a number
// to format defined by LC_NUMERIC after a calculation and we want source format to be like defined by Dolibarr setup.
if (is_numeric($amount))
if (is_numeric($amount))
{
$nbofdec=max(0,strlen($amount-intval($amount))-2);
$amount=number_format($amount,$nbofdec,$dec,$thousand);
}
//print "QQ".$amount.'<br>';
// Now make replace (the main goal of function)
if ($thousand != ',' && $thousand != '.') $amount=str_replace(',','.',$amount); // To accept 2 notations for french users
$amount=str_replace(' ','',$amount); // To avoid spaces
@@ -2133,12 +2133,12 @@ function price2num($amount,$rounding='',$alreadysqlnb=-1)
$nbofdectoround='';
if ($rounding == 'MU') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_UNIT;
elseif ($rounding == 'MT') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_TOT;
elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
elseif ($rounding == '2') $nbofdectoround=2; // For admin info page
if (strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0.
else return 'ErrorBadParameterProvidedToFunction';
//print 'ZZ'.$nbofdec.'-'.$nbofdectoround.'=>'.$amount.'<br>';
//print 'ZZ'.$nbofdec.'-'.$nbofdectoround.'=>'.$amount.'<br>';
// Convert amount to format with dolibarr dec and thousand (this is because PHP convert a number
// to format defined by LC_NUMERIC after a calculation and we want source format to be defined by Dolibarr setup.
if (is_numeric($amount))
@@ -2155,7 +2155,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=-1)
$amount=str_replace($thousand,'',$amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
$amount=str_replace($dec,'.',$amount);
}
return $amount;
}
@@ -2384,7 +2384,7 @@ function clean_url($url,$http=1)
//print $url." -> ".$proto." - ".$domain." - ".$port;
//$url = dol_string_nospecial(trim($url));
$url = trim($url);
// Si http: defini on supprime le http (Si https on ne supprime pas)
$newproto=$proto;
if ($http==0)

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@@ -18,12 +18,11 @@
*/
/**
\file htdocs/lib/project.lib.php
\brief Ensemble de fonctions de base pour le module projet
\ingroup societe
\version $Id$
*/
* \file htdocs/lib/project.lib.php
* \brief Ensemble de fonctions de base pour le module projet
* \ingroup societe
* \version $Id$
*/
function project_prepare_head($objsoc)
{
global $langs, $conf, $user;
@@ -58,12 +57,39 @@ function project_prepare_head($objsoc)
/**
\brief Affiche la liste d<>roulante des projets d'une soci<63>t<EFBFBD> donn<6E>e
\param socid Id soci<63>t<EFBFBD>
\param selected Id projet pr<70>-s<>lectionn<6E>
\param htmlname Nom de la zone html
\return int Nbre de projet si ok, <0 si ko
*/
* \file htdocs/lib/project.lib.php
* \brief Ensemble de fonctions de base pour le module projet
* \ingroup societe
* \version $Id$
*/
function task_prepare_head($object)
{
global $langs, $conf, $user;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$object->id;
$head[$h][1] = $langs->trans("TimeSpent");
$head[$h][2] = 'tasks';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/who.php?id='.$object->id;
$head[$h][1] = $langs->trans("Affectations");
$head[$h][2] = 'who';
$h++;
return $head;
}
/**
* \brief Show a combo list with projects qualified for a third party)
* \param socid Id third party
* \param selected Id project preselected
* \param htmlname Nom de la zone html
* \return int Nbre de projet si ok, <0 si ko
*/
function select_projects($socid, $selected='', $htmlname='projectid')
{
global $db;
@@ -109,4 +135,195 @@ function select_projects($socid, $selected='', $htmlname='projectid')
}
}
function PLinesb(&$inc, $parent, $lines, &$level, $tasksrole)
{
global $user, $bc, $langs;
global $form;
$projectstatic = new Project($db);
$var=true;
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0)
$level = 0;
if ($lines[$i]->fk_parent == $parent)
{
$var = !$var;
print "<tr $bc[$var]>\n";
print "<td>";
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->ref=$lines[$i]->projectref;
print $projectstatic->getNomUrl(1);
print "</td>";
print "<td>".$lines[$i]->id."</td>";
print "<td>";
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'">'.$lines[$i]->title."</a></td>\n";
$heure = intval($lines[$i]->duration);
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
$minutes = substr("00"."$minutes", -2);
print '<td align="right">'.$heure."&nbsp;h&nbsp;".$minutes."</td>\n";
if ($tasksrole[$lines[$i]->id] == 'admin')
{
print '<td>';
print '<input size="4" type="text" class="flat" name="task'.$lines[$i]->id.'" value="">';
print '&nbsp;<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</td>';
print "<td>";
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
print '</td>';
}
else
{
print '<td colspan="2">&nbsp;</td>';
}
print "</tr>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLinesb($inc, $lines[$i]->id, $lines, $level, $tasksrole);
$level--;
}
else
{
//$level--;
}
}
return $inc;
}
/**
* Enter description here...
*
* @param unknown_type $inc
* @param unknown_type $parent
* @param unknown_type $lines
* @param unknown_type $level
* @param unknown_type $var
* @param unknown_type $showproject
*/
function PLines(&$inc, $parent, $lines, &$level, $var, $showproject=1)
{
global $user, $bc, $langs;
$lastprojectid=0;
$projectstatic = new Project($db);
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_parent == $parent)
{
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
{
$var = !$var;
$lastprojectid=$lines[$i]->projectid;
}
print "<tr ".$bc[$var].">\n";
if ($showproject)
{
print "<td>";
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->ref=$lines[$i]->projectref;
print $projectstatic->getNomUrl(1);
print "</td>";
}
print "<td>".$lines[$i]->id."</td>";
print "<td>";
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print '<a href="task.php?id='.$lines[$i]->id.'">'.$lines[$i]->title."</a></td>\n";
$heure = intval($lines[$i]->duration);
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
$minutes = substr("00"."$minutes", -2);
print '<td align="right">'.$heure."&nbsp;h&nbsp;".$minutes."</td>\n";
print "</tr>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $var, $showproject);
$level--;
}
else
{
//$level--;
}
}
return $inc;
}
/**
* Clean task not linked to a parent
* @param unknown_type $db
* @return int Nb of records deleted
*/
function clean_orphelins($db)
{
$nb=0;
// There is orphelins. We clean that
$listofid=array();
$sql='SELECT rowid from '.MAIN_DB_PREFIX.'projet_task';
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num && $i < 100)
{
$obj = $db->fetch_object($resql);
$listofid[]=$obj->rowid;
$i++;
}
}
else
{
dolibarr_print_error($db);
}
if (sizeof($listofid))
{
// Removed orphelins records
print 'Some orphelins were found and restored to be parents so records are visible again.';
$sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task set fk_task_parent = 0 where fk_task_parent';
$sql.= ' NOT IN ('.join(',',$listofid).')';
$resql = $db->query($sql);
$nb=$db->affected_rows($sql);
}
return $nb;
}
?>

View File

@@ -19,18 +19,17 @@
*/
/**
\file htdocs/project.class.php
\ingroup projet
\brief Fichier de la classe de gestion des projets
\version $Id$
*/
* \file htdocs/project.class.php
* \ingroup projet
* \brief Fichier de la classe de gestion des projets
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/**
\class Project
\brief Classe permettant la gestion des projets
*/
* \class Project
* \brief Class to manage projects
*/
class Project extends CommonObject
{
var $db; //!< To store db handler
@@ -47,9 +46,9 @@ class Project extends CommonObject
/**
* \brief Constructeur de la classe
* \param DB handler acc<63>s base de donn<6E>es
*/
* \brief Constructeur de la classe
* \param DB handler acc<63>s base de donn<6E>es
*/
function Project($DB)
{
$this->db = $DB;
@@ -57,10 +56,10 @@ class Project extends CommonObject
}
/*
* \brief Cree un projet en base
* \param user Id utilisateur qui cree
* \return int <0 si ko, id du projet cree si ok
*/
* \brief Cree un projet en base
* \param user Id utilisateur qui cree
* \return int <0 si ko, id du projet cree si ok
*/
function create($user)
{
// Check parameters
@@ -176,10 +175,10 @@ class Project extends CommonObject
}
/**
* \brief Return list of projects
* \param id_societe To filter on a particular third party
* \return array Liste of projects
*/
* \brief Return list of projects
* \param id_societe To filter on a particular third party
* \return array Liste of projects
*/
function liste_array($id_societe='')
{
$projets = array();
@@ -216,10 +215,10 @@ class Project extends CommonObject
}
/**
* \brief Return list of elements for type linked to project
* \param type 'propal','order','invoice','order_supplier','invoice_supplier'
* \return array List of orders linked to project, <0 if error
*/
* \brief Return list of elements for type linked to project
* \param type 'propal','order','invoice','order_supplier','invoice_supplier'
* \return array List of orders linked to project, <0 if error
*/
function get_element_list($type)
{
$elements = array();
@@ -262,9 +261,9 @@ class Project extends CommonObject
}
/**
* \brief Supprime le projet dans la base
* \param Utilisateur
*/
* \brief Supprime le projet dans la base
* \param Utilisateur
*/
function delete($user)
{
@@ -283,51 +282,71 @@ class Project extends CommonObject
}
/**
* \brief Create a task into project
* \param user Id user that create
* \param title Title of task
* \param parent Id task parent
*/
function CreateTask($user, $title, $parent = 0)
* \brief Create a task into project
* \param user Id user that create
* \param title Title of task
* \param parent Id task parent
* \param id_resp Id of responsible user
* \return int Task id if succes, <0 if KO
*/
function CreateTask($user, $title, $parent=0, $id_resp=0)
{
$result = 0;
$task_id = -1;
if (trim($title))
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (fk_projet, title, fk_user_creat, fk_task_parent, duration_effective)";
$sql.= " VALUES (".$this->id.",'$title', ".$user->id.",".$parent.", 0)";
$this->db->begin();
dolibarr_syslog("Project::CreateTask sql=".$sql,LOG_DEBUG);
if ($this->db->query($sql) )
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task (fk_projet, title, fk_user_creat, fk_task_parent, duration_effective)";
$sql.= " VALUES (".$this->id.",'".addslashes($title)."', ".$user->id.",".($parent>0?$parent:'0').", 0)";
dolibarr_syslog("Project::CreateTask sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql))
{
$task_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task");
$result = 0;
$result = $task_id;
}
else
{
$this->error=$this->db->error();
dolibarr_syslog("Project::CreateTask error -2 ".$this->error,LOG_ERR);
$result = -2;
$this->error=$this->db->lasterror();
dolibarr_syslog("Project::CreateTask error -1 ".$this->error, LOG_ERR);
$result = -1;
}
if ($result == 0)
if ($result >= 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user)";
$sql.= " VALUES (".$task_id.",".$user->id.")";
dolibarr_syslog("Project::CreateTask sql=".$sql,LOG_DEBUG);
if ($this->db->query($sql) )
if ($id_resp > 0)
{
$result = 0;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_actors (fk_projet_task, fk_user)";
$sql.= " VALUES (".$task_id.",".($id_resp>0?$id_resp:'null').")";
dolibarr_syslog("Project::CreateTask sql=".$sql,LOG_DEBUG);
if ($this->db->query($sql) )
{
$this->db->commit();
return $task_id;
}
else
{
$this->error=$this->db->lasterror();
dolibarr_syslog("Project::CreateTask error -3 ".$this->error,LOG_ERR);
$this->db->rollback();
return -3;
}
}
else
{
$this->error=$this->db->error();
dolibarr_syslog("Project::CreateTask error -3 ".$this->error,LOG_ERR);
$result = -2;
$this->db->commit();
return $task_id;
}
}
else
{
dolibarr_syslog("Project::CreateTask error -2 ".$this->error,LOG_ERR);
$this->db->rollback();
return -2;
}
}
else
{
@@ -340,11 +359,11 @@ class Project extends CommonObject
/**
* \brief Cree une tache dans le projet
* \param user Id utilisateur qui cree
* \param title titre de la tache
* \param parent tache parente
*/
* \brief Cree une tache dans le projet
* \param user Id utilisateur qui cree
* \param title titre de la tache
* \param parent tache parente
*/
function TaskAddTime($user, $task, $time, $date)
{
$result = 0;
@@ -424,31 +443,39 @@ class Project extends CommonObject
}
/**
* Return list of task for project
* @param user Object user to limit task affected to a particular user
*
* @return unknown
* Return list of task for all projects or a particular project
* Sort order is on project, TODO then of position of task, and last on title of first level task
* @param usert Object user to limit task affected to a particular user
* @param userp Object user to limit projects of a particular user
* @return array Array of tasks
*/
function getTasksArray($user=0)
function getTasksArray($usert=0,$userp=0)
{
$tasks = array();
/* List of tasks */
//print $usert.'-'.$userp;
// List of tasks
$sql = "SELECT p.rowid as projectid, p.ref, p.title as ptitle,";
$sql.= " t.rowid, t.title, t.fk_task_parent, t.duration_effective";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if (is_object($user))
$sql.= " t.rowid, t.title, t.fk_task_parent, t.duration_effective,";
$sql.= " up.name, up.firstname";
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
if (is_object($usert)) // Limit to task affected to a user
{
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql.= ", ".MAIN_DB_PREFIX."projet_task_actors as ta";
$sql.= ")";
}
else
{
$sql.= ")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
}
$sql.=" WHERE 1 = 1";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as up on p.fk_user_resp = up.rowid";
$sql.= " WHERE 1 = 1";
if ($this->id) $sql .= " AND t.fk_projet =".$this->id;
if (is_object($user)) $sql .= " AND t.fk_projet = p.rowid AND ta.fk_projet_task = t.rowid AND ta.fk_user =".$user->id;
if (is_object($usert)) $sql .= " AND t.fk_projet = p.rowid AND ta.fk_projet_task = t.rowid AND ta.fk_user = ".$usert->id;
if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)";
$sql.= " ORDER BY p.ref, t.title";
dolibarr_syslog("Project::getTasksArray sql=".$sql, LOG_DEBUG);
@@ -463,10 +490,12 @@ class Project extends CommonObject
$tasks[$i]->projectid = $obj->projectid;
$tasks[$i]->projectref = $obj->ref;
$tasks[$i]->projectlabel = $obj->title;
$tasks[$i]->id = $obj->rowid;
$tasks[$i]->title = $obj->title;
$tasks[$i]->fk_parent = $obj->fk_task_parent;
$tasks[$i]->duration = $obj->duration_effective;
$tasks[$i]->id = $obj->rowid;
$tasks[$i]->title = $obj->title;
$tasks[$i]->fk_parent = $obj->fk_task_parent;
$tasks[$i]->duration = $obj->duration_effective;
$tasks[$i]->name = $obj->name;
$tasks[$i]->firstname = $obj->firstname;
$i++;
}
$this->db->free();
@@ -479,6 +508,7 @@ class Project extends CommonObject
return $tasks;
}
/**
* \brief Renvoie nom clicable (avec eventuellement le picto)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@@ -18,11 +18,11 @@
*/
/**
\file htdocs/projet/activity/myactivity.php
\ingroup projet
\brief Page activite perso du module projet
\version $Id$
*/
\file htdocs/projet/activity/myactivity.php
\ingroup projet
\brief Page activite perso du module projet
\version $Id$
*/
require("./pre.inc.php");
@@ -31,9 +31,9 @@ $mode=$_REQUEST["mode"];
// Security check
if (!$user->rights->projet->lire) accessforbidden();
if ($user->societe_id > 0)
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
$socid = $user->societe_id;
}
$langs->load("projects");
@@ -43,10 +43,12 @@ $langs->load("projects");
* View
*/
$now = time();
$now = gmmktime();
if ($mode == 'mine') $title=$langs->trans("MyActivity");
else $title=$langs->trans("Activity");
$projectstatic=new Project($db);
if ($mode == 'mine') $title=$langs->trans("MyActivities");
else $title=$langs->trans("Activities");
llxHeader("",$title);
@@ -55,18 +57,13 @@ print_fiche_titre($title);
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td width="30%" valign="top" class="notopnoleft">';
/*
*
* Affichage de la liste des projets
*
*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"s.nom","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Project"),$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
print "</tr>\n";
$sql = "SELECT p.title, p.rowid, count(t.rowid)";
$sql = "SELECT p.rowid, p.ref, p.title, count(t.rowid) as nb";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p,";
$sql .= " ".MAIN_DB_PREFIX."projet_task as t";
@@ -75,8 +72,8 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFI
$sql .= " WHERE t.fk_projet = p.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
{
$sql .= " AND p.fk_soc = ".$socid;
{
$sql .= " AND p.fk_soc = ".$socid;
}
if ($mode == 'mine') $sql.=" AND t.rowid = pta.fk_projet_task";
if ($mode == 'mine') $sql.=" AND pta.fk_user = ".$user->id;
@@ -86,26 +83,30 @@ $var=true;
$resql = $db->query($sql);
if ( $resql )
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row( $resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
while ($i < $num)
{
$row = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.$row->nb.'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print "</table>";
@@ -116,7 +117,7 @@ print '<td width="50%">'.$langs->trans('Today').'</td>';
print '<td width="50%" align="right">'.$langs->trans("Time").'</td>';
print "</tr>\n";
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
$sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -131,26 +132,30 @@ $total=0;
$resql = $db->query($sql);
if ( $resql )
{
while ($row = $db->fetch_row($resql))
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$total += $row[2];
}
$db->free($resql);
while ($row = $db->fetch_object($resql))
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.$row->nb.'</td>';
print "</tr>\n";
$total += $row->nb;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print '<tr class="liste_total">';
print '<td>'.$langs->trans('Total').'</td>';
print '<td align="right">'.$total.'</td>';
print "</tr>\n";
print "</tr>\n";
print "</table>";
/* Affichage de la liste des projets d'hier */
@@ -160,7 +165,7 @@ print '<td>'.$langs->trans('Yesterday').'</td>';
print '<td align="right">'.$langs->trans("Time").'</td>';
print "</tr>\n";
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
$sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -175,21 +180,25 @@ $total=0;
$resql = $db->query($sql);
if ( $resql )
{
while ($row = $db->fetch_row($resql))
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$total += $row[2];
}
$db->free($resql);
while ($row = $db->fetch_object($resql))
{
$var=!$var;
print "<tr $bc[$var]>";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.$row->nb.'</td>';
print "</tr>\n";
$total += $row->nb;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print '<tr class="liste_total">';
print '<td>'.$langs->trans('Total').'</td>';
@@ -206,7 +215,7 @@ print '<td>'.$langs->trans("ActivityOnProjectThisWeek").'</td>';
print '<td align="right">'.$langs->trans("Time").'</td>';
print "</tr>\n";
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
$sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -220,21 +229,25 @@ $var=true;
$resql = $db->query($sql);
if ( $resql )
{
while ($row = $db->fetch_row( $resql))
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$total += $row[2];
}
$db->free($resql);
while ($row = $db->fetch_object($resql))
{
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.$row->nb.'</td>';
print "</tr>\n";
$total += $row->nb;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print '<tr class="liste_total">';
print '<td>'.$langs->trans('Total').'</td>';
@@ -249,7 +262,7 @@ print '<td>'.$langs->trans("ActivityOnProjectThisMonth").': '.strftime("%B %Y",
print '<td align="right">'.$langs->trans("Time").'</td>';
print "</tr>\n";
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
$sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -263,19 +276,23 @@ $var=false;
$resql = $db->query($sql);
if ( $resql )
{
while ($row = $db->fetch_row($resql))
{
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$var=!$var;
}
$db->free($resql);
while ($row = $db->fetch_object($resql))
{
print "<tr $bc[$var]>";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.$row->nb.'</td>';
print "</tr>\n";
$var=!$var;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print "</table>";
@@ -286,7 +303,7 @@ print '<td>'.$langs->trans("ActivityOnProjectThisYear").': '.strftime("%Y", $now
print '<td align="right">'.$langs->trans("Time").'</td>';
print "</tr>\n";
$sql = "SELECT p.title, p.rowid, sum(tt.task_duration)";
$sql = "SELECT p.rowid, p.ref, p.title, sum(tt.task_duration) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " , ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt";
@@ -300,19 +317,23 @@ $var=false;
$resql = $db->query($sql);
if ( $resql )
{
while ($row = $db->fetch_row($resql))
{
print "<tr $bc[$var]>";
print '<td><a href="'.DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$row[1].'">'.$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$var=!$var;
}
$db->free($resql);
while ($row = $db->fetch_object($resql))
{
print "<tr $bc[$var]>";
print '<td>';
$projectstatic->id=$row->rowid;
$projectstatic->ref=$row->ref;
print $projectstatic->getNomUrl(1);
print '</td>';
print '<td align="right">'.$row->nb.'</td>';
print "</tr>\n";
$var=!$var;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print "</table>";

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -68,7 +68,7 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
{
$post=intval($post)+(($post-intval($post))*(1+2/3));
$post=price2num($post);
$id = ereg_replace("task","",$key);
$task=new Task($db);
@@ -76,7 +76,7 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
$project = new Project($db);
$result = $project->fetch($task->fk_projet);
$date = dolibarr_mktime(12,0,0,$_POST["$id"."month"],$_POST["$id"."day"],$_POST["$id"."year"]);
$project->TaskAddTime($user, $id , $post, $date);
}
@@ -118,7 +118,8 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorde
if ($mesg) print $mesg;
$tasksrole=$projet->getTasksRoleForUser($user);
$tasksarray=$projet->getTasksArray();
$tasksarray=$projet->getTasksArray(0,0);
//var_dump($tasksarray);
print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$projet->id.'">';
print '<input type="hidden" name="action" value="addtime">';
@@ -131,7 +132,7 @@ print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
print "</tr>\n";
PLines($j, 0, $tasksarray, $level, $tasksrole);
PLinesb($j, 0, $tasksarray, $level, $tasksrole);
print '</form>';
@@ -141,75 +142,4 @@ print '</div>';
$db->close();
llxFooter('$Date$ - $Revision$');
function PLines(&$inc, $parent, $lines, &$level, $tasksrole)
{
global $user, $bc, $langs;
global $form;
$projectstatic = new Project($db);
$var=true;
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0)
$level = 0;
if ($lines[$i]->fk_parent == $parent)
{
$var = !$var;
print "<tr $bc[$var]>\n";
print "<td>";
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->ref=$lines[$i]->projectref;
print $projectstatic->getNomUrl(1);
print "</td>";
print "<td>".$lines[$i]->id."</td>";
print "<td>";
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'">'.$lines[$i]->title."</a></td>\n";
$heure = intval($lines[$i]->duration);
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
$minutes = substr("00"."$minutes", -2);
print '<td align="right">'.$heure."&nbsp;h&nbsp;".$minutes."</td>\n";
if ($tasksrole[$lines[$i]->id] == 'admin')
{
print '<td>';
print '<input size="4" type="text" class="flat" name="task'.$lines[$i]->id.'" value="">';
print '&nbsp;<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</td>';
print "<td>";
print $form->select_date('',$lines[$i]->id,'','','',"addtime");
print '</td>';
}
else
{
print '<td colspan="2">&nbsp;</td>';
}
print "</tr>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $tasksrole);
$level--;
}
else
{
//$level--;
}
}
}
?>

View File

@@ -17,11 +17,11 @@
*/
/**
\file htdocs/projet/activity/pre.inc.php
\ingroup projet
\brief Fichier de gestion du menu gauche du module projet
\version $Id$
*/
* \file htdocs/projet/activity/pre.inc.php
* \ingroup projet
* \brief Fichier de gestion du menu gauche du module projet
* \version $Id$
*/
require ("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
@@ -39,25 +39,31 @@ $langs->load("companies");
*/
function llxHeader($head = "", $title="", $help_url='')
{
global $langs, $user;
global $langs, $user;
top_menu($head, $title);
top_menu($head, $title);
$menu = new Menu();
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);
left_menu($menu->liste, $help_url);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
left_menu($menu->liste, $help_url);
}
?>

View File

@@ -64,6 +64,10 @@ $form = new Form($db);
$projet = new Project($db);
$projet->fetch($_GET["id"],$_GET["ref"]);
$projet->societe->fetch($projet->societe->id);
if ($projet->user_resp_id > 0)
{
$result=$projet->fetch_user($projet->user_resp_id);
}
$head=project_prepare_head($projet);
dolibarr_fiche_head($head, 'element', $langs->trans("Project"));
@@ -75,13 +79,19 @@ print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($projet,'ref','',1,'ref','ref');
print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';
// Project leader
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
if ($projet->user->id) print $projet->user->getNomUrl(1);
else print $langs->trans('SharedProject');
print '</td></tr>';
print '</table>';
print '</div>';

View File

@@ -145,7 +145,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print_fiche_titre($langs->trans("NewProject"));
if ($mesg) print $mesg.'<br>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
//if ($_REQUEST["socid"]) print '<input type="hidden" name="socid" value="'.$_REQUEST["socid"].'">';
print '<table class="border" width="100%">';
@@ -165,7 +165,15 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
// Responsable du projet
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
$html->select_users($projet->user_resp_id,'officer_project',1);
if ($_REQUEST["mode"] != 'mine')
{
$html->select_users($projet->user_resp_id,'officer_project',1);
}
else
{
print $user->getNomUrl(1);
print '<input type="hidden" name="officer_project" value="'.$user->id.'">';
}
print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
@@ -180,10 +188,14 @@ else
*/
if ($mesg) print $mesg;
$projet = new Project($db);
$projet->fetch($_GET["id"],$_GET["ref"]);
$projet->societe->fetch($projet->societe->id);
if ($projet->user_resp_id > 0)
{
$result=$projet->fetch_user($projet->user_resp_id);
}
$head=project_prepare_head($projet);
dolibarr_fiche_head($head, 'project', $langs->trans("Project"));
@@ -224,31 +236,26 @@ else
}
else
{
if ($projet->user_resp_id > 0)
{
$result=$projet->fetch_user($projet->user_resp_id);
}
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($projet,'ref','',1,'ref','ref');
print '</td></tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
// Third party
print '<tr><td>'.$langs->trans("Company").'</td><td>';
if ($projet->societe->id > 0) print $projet->societe->getNomUrl(1);
else print'&nbsp;';
print '</td></tr>';
// Project leader
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
if ($projet->user->id) print $projet->user->getNomUrl(1);
else print '&nbsp;';
else print $langs->trans('SharedProject');
print '</td></tr>';
print '</table>';

View File

@@ -31,7 +31,7 @@ $langs->load("projects");
if (!$user->rights->projet->lire) accessforbidden();
// Security check
if ($user->societe_id > 0)
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
}
@@ -43,19 +43,16 @@ if ($user->societe_id > 0)
llxHeader("",$langs->trans("Projects"),"Projet");
print_fiche_titre($langs->trans("ProjectsArea"));
$text=$langs->trans("Projects");
if ($_REQUEST["mode"]=='mine') $text=$langs->trans("MyProjects");
print_fiche_titre($text);
print '<table border="0" width="100%" class="notopnoleftnoright">';
print '<tr><td width="30%" valign="top" class="notopnoleft">';
/*
*
* Affichage de la liste des projets
*
*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Project"),"index.php","s.nom","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Project"),"index.php","","","","",$sortfield,$sortorder);
print '<td align="right">'.$langs->trans("NbOpenTasks").'</td>';
print "</tr>\n";
@@ -67,10 +64,11 @@ $sql.= " ".MAIN_DB_PREFIX."projet as p";
//$sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; // pourquoi est-ce que c'<27>tait en commentaire ? => Si on laisse ce lien, les projet sans taches se retrouvent invisibles
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet";
$sql.= " WHERE 1 = 1";
if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
{
$sql .= " AND p.fk_soc = ".$socid;
{
$sql .= " AND p.fk_soc = ".$socid;
}
$sql.= " GROUP BY p.rowid";
@@ -78,36 +76,32 @@ $var=true;
$resql = $db->query($sql);
if ( $resql )
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row( $resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$row[1].'">'.img_object($langs->trans("ShowProject"),"project")." ".$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
while ($i < $num)
{
$row = $db->fetch_row( $resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/projet/fiche.php?id='.$row[1].'">'.img_object($langs->trans("ShowProject"),"project")." ".$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print "</table>";
print '</td><td width="70%" valign="top" class="notopnoleft">';
/*
*
* Affichage de la liste des projets
*
*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","","",$sortfield,$sortorder);
@@ -119,10 +113,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.f
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."projet as p";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE p.fk_soc = s.rowid";
if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
{
$sql .= " AND s.rowid = ".$socid;
{
$sql .= " AND s.rowid = ".$socid;
}
$sql .= " GROUP BY s.nom";
//$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset);
@@ -131,26 +126,26 @@ $var=true;
$resql = $db->query($sql);
if ( $resql )
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row( $resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$row[1].'">'.img_object($langs->trans("ShowCompany"),"company")." ".$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
while ($i < $num)
{
$row = $db->fetch_row( $resql);
$var=!$var;
print "<tr $bc[$var]>";
print '<td nowrap="nowrap"><a href="'.DOL_URL_ROOT.'/projet/liste.php?socid='.$row[1].'">'.img_object($langs->trans("ShowCompany"),"company")." ".$row[0].'</a></td>';
print '<td align="right">'.$row[2].'</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print "</table>";
@@ -158,5 +153,5 @@ print '</td></tr></table>';
$db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>");
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Bariley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
*
@@ -20,11 +20,11 @@
*/
/**
\file htdocs/projet/liste.php
\ingroup projet
\brief Page liste des projets
\version $Id$
*/
* \file htdocs/projet/liste.php
* \ingroup projet
* \brief Page liste des projets
* \version $Id$
*/
require("./pre.inc.php");
@@ -39,9 +39,9 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
$title .= ' (<a href="liste.php">'.$soc->nom.'</a>)';
$soc = new Societe($db);
$soc->fetch($socid);
$title .= ' (<a href="liste.php">'.$soc->nom.'</a>)';
}
@@ -65,31 +65,34 @@ $pagenext = $page + 1;
llxHeader();
$projectstatic = new Project($db);
$userstatic = new User($db);
$staticsoc=new Societe($db);
$sql = "SELECT p.rowid as projectid, p.ref, p.title, ".$db->pdate("p.dateo")." as do";
$sql .= ", s.nom, s.rowid as socid, s.client";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, ".$db->pdate("p.dateo")." as do, p.fk_user_resp,";
$sql .= " s.nom, s.rowid as socid, s.client";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql .= " FROM (".MAIN_DB_PREFIX."projet as p";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ") LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = p.fk_soc";
$sql .= " WHERE 1 = 1 ";
if ($_REQUEST["mode"]=='mine') $sql.=' AND p.fk_user_resp='.$user->id;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid)
{
$sql .= " AND s.rowid = ".$socid;
$sql .= " AND s.rowid = ".$socid;
}
if ($_GET["search_ref"])
{
$sql .= " AND p.ref LIKE '%".addslashes($_GET["search_ref"])."%'";
$sql .= " AND p.ref LIKE '%".addslashes($_GET["search_ref"])."%'";
}
if ($_GET["search_label"])
{
$sql .= " AND p.title LIKE '%".addslashes($_GET["search_label"])."%'";
$sql .= " AND p.title LIKE '%".addslashes($_GET["search_label"])."%'";
}
if ($_GET["search_societe"])
{
$sql .= " AND s.nom LIKE '%".addslashes($_GET["search_societe"])."%'";
$sql .= " AND s.nom LIKE '%".addslashes($_GET["search_societe"])."%'";
}
$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
@@ -97,67 +100,88 @@ $var=true;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans("ProjectsList"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
$text=$langs->trans("Projects");
if ($_REQUEST["mode"]=='mine') $text=$langs->trans('MyProjects');
print_barre_liste($text, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"liste.php","p.ref","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),"liste.php","p.title","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom","","","",$sortfield,$sortorder);
print '<td>&nbsp;</td>';
print "</tr>\n";
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),"liste.php","p.ref","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),"liste.php","p.title","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OfficerProject"),"liste.php","","","","",$sortfield,$sortorder);
print '<td>&nbsp;</td>';
print "</tr>\n";
print '<form method="get" action="liste.php">';
print '<tr class="liste_titre">';
print '<td valign="right">';
print '<input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'">';
print '</td>';
print '<td valign="right">';
print '<input type="text" class="flat" name="search_label" value="'.$_GET["search_label"].'">';
print '</td>';
print '<td valign="right">';
print '<input type="text" class="flat" name="search_societe" value="'.$_GET["search_societe"].'">';
print '</td>';
print '<td class="liste_titre" align="center"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print "</td>";
print "</tr>\n";
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
print "<td><a href=\"fiche.php?id=$objp->projectid\">".img_object($langs->trans("ShowProject"),"project")." ".$objp->ref."</a></td>\n";
print "<td><a href=\"fiche.php?id=$objp->projectid\">".$objp->title."</a></td>\n";
// Company
print '<td>';
if ($objp->socid)
{
$staticsoc->id=$objp->socid;
$staticsoc->nom=$objp->nom;
print $staticsoc->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '<form method="get" action="liste.php">';
print '<tr class="liste_titre">';
print '<td valign="right">';
print '<input type="text" class="flat" name="search_ref" value="'.$_GET["search_ref"].'" size="6">';
print '</td>';
print '<td valign="right">';
print '<input type="text" class="flat" name="search_label" value="'.$_GET["search_label"].'">';
print '</td>';
print '<td valign="right">';
print '<input type="text" class="flat" name="search_societe" value="'.$_GET["search_societe"].'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print "</td>";
print "</tr>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr $bc[$var]>";
$i++;
}
print "<td>";
$projectstatic->id=$objp->projectid;
$projectstatic->ref=$objp->ref;
print $projectstatic->getNomUrl(1);
print "</td>";
$db->free($resql);
// Title
print '<td>';
print dolibarr_trunc($objp->title,24);
print '</td>';
// Company
print '<td>';
if ($objp->socid)
{
$staticsoc->id=$objp->socid;
$staticsoc->nom=$objp->nom;
print $staticsoc->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Title
$userstatic->id=$objp->fk_user_resp;
$userstatic->nom=$objp->fk_user_resp;
print '<td align="left">';
if ($objp->fk_user_resp > 0) print $userstatic->getNomUrl(1);
else print $langs->trans("SharedProject");
print '</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
dolibarr_print_error($db);
}
print "</table>";
@@ -166,5 +190,4 @@ $db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -18,11 +18,11 @@
*/
/**
\file htdocs/projet/pre.inc.php
\ingroup projet
\brief Fichier de gestion du menu gauche du module projet
\version $Id$
*/
* \file htdocs/projet/pre.inc.php
* \ingroup projet
* \brief Fichier de gestion du menu gauche du module projet
* \version $Id$
*/
require ("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
@@ -42,24 +42,31 @@ $langs->load("commercial");
*/
function llxHeader($head = "", $title="", $help_url='')
{
global $langs, $user;
global $langs, $user;
top_menu($head, $title);
top_menu($head, $title);
$menu = new Menu();
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);
left_menu($menu->liste, $help_url);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
left_menu($menu->liste, $help_url);
}
?>

View File

@@ -27,6 +27,8 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
$projetid='';
$projetid=isset($_REQUEST["id"])?$_REQUEST["id"]:$_POST["projetid"];
@@ -61,7 +63,7 @@ if ($_POST["action"] == 'createtask' && empty($_POST["cancel"]) && $user->rights
$project = new Project($db);
$result = $project->fetch($projectid);
$result=$project->CreateTask($user, $_POST["task_name"], $task_parent);
$result=$project->CreateTask($user, $_POST["task_name"], $task_parent, $_POST["userid"]);
}
if (! $error)
@@ -115,6 +117,7 @@ if ($_POST["action"] == 'addtime' && $user->rights->projet->creer)
*/
$form=new Form($db);
$htmlother=new FormOther($db);
llxHeader("",$langs->trans("Tasks"),"Tasks");
@@ -125,15 +128,14 @@ $ref= $_GET['ref'];
if ($id > 0 || ! empty($ref))
{
$projet->fetch($_REQUEST["id"],$_GET["ref"]);
$projet->societe->fetch($projet->societe->id);
if ($projet->societe->id > 0) $result=$projet->societe->fetch($projet->societe->id);
if ($projet->user_resp_id > 0) $result=$projet->fetch_user($projet->user_resp_id);
}
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
{
print_fiche_titre($langs->trans("NewTask"));
$tasksarray=$projet->getTasksArray();
if ($mesg) print '<div class="error">'.$mesg.'</div>';
print '<form action="fiche.php" method="post">';
@@ -143,22 +145,19 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '<table class="border" width="100%">';
print '<tr><td>'.$langs->trans("NewTask").'</td><td colspan="3">';
print '<input type="text" size="25" name="task_name" class="flat">&nbsp;';
if ($tasksarray)
{
print ' &nbsp; '.$langs->trans("ChildOfTaks").' &nbsp; ';
print '<select class="flat" name="task_parent">';
print '<option value="0" selected="true">&nbsp;</option>';
$j=0;
$level=0;
PLineSelect($j, 0, $tasksarray, $level);
print '</select>';
}
print '<tr><td>'.$langs->trans("NewTask").'</td><td>';
print '<input type="text" size="25" name="task_name" class="flat">';
print '</td></tr>';
print '<tr><td colspan="4" align="center">';
print '<tr><td>'.$langs->trans("ChildOfTaks").'</td><td>';
print $htmlother->selectProjectTasks($projet->id, 'task_parent', 1, 0);
print '</td></tr>';
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
print $form->select_users($user->id,'userid',1);
print '</td></tr>';
print '<tr><td colspan="2" align="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
@@ -194,14 +193,18 @@ else
print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
print '<td>'.$langs->trans("Company").'</td><td>';
print '<tr><td>'.$langs->trans("Company").'</td><td>';
if (! empty($projet->societe->id)) print $projet->societe->getNomUrl(1);
else print '&nbsp;';
print '</td>';
//print '<td>&nbsp;</td>';
print '</tr>';
$tasksarray=$projet->getTasksArray($_REQUEST["mode"]=='mine'?$user:0);
// Project leader
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
if ($projet->user->id) print $projet->user->getNomUrl(1);
else print $langs->trans('SharedProject');
print '</td></tr>';
print '</table>';
@@ -211,6 +214,9 @@ else
print '</div>';
$tasksarray=$projet->getTasksArray($_REQUEST["mode"]=='mine'?$user:0, 0);
/*
* Actions
*/
@@ -218,7 +224,14 @@ else
if ($user->rights->projet->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&action=create'.$param.'">'.$langs->trans('AddTask').'</a>';
if (empty($projet->user_resp_id) || $projet->user_resp_id == -1 || $projet->user_resp_id == $user->id)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$projet->id.'&action=create'.$param.'">'.$langs->trans('AddTask').'</a>';
}
else
{
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('AddTask').'</a>';
}
}
print '</div>';
@@ -226,136 +239,23 @@ else
print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Project").'</td>';
if ($projectstatic->id) print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$langs->trans("RefTask").'</td>';
print '<td>'.$langs->trans("LabelTask").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print "</tr>\n";
$j=0;
PLines($j, 0, $tasksarray, $level, true);
$nboftaskshown=PLines($j, 0, $tasksarray, $level, true, 0);
print "</table>";
print '</div>';
if ($nboftaskshown < sizeof($tasksarray))
{
clean_orphelins($db);
}
}
$db->close();
llxFooter('$Date$ - $Revision$');
// TODO Same function PLines than in fiche.php
function PLines(&$inc, $parent, $lines, &$level, $var)
{
global $user, $bc, $langs;
$lastprojectid=0;
$projectstatic = new Project($db);
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_parent == $parent)
{
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
{
$var = !$var;
$lastprojectid=$lines[$i]->projectid;
}
print "<tr $bc[$var]>\n";
print "<td>";
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->ref=$lines[$i]->projectref;
print $projectstatic->getNomUrl(1);
print "</td>";
print "<td>".$lines[$i]->id."</td>";
print "<td>";
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print '<a href="task.php?id='.$lines[$i]->id.'">'.$lines[$i]->title."</a></td>\n";
$heure = intval($lines[$i]->duration);
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
$minutes = substr("00"."$minutes", -2);
print '<td align="right">'.$heure."&nbsp;h&nbsp;".$minutes."</td>\n";
print "</tr>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $var);
$level--;
}
else
{
//$level--;
}
}
}
/**
* Enter description here...
*
* @param unknown_type $inc
* @param unknown_type $parent
* @param unknown_type $lines
* @param unknown_type $level
*/
function PLineSelect(&$inc, $parent, $lines, &$level)
{
global $langs;
$lastprojectid=0;
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_parent == $parent)
{
$var = !$var;
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
{
print '<option value="'.$lines[$i]->projectid.'_0">';
print $langs->trans("Project").' '.$lines[$i]->projectref;
//print '-'.$parent.'-'.$lines[$i]->projectid.'-'.$lastprojectid;
print "</option>\n";
$lastprojectid=$lines[$i]->projectid;
$inc++;
}
print '<option value="'.$lines[$i]->projectid.'_'.$lines[$i]->id.'">';
print $langs->trans("Project").' '.$lines[$i]->projectref;
if ($lines[$i]->id) print ' > ';
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print $lines[$i]->title."</option>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLineSelect($inc, $lines[$i]->id, $lines, $level);
$level--;
}
}
}
?>

View File

@@ -25,6 +25,7 @@
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
$mode=$_REQUEST["mode"];
@@ -86,7 +87,7 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Project").'</td>';
print '<td>'.$langs->trans("Task").'</td>';
print '<td>&nbsp;</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
print "</tr>\n";
@@ -110,67 +111,4 @@ print '</div>';
$db->close();
llxFooter('$Date$ - $Revision$');
// TODO Same function PLines than in fiche.php
function PLines(&$inc, $parent, $lines, &$level, $var)
{
global $user, $bc, $langs;
$lastprojectid=0;
$projectstatic = new Project($db);
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
if ($parent == 0) $level = 0;
if ($lines[$i]->fk_parent == $parent)
{
// Break on a new project
if ($parent == 0 && $lines[$i]->projectid != $lastprojectid)
{
$var = !$var;
$lastprojectid=$lines[$i]->projectid;
}
print "<tr $bc[$var]>\n";
print "<td>";
$projectstatic->id=$lines[$i]->projectid;
$projectstatic->ref=$lines[$i]->projectref;
print $projectstatic->getNomUrl(1);
print "</td>";
print "<td>".$lines[$i]->id."</td>";
print "<td>";
for ($k = 0 ; $k < $level ; $k++)
{
print "&nbsp;&nbsp;&nbsp;";
}
print '<a href="task.php?id='.$lines[$i]->id.'">'.$lines[$i]->title."</a></td>\n";
$heure = intval($lines[$i]->duration);
$minutes = round((($lines[$i]->duration - $heure) * 60),0);
$minutes = substr("00"."$minutes", -2);
print '<td align="right">'.$heure."&nbsp;h&nbsp;".$minutes."</td>\n";
print "</tr>\n";
$inc++;
$level++;
if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $var);
$level--;
}
else
{
//$level--;
}
}
}
?>

View File

@@ -17,11 +17,11 @@
*/
/**
\file htdocs/projet/tasks/pre.inc.php
\ingroup projet
\brief Fichier de gestion du menu gauche du module projet
\version $Id$
*/
* \file htdocs/projet/tasks/pre.inc.php
* \ingroup projet
* \brief Fichier de gestion du menu gauche du module projet
* \version $Id$
*/
require ("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
require_once(DOL_DOCUMENT_ROOT."/task.class.php");
@@ -38,25 +38,32 @@ $langs->load("companies");
*/
function llxHeader($head = "", $title="", $help_url='')
{
global $langs, $user;
global $langs, $user;
top_menu($head, $title);
top_menu($head, $title);
$menu = new Menu();
$menu = new Menu();
$menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects", $langs->trans("Projects"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("Tasks"), 0, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/index.php?leftmenu=projects&mode=mine", $langs->trans("MyProjects"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/fiche.php?leftmenu=projects&action=create&mode=mine", $langs->trans("NewProject"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/liste.php?leftmenu=projects&mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("MyTasks"), 1, $user->rights->projet->lire);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php", $langs->trans("TimeSpent"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyTimeSpent"), 1, $user->rights->projet->lire);
left_menu($menu->liste, $help_url);
$menu->add(DOL_URL_ROOT."/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/fiche.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$menu->add_submenu(DOL_URL_ROOT."/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
$menu->add_submenu(DOL_URL_ROOT."/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
left_menu($menu->liste, $help_url);
}
?>

View File

@@ -84,22 +84,18 @@ if ($_GET["id"] > 0)
$result=$projet->fetch($task->fk_projet);
if (! empty($projet->socid)) $projet->societe->fetch($projet->socid);
$h=0;
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/task.php?id='.$task->id;
$head[$h][1] = $langs->trans("Tasks");
$head[$h][2] = 'tasks';
$h++;
$head=task_prepare_head($task);
dolibarr_fiche_head($head, 'tasks', $langs->trans("Tasks"));
dolibarr_fiche_head($head, 'tasks', $langs->trans("Task"));
if ($mesg) print $mesg.'<br>';
if ($_GET["action"] == 'delete')
{
$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"],$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete");
print "<br>";
}
print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
print '<input type="hidden" name="action" value="createtask">';
print '<table class="border" width="100%">';
@@ -148,19 +144,19 @@ if ($_GET["id"] > 0)
print '</table></form>';
print '</div>';
/*
* Actions
*/
print '<div class="tabsAction">';
if ($user->rights->projet->creer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}
print '</div>';
print '</div>';
print '<br>';
print '<input type="hidden" name="action" value="addtime">';
print '<table class="noborder" width="100%">';
@@ -183,7 +179,7 @@ if ($_GET["id"] > 0)
}
print "</table>";
}
}

161
htdocs/projet/tasks/who.php Normal file
View File

@@ -0,0 +1,161 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/projet/tasks/task.php
* \ingroup projet
* \brief Fiche t<>ches d'un projet
* \version $Id$
*/
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
if (!$user->rights->projet->lire) accessforbidden();
/*
* Actions
*/
/*
* View
*/
llxHeader("",$langs->trans("Task"));
$html = new Form($db);
$projectstatic = new Project($db);
$userstatic = new User($db);
if ($_GET["id"] > 0)
{
/*
* Fiche projet en mode visu
*
*/
$task = new Task($db);
if ($task->fetch($_GET["id"]) >= 0 )
{
$projet = new Project($db);
$result=$projet->fetch($task->fk_projet);
if (! empty($projet->socid)) $projet->societe->fetch($projet->socid);
$head=task_prepare_head($task);
dolibarr_fiche_head($head, 'who', $langs->trans("Task"));
if ($mesg) print $mesg.'<br>';
print '<form method="POST" action="fiche.php?id='.$projet->id.'">';
print '<input type="hidden" name="action" value="createtask">';
print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$task->id.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->title.'</td></tr>';
print '<tr><td>'.$langs->trans("Project").'</td><td>';
print $projet->getNomUrl(1);
print '</td></tr>';
print '<td>'.$langs->trans("Company").'</td><td>';
if ($projet->societe->id) print $projet->societe->getNomUrl(1);
else print '&nbsp;';
print '</td></tr>';
/* Liste des affectations */
$sql = "SELECT t.title, t.duration_effective, t.fk_task_parent, t.statut,";
$sql.= " u.login, u.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t,";
$sql.= " ".MAIN_DB_PREFIX."projet_task_actors as ta,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE t.rowid =".$task->id;
$sql.= " AND t.rowid = ta.fk_projet_task AND ta.fk_user = u.rowid";
$lines=array();
$var=true;
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$tasks = array();
while ($i < $num)
{
$row = $db->fetch_object($resql);
$lines[$i] = $row;
$i++;
}
$db->free($resql);
}
else
{
dolibarr_print_error($db);
}
print '</table></form>';
print '</div>';
/*
* Actions
*/
print '<div class="tabsAction">';
/*if ($user->rights->projet->creer)
{
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
}*/
print '</div>';
print '<br>';
print '<input type="hidden" name="action" value="addtime">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td align="left">'.$langs->trans("User").'</td>';
print "</tr>\n";
foreach ($lines as $xxx)
{
$var=!$var;
print "<tr ".$bc[$var].">";
$userstatic->id=$xxx->rowid;
$userstatic->nom=$xxx->login;
print '<td align="left">'.$userstatic->getNomUrl(1).'</td>';
print "</tr>\n";
}
print "</table>";
}
}
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -831,7 +831,7 @@ class Propal extends CommonObject
else
{
$this->error=$this->db->error();
dolibarr_syslog("Propal::Fetch Error ".$this->error, LOG_ERROR);
dolibarr_syslog("Propal::Fetch Error ".$this->error, LOG_ERR);
return -1;
}

View File

@@ -451,7 +451,7 @@ insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titr
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3601, 'project', '', 3600, '/comm/clients.php?leftmenu=projects', 'NewProject', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3602, 'project', '', 3600, '/projet/liste.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 1);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3700, 'project', '', 7, '/projet/tasks', 'Tasks', 0, 'projects', '$user->rights->projet->lire', '', 2, 1);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3701, 'project', '', 3700, '/projet/tasks/mytasks.php', 'Mytasks', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3701, 'project', '', 3700, '/projet/tasks/mytasks.php', 'MyTasks', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3800, 'project', '', 7, '/projet/activity', 'Activity', 0, 'projects', '$user->rights->projet->lire', '', 2, 2);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3801, 'project', '', 3800, '/projet/activity/myactivity.php', 'MyActivity', 1, 'projects', '$user->rights->projet->lire', '', 2, 0);
insert into `llx_menu` (`rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, `right`, `target`, `user`, `order`) values (3900, 'tools', '', 8, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0);