From 71352d4143ad92ea14a19fff18ff314a9bf5a69e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jan 2008 08:14:20 +0000 Subject: [PATCH] Ajout d'un module agenda et de permissions sur les actions --- htdocs/comm/action/fiche.php | 24 +- htdocs/comm/fiche.php | 541 +++++++++--------- htdocs/comm/propal.php | 81 +-- htdocs/comm/prospect/fiche.php | 54 +- htdocs/comm/prospect/index.php | 91 +-- htdocs/commande/fiche.php | 83 +-- htdocs/compta/facture.php | 78 +-- htdocs/compta/fiche.php | 525 +++++++++-------- htdocs/compta/propal.php | 24 +- htdocs/conf/conf.class.php | 3 + htdocs/contact/index.php | 26 +- htdocs/fourn/fiche.php | 458 +++++++-------- htdocs/includes/boxes/box_actions.php | 2 +- .../menus/barre_left/eldy_backoffice.php | 36 +- .../menus/barre_left/eldy_frontoffice.php | 35 +- .../menus/barre_top/eldy_backoffice.php | 42 +- .../menus/barre_top/eldy_frontoffice.php | 20 +- htdocs/includes/modules/modAgenda.class.php | 209 +++++++ htdocs/user.class.php | 8 +- htdocs/user/perms.php | 6 +- 20 files changed, 1352 insertions(+), 994 deletions(-) create mode 100644 htdocs/includes/modules/modAgenda.class.php diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 0e72f046738..f96e0618e2a 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -39,7 +39,7 @@ $langs->load("other"); $langs->load("bills"); $langs->load("orders"); -// Sécurité accés client +// Securite acces client if ($user->societe_id > 0) { $action = ''; @@ -49,7 +49,7 @@ if (isset($_GET["error"])) $error=$_GET["error"]; /* - * Action création de l'action + * Action creation de l'action * */ if ($_POST["action"] == 'add_action') @@ -163,7 +163,7 @@ if ($_POST["action"] == 'add_action') if ($_POST["add_webcal"] == 'on' && $conf->webcal->enabled) $actioncomm->use_webcal=1; if ($_POST["add_phenix"] == 'on' && $conf->phenix->enabled) $actioncomm->use_phenix=1; - // On crée l'action + // On cr�e l'action $idaction=$actioncomm->add($user); if ($idaction > 0) @@ -226,7 +226,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') } /* - * Action mise à jour de l'action + * Action mise � jour de l'action * */ if ($_POST["action"] == 'update') @@ -286,7 +286,7 @@ $html = new Form($db); /* ************************************************************************** */ /* */ -/* Affichage fiche en mode création */ +/* Affichage fiche en mode cr�ation */ /* */ /* ************************************************************************** */ @@ -337,7 +337,7 @@ if ($_GET["action"] == 'create') } print ''; - // Si la societe est imposée, on propose ces contacts + // Si la societe est impos�e, on propose ces contacts if ($_REQUEST["socid"]) { $contactid = $_REQUEST["contactid"]?$_REQUEST["contactid"]:''; @@ -471,7 +471,7 @@ if ($_GET["action"] == 'create') } print ''; - // Si la societe est imposée, on propose ces contacts + // Si la societe est impos�e, on propose ces contacts if ($_REQUEST["socid"]) { print ''.$langs->trans("ActionOnContact").''; @@ -573,7 +573,7 @@ if ($_GET["id"]) $act = new ActionComm($db); $act->fetch($_GET["id"]); $res=$act->societe->fetch($act->societe->id); - $res=$act->author->fetch(); // Le paramètre est le login, hors seul l'id est chargé. + $res=$act->author->fetch(); // Le param�tre est le login, hors seul l'id est charg�. $res=$act->contact->fetch($act->contact->id); /* @@ -654,7 +654,7 @@ if ($_GET["id"]) // Etat print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").'%'; - // Objet lié + // Objet li� if ($act->objet_url) { print ''.$langs->trans("LinkedObject").''; @@ -741,7 +741,7 @@ if ($_GET["id"]) print $act->getLibStatut(4); print ''; - // Objet lié + // Objet li� if ($act->objet_url) { print ''.$langs->trans("LinkedObject").''; @@ -784,14 +784,14 @@ llxFooter('$Date$ - $Revision$'); /** \brief Ajoute une ligne de tableau a 2 colonnes pour avoir l'option synchro calendrier - \return int Retourne le nombre de lignes ajoutées + \return int Retourne le nombre de lignes ajout�es */ function add_row_for_calendar_link() { global $conf,$langs,$user; $nbtr=0; - // Lien avec calendrier si module activé + // Lien avec calendrier si module activ� if ($conf->webcal->enabled) { if ($conf->global->PHPWEBCALENDAR_SYNCRO != 'never') diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index f139d3faf05..e815ca8438d 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2005-2007 Regis Houssin @@ -46,7 +46,7 @@ if ($conf->fichinter->enabled) $langs->load("interventions"); $socid = isset($_GET["socid"])?$_GET["socid"]:''; -// Sécurité d'accès client et commerciaux +// S�curit� d'acc�s client et commerciaux $socid = restrictedArea($user, 'societe', $socid); $sortorder=$_GET["sortorder"]; @@ -64,7 +64,7 @@ if ($_GET["action"] == 'attribute_prefix' && $user->rights->societe->creer) $societe = new Societe($db, $_GET["socid"]); $societe->attribute_prefix($db, $_GET["socid"]); } -// conditions de règlement +// conditions de r�glement if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer) { @@ -75,7 +75,7 @@ if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer) $result = $db->query($sql); if (! $result) dolibarr_print_error($result); } -// mode de règlement +// mode de r�glement if ($_POST["action"] == 'setmode' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); @@ -85,7 +85,7 @@ if ($_POST["action"] == 'setmode' && $user->rights->societe->creer) $result = $db->query($sql); if (! $result) dolibarr_print_error($result); } -// assujétissement à la TVA +// assuj�tissement � la TVA if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); @@ -192,14 +192,14 @@ if ($socid > 0) print ''.$langs->trans("Web")."url\" target=\"_blank\">".$objsoc->url." "; - // Assujeti à TVA ou pas + // Assujeti � TVA ou pas print ''; print ''.$langs->trans('VATIsUsed').''; print yn($objsoc->tva_assuj); print ''; print ''; - // Conditions de réglement par défaut + // Conditions de r�glement par d�faut $langs->load('bills'); $html = new Form($db); print ''; @@ -220,7 +220,7 @@ if ($socid > 0) print ""; print ''; - // Mode de règlement + // Mode de r�glement print ''; print '"; print ''; - // Réductions relative (Remises-Ristournes-Rabbais) + // R�ductions relative (Remises-Ristournes-Rabbais) print '
'; print $langs->trans('PaymentMode'); @@ -239,7 +239,7 @@ if ($socid > 0) print "
'; print ''; print ''; - // Réductions absolues (Remises-Ristournes-Rabbais) + // R�ductions absolues (Remises-Ristournes-Rabbais) print '
'; print $langs->trans("CustomerRelativeDiscountShort"); @@ -252,7 +252,7 @@ if ($socid > 0) print ''.($objsoc->remise_client?$objsoc->remise_client.'%':$langs->trans("DiscountNone")).'
'; print ''; print ''; print ''; print ""; - print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + } print ""; $sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note "; @@ -670,7 +676,7 @@ if ($socid > 0) { print ''; - print ''; - print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print dolibarr_print_phone($obj->phone); + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; + print ''; + print ''; print ''; - print ''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + } + print "\n"; $i++; } @@ -701,270 +727,245 @@ if ($socid > 0) /* * Listes des actions a faire - * */ - print_titre($langs->trans("ActionsOnCompany")); - - print '
'; @@ -329,7 +329,7 @@ if ($socid > 0) print ''; - // Nbre max d'éléments des petites listes + // Nbre max d'�l�ments des petites listes $MAXLIST=4; // Lien recap @@ -536,7 +536,7 @@ if ($socid > 0) } /* - * Derniers projets associés + * Derniers projets associ�s */ if ($conf->projet->enabled) { @@ -609,8 +609,11 @@ if ($socid > 0) print ''.$langs->trans("AddIntervention").''; } - print ''.$langs->trans("AddAction").''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + if ($user->rights->societe->contact->creer) { print ''.$langs->trans("AddContact").''; @@ -636,7 +639,10 @@ if ($socid > 0) print ''.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'   
'; print ''; - print img_phone_out("Appel émis") ; + print img_phone_out("Appel emis") ; print ''; } else @@ -678,19 +684,39 @@ if ($socid > 0) print ''; } - print ''.dolibarr_print_phone($obj->phone).' '.dolibarr_print_phone($obj->fax).' '.$obj->email.' '; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print dolibarr_print_phone($obj->fax); + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->email; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; print "rowid."\">"; print img_edit(); print ''; - print img_object($langs->trans("Rendez-Vous"),"action"); - print ''; + print img_object($langs->trans("Rendez-Vous"),"action"); + print '
'; - print ''; - print ''; - print ''; - - $sql = "SELECT a.id, a.label,"; - $sql.= " ".$db->pdate("a.datep")." as dp,"; - $sql.= " ".$db->pdate("a.datea")." as da,"; - $sql.= " a.percent,"; - $sql.= " c.code as acode, c.libelle, a.propalrowid, a.fk_user_author, a.fk_contact,"; - $sql.= " u.login, u.rowid,"; - $sql.= " sp.name, sp.firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - $sql.= " WHERE a.fk_soc = ".$objsoc->id; - $sql.= " AND u.rowid = a.fk_user_author"; - $sql.= " AND c.id=a.fk_action AND a.percent < 100"; - $sql.= " ORDER BY a.datep DESC, a.id DESC"; - - dolibarr_syslog("comm/fiche.php sql=".$sql); - $result=$db->query($sql); - if ($result) + if ($conf->agenda->enabled) { - $i = 0 ; - $num = $db->num_rows($result); - $var=true; - - if ($num) - { - while ($i < $num) - { - $var = !$var; - - $obj = $db->fetch_object($result); - print ""; - - if ($oldyear == strftime("%Y",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { + print_titre($langs->trans("ActionsOnCompany")); + + print '
'.$langs->trans("ActionsToDoShort").' 
|
'; + print ''; + print ''; + print ''; + + $sql = "SELECT a.id, a.label,"; + $sql.= " ".$db->pdate("a.datep")." as dp,"; + $sql.= " ".$db->pdate("a.datea")." as da,"; + $sql.= " a.percent,"; + $sql.= " c.code as acode, c.libelle, a.propalrowid, a.fk_user_author, a.fk_contact,"; + $sql.= " u.login, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$objsoc->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent < 100"; + $sql.= " ORDER BY a.datep DESC, a.id DESC"; + + dolibarr_syslog("comm/fiche.php sql=".$sql); + $result=$db->query($sql); + if ($result) + { + $i = 0 ; + $num = $db->num_rows($result); + $var=true; + + if ($num) + { + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + print '\n"; $oldyear = strftime("%Y",$obj->dp); - } - - if ($oldmonth == strftime("%Y%b",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { + print '\n"; $oldmonth = strftime("%Y%b",$obj->dp); - } - - print '\n"; - print ''; - - // Picto warning - print ''; - - // Status/Percent - print ''; - - if ($obj->propalrowid) - { - print ''; - } - else - { - $actionstatic->code=$obj->acode; - $actionstatic->libelle=$obj->libelle; - $actionstatic->id=$obj->id; - print ''; - } - print ''; - - // Contact pour cette action - if ($obj->fk_contact > 0) - { - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print ''; - } - else - { - print ''; - } - - print ''; - - // Statut - print ''; - - print "\n"; - $i++; - } - } - else - { - // Aucun action à faire - - } - $db->free($result); + + print '\n"; + print ''; + + // Picto warning + print ''; + + // Status/Percent + print ''; + + if ($obj->propalrowid) + { + print ''; + } + else + { + $actionstatic->code=$obj->acode; + $actionstatic->libelle=$obj->libelle; + $actionstatic->id=$obj->id; + print ''; + } + print ''; + + // Contact pour cette action + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } + + print ''; + + // Statut + print ''; + + print "\n"; + $i++; + } + } + else + { + // Aucun action a faire + + } + $db->free($result); + } + else + { + dolibarr_print_error($db); + } + print "
'.$langs->trans("ActionsToDoShort").' 
'.strftime("%Y",$obj->dp)."|' .strftime("%b",$obj->dp)."'.strftime("%d",$obj->dp)."'.strftime("%H:%M",$obj->dp).''; - if (date("U",$obj->dp) < time()) print ' '.img_warning("Late"); - else print ' '; - print ' '.img_object($langs->trans("ShowAction"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''.$actionstatic->getNomUrl(1,16).''.$obj->label.''.$contactstatic->getNomUrl(1).' '; - $userstatic->id=$obj->fk_user_author; - $userstatic->login=$obj->login; - print $userstatic->getLoginUrl(1); - print ''.$actionstatic->LibStatut($obj->percent,3).'
'.strftime("%d",$obj->dp)."'.strftime("%H:%M",$obj->dp).''; + if (date("U",$obj->dp) < time()) print ' '.img_warning("Late"); + else print ' '; + print ' '.img_object($langs->trans("ShowAction"),"task"); + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; + print ''.$actionstatic->getNomUrl(1,16).''.$obj->label.''.$contactstatic->getNomUrl(1).' '; + $userstatic->id=$obj->fk_user_author; + $userstatic->login=$obj->login; + print $userstatic->getLoginUrl(1); + print ''.$actionstatic->LibStatut($obj->percent,3).'
"; + + print "
"; } - else - { - dolibarr_print_error($db); - } - print "
"; - - print "
"; - /* * Listes des actions effectuees */ - print ''; - print ''; - print ''; - print ''; - - $sql = "SELECT a.id, a.label,"; - $sql.= " ".$db->pdate("a.datep")." as dp,"; - $sql.= " ".$db->pdate("a.datea")." as da,"; - $sql.= " a.percent,"; - $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; - $sql.= " c.code as acode, c.libelle,"; - $sql.= " u.login, u.rowid,"; - $sql.= " sp.name, sp.firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - $sql.= " WHERE a.fk_soc = ".$objsoc->id; - $sql.= " AND u.rowid = a.fk_user_author"; - $sql.= " AND c.id=a.fk_action AND a.percent = 100"; - $sql.= " ORDER BY a.datea DESC, a.id DESC"; - - dolibarr_syslog("comm/fiche.php sql=".$sql); - $result=$db->query($sql); - if ($result) + if ($conf->agenda->enabled) { - $i = 0 ; - $num = $db->num_rows($result); - $oldyear=''; - $oldmonth=''; - $var=true; - - while ($i < $num) - { - $var = !$var; - - $obj = $db->fetch_object($result); - print ""; - - // Champ date - if ($oldyear == strftime("%Y",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { + print '
'.$langs->trans("ActionsDoneShort").'
|
'; + print ''; + print ''; + print ''; + + $sql = "SELECT a.id, a.label,"; + $sql.= " ".$db->pdate("a.datep")." as dp,"; + $sql.= " ".$db->pdate("a.datea")." as da,"; + $sql.= " a.percent,"; + $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; + $sql.= " c.code as acode, c.libelle,"; + $sql.= " u.login, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$objsoc->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent = 100"; + $sql.= " ORDER BY a.datea DESC, a.id DESC"; + + dolibarr_syslog("comm/fiche.php sql=".$sql); + $result=$db->query($sql); + if ($result) + { + $i = 0 ; + $num = $db->num_rows($result); + $oldyear=''; + $oldmonth=''; + $var=true; + + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + + // Champ date print '\n"; $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { print '\n"; $oldmonth = strftime("%Y%b",$obj->da); - } - print '\n"; - print '\n"; - - // Picto - print ''; - - // Espace - print ''; - - // Action - print ''; - - // Objet lié - print ''; - - // Libellé - print ''; - - // Contact pour cette action - if ($obj->fk_contact > 0) - { - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print ''; - } - else - { - print ''; - } - - // Auteur - print ''; - - // Statut - print ''; - - print "\n"; - $i++; - } - - $db->free($result); + print '\n"; + print '\n"; + + // Picto + print ''; + + // Espace + print ''; + + // Action + print ''; + + // Objet lie + print ''; + + // Libelle + print ''; + + // Contact pour cette action + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } + + // Auteur + print ''; + + // Statut + print ''; + + print "\n"; + $i++; + } + + $db->free($result); + } + else + { + dolibarr_print_error($db); + } + + print "
'.$langs->trans("ActionsDoneShort").'
'.strftime("%Y",$obj->da)."|'.strftime("%b",$obj->da)."'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."  '; - $actionstatic->code=$obj->acode; - $actionstatic->libelle=$obj->libelle; - $actionstatic->id=$obj->id; - print $actionstatic->getNomUrl(1,16); - print ''; - if ($obj->propalrowid) - { - print ''.img_object($langs->trans("ShowPropal"),"propal"); - print $langs->trans("Propal"); - print ''; - } - if ($obj->fk_facture) - { - $facturestatic->ref=$langs->trans("Invoice"); - $facturestatic->id=$obj->fk_facture; - $facturestatic->type=$obj->type; - print $facturestatic->getNomUrl(1,'compta'); - } - else print ' '; - print ''.$obj->label.''.$contactstatic->getNomUrl(1).' '; - $userstatic->id=$obj->rowid; - $userstatic->login=$obj->login; - print $userstatic->getLoginUrl(1); - print ''.$actionstatic->LibStatut($obj->percent,3).'
'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."  '; + $actionstatic->code=$obj->acode; + $actionstatic->libelle=$obj->libelle; + $actionstatic->id=$obj->id; + print $actionstatic->getNomUrl(1,16); + print ''; + if ($obj->propalrowid) + { + print ''.img_object($langs->trans("ShowPropal"),"propal"); + print $langs->trans("Propal"); + print ''; + } + if ($obj->fk_facture) + { + $facturestatic->ref=$langs->trans("Invoice"); + $facturestatic->id=$obj->fk_facture; + $facturestatic->type=$obj->type; + print $facturestatic->getNomUrl(1,'compta'); + } + else print ' '; + print ''.$obj->label.''.$contactstatic->getNomUrl(1).' '; + $userstatic->id=$obj->rowid; + $userstatic->login=$obj->login; + print $userstatic->getLoginUrl(1); + print ''.$actionstatic->LibStatut($obj->percent,3).'

"; } - else - { - dolibarr_print_error($db); - } - - print "

"; } else { diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 61263fb380f..273d614c993 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1701,51 +1701,54 @@ if ($_GET['propalid'] > 0) print ''; /* - * Liste des actions propres � la propal + * Liste des actions propres a la propal */ - $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; - $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; - $sql .= ' WHERE a.propalrowid = '.$propal->id ; - if ($socid) $sql .= ' AND a.fk_soc = '.$socid; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; + $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; + $sql .= ' WHERE a.propalrowid = '.$propal->id ; + if ($socid) $sql .= ' AND a.fk_soc = '.$socid; + $resql = $db->query($sql); + if ($resql) { - print_titre($langs->trans('ActionsOnPropal')); - $i = 0; - $total = 0; - $var=true; - - print ''; - print ''; - print "\n"; - - while ($i < $num) + $num = $db->num_rows($resql); + if ($num) { - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - print '\n"; - print ''; - $authoract = new User($db); - $authoract->id = $objp->fk_user_author; - $authoract->fetch(''); - print ''; - print "\n"; - $i++; + print_titre($langs->trans('ActionsOnPropal')); + $i = 0; + $total = 0; + $var=true; + + print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da)."'.stripslashes($objp->label).''.$authoract->login.'
'; + print ''; + print "\n"; + + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print '\n"; + print ''; + $authoract = new User($db); + $authoract->id = $objp->fk_user_author; + $authoract->fetch(''); + print ''; + print "\n"; + $i++; + } + print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da)."'.stripslashes($objp->label).''.$authoract->login.'
'; } - print ''; } - } - else - { - dolibarr_print_error($db); - } + else + { + dolibarr_print_error($db); + } + } - print ''; + print ''; /* diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 925f8adbaf9..9c0d7620f49 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -214,8 +214,10 @@ if ($socid > 0) print ''.$langs->trans("AddContact").''; - print ''.$langs->trans("AddAction").''; - + if ($conf->agenda->enabled) + { + print ''.$langs->trans("AddAction").''; + } if ($conf->propal->enabled && defined("MAIN_MODULE_PROPALE") && MAIN_MODULE_PROPALE && $user->rights->propale->creer) { @@ -249,7 +251,10 @@ if ($socid > 0) print ''.$langs->trans("Poste").''.$langs->trans("Tel").''; print ''.$langs->trans("Fax").''.$langs->trans("EMail").''; print " "; - print ' '; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ' '; + } print ""; $sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; @@ -276,18 +281,35 @@ if ($socid > 0) } print ''; print ''.$obj->poste.' '; - print ''.$obj->phone; - + + print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->phone; if (strlen($obj->phone) && $user->clicktodial_enabled == 1) { print ''; print img_phone_out("Appel émis") ; } - print ''; - - print ''.$obj->fax.' '; - print ''.$obj->email.' '; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ''; + + print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->fax; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; + print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->email; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; + print ''; if ($user->rights->societe->contact->creer) @@ -300,10 +322,14 @@ if ($socid > 0) print ''; - print ''; - print img_object($langs->trans("Rendez-Vous"),"action"); - print ''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + print ''; + print img_object($langs->trans("Rendez-Vous"),"action"); + print ''; + } + print "\n"; $i++; $tag = !$tag; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 17676bcffb0..a55ce6e0ee2 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -162,57 +162,60 @@ if ($conf->propal->enabled && $user->rights->propale->lire) */ print ''; -$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, a.fk_user_author, a.percent,"; -$sql.= " c.code, c.libelle,"; -$sql.= " s.nom as sname, s.rowid"; -if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; -$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " WHERE c.id = a.fk_action AND a.percent < 100 AND s.rowid = a.fk_soc AND a.fk_user_action = ".$user->id; -if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$sql .= " ORDER BY a.datea DESC"; - -$resql=$db->query($sql); -if ($resql) +if ($conf->agenda->enabled) { - $num = $db->num_rows($resql); - if ($num > 0) + $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, a.fk_user_author, a.percent,"; + $sql.= " c.code, c.libelle,"; + $sql.= " s.nom as sname, s.rowid"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= " WHERE c.id = a.fk_action AND a.percent < 100 AND s.rowid = a.fk_soc AND a.fk_user_action = ".$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + $sql .= " ORDER BY a.datea DESC"; + + $resql=$db->query($sql); + if ($resql) { - $var=true; - - print ''; - print ''; - print ''; - print "\n"; - - $i = 0; - while ($i < $num ) + $num = $db->num_rows($resql); + if ($num > 0) { - $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; - - // Action - $transcode=$langs->trans("Action".$obj->code); - $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); - print ''; - - // Tiers - print ''; - $i++; + $var=true; + + print '
'.$langs->trans("ActionsToDo").'
".dolibarr_print_date($obj->da)."".img_object($langs->trans("ShowAction"),"task").' '.$libelle.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->sname.'
'; + print ''; + print ''; + print "\n"; + + $i = 0; + while ($i < $num ) + { + $obj = $db->fetch_object($resql); + $var=!$var; + + print ""; + + // Action + $transcode=$langs->trans("Action".$obj->code); + $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); + print ''; + + // Tiers + print ''; + $i++; + } + print "
'.$langs->trans("ActionsToDo").'
".dolibarr_print_date($obj->da)."".img_object($langs->trans("ShowAction"),"task").' '.$libelle.''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->sname.'

"; } - print "
"; + $db->free($resql); + } + else + { + dolibarr_print_error($db); } - $db->free($resql); -} -else -{ - dolibarr_print_error($db); } /* - * Dernières propales ouvertes + * Dernieres propales ouvertes * */ if ($conf->propal->enabled && $user->rights->propale->lire) @@ -263,7 +266,7 @@ if ($conf->propal->enabled && $user->rights->propale->lire) } /* - * Sociétés à contacter + * Soci�t�s � contacter * */ $sql = "SELECT s.nom, s.rowid"; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 37505c18b39..9cc080e6605 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1841,51 +1841,54 @@ else print ''; /* - * Liste des actions propres � la commande + * Liste des actions propres a la commande */ - $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; - $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; - $sql .= ' WHERE a.fk_commande = '.$commande->id ; - if ($socid) $sql .= ' AND a.fk_soc = '.$socid; - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; + $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; + $sql .= ' WHERE a.fk_commande = '.$commande->id ; + if ($socid) $sql .= ' AND a.fk_soc = '.$socid; + $resql = $db->query($sql); + if ($resql) { - //print '
'; - print_titre($langs->trans('ActionsOnOrder')); - $i = 0; - $total = 0; - $var=true; - - print ''; - print ''; - print "\n"; - - while ($i < $num) + $num = $db->num_rows($resql); + if ($num) { - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - print '\n"; - print ''; - $authoract = new User($db); - $authoract->id = $objp->fk_user_author; - $authoract->fetch(''); - print ''; - print "\n"; - $i++; + //print '
'; + print_titre($langs->trans('ActionsOnOrder')); + $i = 0; + $total = 0; + $var=true; + + print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da)."'.stripslashes($objp->label).''.$authoract->login.'
'; + print ''; + print "\n"; + + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print '\n"; + print ''; + $authoract = new User($db); + $authoract->id = $objp->fk_user_author; + $authoract->fetch(''); + print ''; + print "\n"; + $i++; + } + print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da)."'.stripslashes($objp->label).''.$authoract->login.'
'; } - print ''; } - } - else - { - dolibarr_print_error($db); - } - + else + { + dolibarr_print_error($db); + } + } + print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e742616764c..da03c8d62d3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2949,49 +2949,51 @@ else /* * Liste des actions propres à la facture */ - $sql = 'SELECT a.id, '.$db->pdate('a.datea').' as da, a.label, a.note,'; - $sql.= ' u.login'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; - $sql.= ' WHERE a.fk_user_author = u.rowid'; - $sql.= ' AND a.fk_action in (9,10)'; - $sql.= ' AND a.fk_soc = '.$fac->socid ; - $sql.= ' AND a.fk_facture = '.$fac->id; - - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - if ($num) + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + $sql = 'SELECT a.id, '.$db->pdate('a.datea').' as da, a.label, a.note,'; + $sql.= ' u.login'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u'; + $sql.= ' WHERE a.fk_user_author = u.rowid'; + $sql.= ' AND a.fk_action in (9,10)'; + $sql.= ' AND a.fk_soc = '.$fac->socid ; + $sql.= ' AND a.fk_facture = '.$fac->id; + + $resql = $db->query($sql); + if ($resql) { - print '
'; - print_titre($langs->trans('ActionsOnBill')); - - $i = 0; $total = 0; - print ''; - print ''; - print "\n"; - - $var=True; - while ($i < $num) + $num = $db->num_rows($resql); + if ($num) { - $objp = $db->fetch_object($resql); - $var=!$var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; + print '
'; + print_titre($langs->trans('ActionsOnBill')); + + $i = 0; $total = 0; + print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da,'day').''.$objp->label.''.$objp->login.'
'; + print ''; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object($resql); + $var=!$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + print '
'.$langs->trans('Ref').''.$langs->trans('Date').''.$langs->trans('Action').''.$langs->trans('By').'
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da,'day').''.$objp->label.''.$objp->login.'
'; } - print ''; + } + else + { + dolibarr_print_error($db); } } - else - { - dolibarr_print_error($db); - } - print ''; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index 90c8a330e13..483f22dde90 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -164,7 +164,7 @@ if ($socid > 0) print ''.$langs->trans("Phone").''.dolibarr_print_phone($societe->tel,$societe->pays_code).' '.$langs->trans("Fax").''.dolibarr_print_phone($societe->fax,$societe->pays_code).' '; print ''.$langs->trans("Web")."url\" target=\"_blank\">$societe->url "; - // Assujeti à TVA ou pas + // Assujeti � TVA ou pas print ''; print ''.$langs->trans('VATIsUsed').''; print yn($societe->tva_assuj); @@ -191,7 +191,7 @@ if ($socid > 0) print ''.($societe->remise_client?price2num($societe->remise_client,'MT').'%':$langs->trans("DiscountNone")).''; print ''; - // Réductions (Remises-Ristournes-Rabbais) + // R�ductions (Remises-Ristournes-Rabbais) print ''; print ''; print ''; print ''; print ""; - print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + } print ""; $sql = "SELECT p.rowid, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note"; @@ -415,11 +421,28 @@ if ($socid > 0) } print ''; print ''; - print ''; - print ''; - print ''; - - print ''; + print ''; + print ''; + print ''; - print ''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + } print "\n"; $i++; $tag = !$tag; @@ -448,242 +473,248 @@ if ($socid > 0) * Listes des actions a faire * */ - print_titre($langs->trans("ActionsOnCompany")); - print '
'; @@ -219,7 +219,7 @@ if ($socid > 0) print ''; - // Nbre max d'éléments des petites listes + // Nbre max d'�l�ments des petites listes $MAXLIST=5; $tableaushown=1; @@ -300,7 +300,7 @@ if ($socid > 0) } /* - * Derniers projets associés + * Derniers projets associ�s */ if ($conf->projet->enabled) { @@ -354,7 +354,7 @@ if ($socid > 0) if ($user->societe_id == 0) { - // Si société cliente ou prospect, on affiche bouton "Créer facture client" + // Si soci�t� cliente ou prospect, on affiche bouton "Cr�er facture client" if ($societe->client != 0 && $conf->facture->enabled && $user->rights->facture->creer) { $langs->load("bills"); print "id\">".$langs->trans("AddBill").""; @@ -366,8 +366,11 @@ if ($socid > 0) } } - print ''.$langs->trans("AddAction").''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + if ($user->rights->societe->contact->creer) { print "".$langs->trans("AddContact").""; @@ -388,7 +391,10 @@ if ($socid > 0) print ''.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'   
'.$obj->poste.' '.$obj->phone.' '.$obj->fax.' '.$obj->email.' '; + print ''; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->phone; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->fax; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print $obj->email; + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + print ''; + print ' '; if ($user->rights->societe->contact->creer) { @@ -431,10 +454,12 @@ if ($socid > 0) print ''; - print img_object($langs->trans("Rendez-Vous"),"action"); - print ''; + print img_object($langs->trans("Rendez-Vous"),"action"); + print '
'; - print ''; - print ''; - print ''; - - $sql = "SELECT a.id, a.label,"; - $sql.= " ".$db->pdate("a.datep")." as dp,"; - $sql.= " ".$db->pdate("a.datea")." as da,"; - $sql.= " a.percent,"; - $sql.= " c.code as acode, c.libelle, u.login, a.propalrowid, a.fk_user_author, a.fk_contact,"; - $sql.= " u.login, u.rowid,"; - $sql.= " sp.name, sp.firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - $sql.= " WHERE a.fk_soc = ".$societe->id; - $sql.= " AND u.rowid = a.fk_user_author"; - $sql.= " AND c.id=a.fk_action AND a.percent < 100"; - $sql.= " ORDER BY a.datea DESC, a.id DESC"; - - dolibarr_syslog("compta/fiche.php sql=".$sql); - $result=$db->query($sql); - if ($result) + if ($conf->agenda->enabled) { - $i = 0 ; - $num = $db->num_rows($result); - $var=true; - - while ($i < $num) - { - $var = !$var; - - $obj = $db->fetch_object($result); - print ""; - - if ($oldyear == strftime("%Y",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { - print '\n"; - $oldyear = strftime("%Y",$obj->dp); - } - - if ($oldmonth == strftime("%Y%b",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { - print '\n"; - $oldmonth = strftime("%Y%b",$obj->dp); - } - - print '\n"; - print ''; - - // Picto warning - print ''; - - // Status/Percent - print ''; - - if ($obj->propalrowid) - { - print ''; - } - else - { - $actionstatic->code=$obj->acode; - $actionstatic->libelle=$obj->libelle; - $actionstatic->id=$obj->id; - print ''; - } - - print ''; - - // Contact pour cette action - if ($obj->fk_contact > 0) - { - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print ''; - } - else - { - print ''; - } - - // Auteur - print ''; - - // Statut - print ''; - - print "\n"; - $i++; - } - - $db->free($result); + print_titre($langs->trans("ActionsOnCompany")); + print '
'.$langs->trans("ActionsToDoShort").' 
|'.strftime("%Y",$obj->dp)."|' .strftime("%b",$obj->dp)."'.strftime("%d",$obj->dp)."'.strftime("%H:%M",$obj->dp).''; - if (date("U",$obj->dp) < time()) print ' '.img_warning("Late"); - else print ' '; - print ' '.img_object($langs->trans("ShowAction"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''.$actionstatic->getNomUrl(1,16).''.$obj->label.''.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
'; + print ''; + print ''; + print ''; + + $sql = "SELECT a.id, a.label,"; + $sql.= " ".$db->pdate("a.datep")." as dp,"; + $sql.= " ".$db->pdate("a.datea")." as da,"; + $sql.= " a.percent,"; + $sql.= " c.code as acode, c.libelle, u.login, a.propalrowid, a.fk_user_author, a.fk_contact,"; + $sql.= " u.login, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$societe->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent < 100"; + $sql.= " ORDER BY a.datea DESC, a.id DESC"; + + dolibarr_syslog("compta/fiche.php sql=".$sql); + $result=$db->query($sql); + if ($result) + { + $i = 0 ; + $num = $db->num_rows($result); + $var=true; + + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + + if ($oldyear == strftime("%Y",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + { + print ''; + } + else + { + print '\n"; + $oldyear = strftime("%Y",$obj->dp); + } + + if ($oldmonth == strftime("%Y%b",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + { + print ''; + } + else + { + print '\n"; + $oldmonth = strftime("%Y%b",$obj->dp); + } + + print '\n"; + print ''; + + // Picto warning + print ''; + + // Status/Percent + print ''; + + if ($obj->propalrowid) + { + print ''; + } + else + { + $actionstatic->code=$obj->acode; + $actionstatic->libelle=$obj->libelle; + $actionstatic->id=$obj->id; + print ''; + } + + print ''; + + // Contact pour cette action + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } + + // Auteur + print ''; + + // Statut + print ''; + + print "\n"; + $i++; + } + + $db->free($result); + } + else + { + dolibarr_print_error($db); + } + print "
'.$langs->trans("ActionsToDoShort").' 
|'.strftime("%Y",$obj->dp)."|' .strftime("%b",$obj->dp)."'.strftime("%d",$obj->dp)."'.strftime("%H:%M",$obj->dp).''; + if (date("U",$obj->dp) < time()) print ' '.img_warning("Late"); + else print ' '; + print ' '.img_object($langs->trans("ShowAction"),"task"); + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; + print ''.$actionstatic->getNomUrl(1,16).''.$obj->label.''.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'

"; } - else - { - dolibarr_print_error($db); - } - print "
"; - + /* - * Listes des actions effectuées + * Listes des actions effectuees */ - print ''; - print ''; - print ''; - - $sql = "SELECT a.id, a.label,"; - $sql.= " ".$db->pdate("a.datep")." as dp,"; - $sql.= " ".$db->pdate("a.datea")." as da,"; - $sql.= " a.percent,"; - $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; - $sql.= " c.code as acode, c.libelle,"; - $sql.= " u.login, u.rowid,"; - $sql.= " sp.name, sp.firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - $sql.= " WHERE a.fk_soc = ".$societe->id; - $sql.= " AND u.rowid = a.fk_user_author"; - $sql.= " AND c.id=a.fk_action AND a.percent = 100"; - $sql.= " ORDER BY a.datea DESC, a.id DESC"; - - dolibarr_syslog("compta/fiche.php sql=".$sql); - $result=$db->query($sql); - if ($result) + if ($conf->agenda->enabled) { - $i = 0 ; - $num = $db->num_rows($result); - $var=true; - - while ($i < $num) - { - $var = !$var; - - $obj = $db->fetch_object($result); - print ""; - - if ($oldyear == strftime("%Y",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) { - print ''; - } else { - print '\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) { - print ''; - } else { - print '\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print '\n"; - print '\n"; - - // Picto - print ''; - - // Espace - print ''; - - // Action - print ''; - - // Objet lié - print ''; - - // Libellé - print ""; - - // Contact pour cette action - if ($obj->fk_contact > 0) - { - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print ''; - } - else - { - print ''; - } - - // Auteur - print ''; - - // Statut - print ''; - - print "\n"; - $i++; - } - - $db->free($result); + print '
'.$langs->trans("ActionsDoneShort").''; - print '
|'.strftime("%Y",$obj->da)."|'.strftime("%b",$obj->da)."'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."  '; - $actionstatic->code=$obj->acode; - $actionstatic->libelle=$obj->libelle; - $actionstatic->id=$obj->id; - print $actionstatic->getNomUrl(1,16); - print ''; - if ($obj->propalrowid) - { - print ''.img_object($langs->trans("ShowPropal"),"propal"); - print $langs->trans("Propal"); - print ''; - } - if ($obj->fk_facture) - { - $facturestatic->ref=$langs->trans("Invoice"); - $facturestatic->id=$obj->rowid; - $facturestatic->type=$obj->type; - print $facturestatic->getNomUrl(1,'compta'); - } - else print ' '; - print '$obj->label'.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
'; + print ''; + print ''; + + $sql = "SELECT a.id, a.label,"; + $sql.= " ".$db->pdate("a.datep")." as dp,"; + $sql.= " ".$db->pdate("a.datea")." as da,"; + $sql.= " a.percent,"; + $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; + $sql.= " c.code as acode, c.libelle,"; + $sql.= " u.login, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$societe->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent = 100"; + $sql.= " ORDER BY a.datea DESC, a.id DESC"; + + dolibarr_syslog("compta/fiche.php sql=".$sql); + $result=$db->query($sql); + if ($result) + { + $i = 0 ; + $num = $db->num_rows($result); + $var=true; + + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + + if ($oldyear == strftime("%Y",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) { + print ''; + } else { + print '\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) { + print ''; + } else { + print '\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print '\n"; + print '\n"; + + // Picto + print ''; + + // Espace + print ''; + + // Action + print ''; + + // Objet li� + print ''; + + // Libell� + print ""; + + // Contact pour cette action + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } + + // Auteur + print ''; + + // Statut + print ''; + + print "\n"; + $i++; + } + + $db->free($result); + } + else + { + dolibarr_print_error($db); + } + print "
'.$langs->trans("ActionsDoneShort").''; + print '
|'.strftime("%Y",$obj->da)."|'.strftime("%b",$obj->da)."'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."  '; + $actionstatic->code=$obj->acode; + $actionstatic->libelle=$obj->libelle; + $actionstatic->id=$obj->id; + print $actionstatic->getNomUrl(1,16); + print ''; + if ($obj->propalrowid) + { + print ''.img_object($langs->trans("ShowPropal"),"propal"); + print $langs->trans("Propal"); + print ''; + } + if ($obj->fk_facture) + { + $facturestatic->ref=$langs->trans("Invoice"); + $facturestatic->id=$obj->rowid; + $facturestatic->type=$obj->type; + print $facturestatic->getNomUrl(1,'compta'); + } + else print ' '; + print '$obj->label'.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'

"; } - else - { - dolibarr_print_error($db); - } - print "
"; } else { diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index 28ecc39e2e9..975b263ad62 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -49,7 +49,7 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.datep"; if ($page == -1) { $page = 0 ; } -// Sécurité accés client +// S�curit� acc�s client $user->getrights('facture'); $module='propale'; if (! empty($_GET["socid"])) @@ -65,7 +65,7 @@ else if (! empty($_GET["propalid"])) $dbtable='propal'; } -// Sécurité d'accès client et commerciaux +// S�curit� d'acc�s client et commerciaux $socid = restrictedArea($user, $module, $objectid, $dbtable); @@ -77,7 +77,7 @@ $socid = restrictedArea($user, $module, $objectid, $dbtable); if ($_GET["action"] == 'setstatut') { /* - * Classée la facture comme facturée + * Class�e la facture comme factur�e */ $propal = new Propal($db); $propal->id = $_GET["propalid"]; @@ -163,7 +163,7 @@ if ($_GET["propalid"] > 0) $rowspan=8; - // Société + // Soci�t� print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; // Ligne info remises tiers @@ -203,7 +203,7 @@ if ($_GET["propalid"] > 0) print ''; print ''; - // Conditions et modes de réglement + // Conditions et modes de r�glement print ''; print ''; - print ''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + } + if ($_GET["view"] == 'phone') { print ''; - print ''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''; + } + if ($_GET["view"] == 'phone') { print ''; diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 474be7f0e0a..e5f06ac663e 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2003 Éric Seigne + * Copyright (C) 2003 �ric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -42,7 +42,7 @@ $langs->load('orders'); $langs->load('companies'); $langs->load('commercial'); -// Sécurité accés client +// S�curit� acc�s client $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id > 0) { @@ -118,7 +118,7 @@ if ( $societe->fetch($socid) ) print ''; print '"; - // Assujeti à TVA ou pas + // Assujeti � TVA ou pas print ''; print '
'; print $langs->trans('PaymentConditionsShort'); @@ -486,7 +486,7 @@ if ($_GET["propalid"] > 0) print ''; print ''; - print '\n"; + print '\n"; print ''; $authoract = new User($db); $authoract->id = $objp->fk_user_author; @@ -638,7 +640,7 @@ if ($_GET["propalid"] > 0) { dolibarr_print_error($db); } - + } print '
'; /* - * Documents générés + * Documents g�n�r�s */ $filename=sanitize_string($propal->ref); $filedir=$conf->propal->dir_output . "/" . sanitize_string($propal->ref); @@ -500,7 +500,7 @@ if ($_GET["propalid"] > 0) /* - * Commandes rattachées + * Commandes rattach�es */ if($conf->commande->enabled) { @@ -596,8 +596,10 @@ if ($_GET["propalid"] > 0) /* - * Liste des actions propres à la propal + * Liste des actions propres a la propal */ + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql .= ' WHERE a.fk_soc = '.$societe->id.' AND a.propalrowid = '.$propal->id ; @@ -622,7 +624,7 @@ if ($_GET["propalid"] > 0) $var=!$var; print '
'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.''.dolibarr_print_date($objp->da,'dayhour')."'.dolibarr_print_date($objp->da,'dayhour')."'.stripslashes($objp->label).'
'; @@ -672,7 +674,7 @@ else $sql.= " WHERE p.fk_soc = s.rowid"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql .= " AND s.rowid = ".$socid; - if ($viewstatut <> '') $sql .= " AND p.fk_statut in ($viewstatut)"; // viewstatut peut etre combinaisons séparé par virgules + if ($viewstatut <> '') $sql .= " AND p.fk_statut in ($viewstatut)"; // viewstatut peut etre combinaisons s�par� par virgules if ($month > 0) { if ($year > 0) diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index 04ae8c54b0e..ab23d11c012 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -151,6 +151,9 @@ class Conf * Chargement d'include selon etat activation des modules */ + // Module agenda + $this->agenda->enabled=defined('MAIN_MODULE_AGENDA')?MAIN_MODULE_AGENDA:0; + // Module bookmark4u $this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0; diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php index 4294904d57b..d039f140f9d 100644 --- a/htdocs/contact/index.php +++ b/htdocs/contact/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2003 Éric Seigne + * Copyright (C) 2003 �ric Seigne * Copyright (C) 2004-2007 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -34,7 +34,7 @@ $langs->load("companies"); $langs->load("suppliers"); -// Sécurité accés client +// S�curit� acc�s client $socid=''; if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) @@ -80,9 +80,9 @@ if ($type == "f") { $titre=$langs->trans("ListOfContacts").' ('.$langs->trans("ThirdPartySuppliers").')'; $urlfiche="fiche.php"; } -if ($view == 'phone') { $text="( Vue Téléphones)"; } +if ($view == 'phone') { $text="( Vue T�l�phones)"; } if ($view == 'mail') { $text=" (Vue EMail)"; } -if ($view == 'recent') { $text=" (Récents)"; } +if ($view == 'recent') { $text=" (R�cents)"; } $titre = $titre." $text"; if ($_POST["button_removefilter"]) @@ -225,10 +225,13 @@ if ($result) print '
'; print ''; print ''; - print ' '; - print ''; + print ' '; + print ''; @@ -285,8 +288,11 @@ if ($result) } print ''.dolibarr_print_phone($obj->phone).' '.dolibarr_print_phone($obj->phone).' '.dolibarr_print_phone($obj->phone_mobile,$obj->fp_pays).' 
'.$langs->trans("Phone").''.dolibarr_print_phone($societe->tel).' '.$langs->trans("Fax").''.dolibarr_print_phone($societe->fax).' 
'.$langs->trans("Web")."url\">$societe->url 
'.$langs->trans('VATIsUsed').''; print yn($societe->tva_assuj); @@ -143,7 +143,7 @@ if ( $societe->fetch($socid) ) print '
'; /* - * Liste des commandes associées + * Liste des commandes associ�es */ $orderstatic = new CommandeFournisseur($db); @@ -200,7 +200,7 @@ if ( $societe->fetch($socid) ) /* - * Liste des factures associées + * Liste des factures associ�es */ $MAXLIST=5; @@ -287,8 +287,11 @@ if ( $societe->fetch($socid) ) print ''.$langs->trans("AddBill").''; } - print ''.$langs->trans("AddAction").''; - + if ($conf->agenda->enabled && $user->rights->agenda->myactions->create) + { + print ''.$langs->trans("AddAction").''; + } + if ($user->rights->societe->contact->creer) { print "".$langs->trans("AddContact").""; @@ -365,236 +368,241 @@ if ( $societe->fetch($socid) ) print '
'; /* - * Listes des actions a faire - * + * Listes des actions a faire + * \TODO Mutualise ce code avec page compta et client de tiers */ - print_titre($langs->trans("ActionsOnCompany")); - print ''; - print ''; - - $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code as acode, c.libelle, u.login,"; - $sql.= " a.propalrowid, a.fk_user_author, a.fk_contact, u.rowid,"; - $sql.= " sp.name, sp.firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - $sql.= " WHERE a.fk_soc = ".$societe->id; - $sql.= " AND u.rowid = a.fk_user_author"; - $sql.= " AND c.id=a.fk_action AND a.percent < 100"; - $sql.= " ORDER BY a.datep DESC, a.id DESC"; - - $result=$db->query($sql); - if ($result) - { - $i = 0 ; - $num = $db->num_rows($result); - $var=true; - - while ($i < $num) + if ($conf->agenda->enabled) + { + print_titre($langs->trans("ActionsOnCompany")); + print '
'.$langs->trans("ActionsToDoShort").' 
'; + print ''; + + $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code as acode, c.libelle, u.login,"; + $sql.= " a.propalrowid, a.fk_user_author, a.fk_contact, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$societe->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent < 100"; + $sql.= " ORDER BY a.datep DESC, a.id DESC"; + + $result=$db->query($sql); + if ($result) { - $var = !$var; - - $obj = $db->fetch_object($result); - print ""; - - if ($oldyear == strftime("%Y",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + $i = 0 ; + $num = $db->num_rows($result); + $var=true; + + while ($i < $num) { - print ''; + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + + if ($oldyear == strftime("%Y",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + { + print ''; + } + else + { + print '\n"; + $oldyear = strftime("%Y",$obj->dp); + } + + if ($oldmonth == strftime("%Y%b",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + { + print ''; + } + else + { + print '\n"; + $oldmonth = strftime("%Y%b",$obj->dp); + } + + print '\n"; + print ''; + + // Picto warning + print ''; + + // Status/Percent + print ''; + + if ($obj->propalrowid) + { + print ''; + } + else + { + print ''; + } + + print ''; + + // Contact pour cette action + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } + + // Auteur + print ''; + + // Statut + print ''; + + print "\n"; + $i++; } - else - { - print '\n"; - $oldyear = strftime("%Y",$obj->dp); - } - - if ($oldmonth == strftime("%Y%b",$obj->dp) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } - else - { - print '\n"; - $oldmonth = strftime("%Y%b",$obj->dp); - } - - print '\n"; - print ''; - - // Picto warning - print ''; - - // Status/Percent - print ''; - - if ($obj->propalrowid) - { - print ''; - } - else - { - print ''; - } - - print ''; - - // Contact pour cette action - if ($obj->fk_contact > 0) - { - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print ''; - } - else - { - print ''; - } - - // Auteur - print ''; - - // Statut - print ''; - - print "\n"; - $i++; + + $db->free($result); + } else { + dolibarr_print_error($db); } - - $db->free($result); - } else { - dolibarr_print_error($db); - } - print "
'.$langs->trans("ActionsToDoShort").' 
|
|'.strftime("%Y",$obj->dp)."|' .strftime("%b",$obj->dp)."'.strftime("%d",$obj->dp)."'.strftime("%H:%M",$obj->dp).''; + if (date("U",$obj->dp) < time()) print ' '.img_warning("Late"); + else print ' '; + print ' '.img_object($langs->trans("ShowAction"),"task"); + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; + print ''.img_object($langs->trans("ShowAction"),"task"); + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; + print ''.$obj->label.''.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
'.strftime("%Y",$obj->dp)."|' .strftime("%b",$obj->dp)."'.strftime("%d",$obj->dp)."'.strftime("%H:%M",$obj->dp).''; - if (date("U",$obj->dp) < time()) print ' '.img_warning("Late"); - else print ' '; - print ' '.img_object($langs->trans("ShowAction"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''.img_object($langs->trans("ShowAction"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''.$obj->label.''.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'

"; - + print "

"; + } + /* - * Listes des actions effectuées + * Listes des actions effectuees */ - print ''; - print ''; - print ''; - - $sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da, a.percent,"; - $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; - $sql.= " c.code as acode, c.libelle,"; - $sql.= " u.login, u.rowid,"; - $sql.= " sp.name, sp.firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; - $sql.= " WHERE a.fk_soc = ".$societe->id; - $sql.= " AND u.rowid = a.fk_user_author"; - $sql.= " AND c.id=a.fk_action AND a.percent = 100"; - $sql.= " ORDER BY a.datea DESC, a.id DESC"; - - $result=$db->query($sql); - if ($result) - { - $i = 0 ; - $num = $db->num_rows($result); - $var=true; - - while ($i < $num) + if ($conf->agenda->enabled) + { + print '
'.$langs->trans("ActionsDoneShort").'
'; + print ''; + print ''; + + $sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da, a.percent,"; + $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; + $sql.= " c.code as acode, c.libelle,"; + $sql.= " u.login, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$societe->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent = 100"; + $sql.= " ORDER BY a.datea DESC, a.id DESC"; + + $result=$db->query($sql); + if ($result) { - $var = !$var; - - $obj = $db->fetch_object($result); - print ""; - - if ($oldyear == strftime("%Y",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + $i = 0 ; + $num = $db->num_rows($result); + $var=true; + + while ($i < $num) { - print ''; - } else { - print '\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) - { - print ''; - } else { - print '\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print '\n"; - print '\n"; - - // Picto - print ''; - - // Espace - print ''; - - // Action - print ''; - - // Objet lie - print '"; + + if ($oldyear == strftime("%Y",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + { + print ''; + } else { + print '\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) && !$conf->global->COMPANY_VIEW_FULL_DATE_ACTIONS) + { + print ''; + } else { + print '\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print '\n"; + print '\n"; + + // Picto + print ''; + + // Espace + print ''; + + // Action + print ''; + + // Objet lie + print ''; + + // Libelle + print ""; + + // Contact pour cette action + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } + + // Auteur + print ''; + + // Statut + print ''; + + print "\n"; + $i++; } - if ($obj->fk_facture) - { - print ''.img_object($langs->trans("ShowBill"),"bill"); - print $langs->trans("Invoice"); - print ''; - } - else print ' '; - print ''; - - // Libelle - print ""; - - // Contact pour cette action - if ($obj->fk_contact > 0) - { - $contactstatic->name=$obj->name; - $contactstatic->firstname=$obj->firstname; - $contactstatic->id=$obj->fk_contact; - print ''; - } - else - { - print ''; - } - - // Auteur - print ''; - - // Statut - print ''; - - print "\n"; - $i++; + $db->free(); } - $db->free(); - } - else - { - dolibarr_print_error($db); - } - - - print "
'.$langs->trans("ActionsDoneShort").'
|'.strftime("%Y",$obj->da)."|'.strftime("%b",$obj->da)."'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."  '; - print ''.img_object($langs->trans("ShowTask"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''; - print ''; - if ($obj->propalrowid) - { - print ''.img_object($langs->trans("ShowPropal"),"propal"); - print $langs->trans("Propal"); + $var = !$var; + + $obj = $db->fetch_object($result); + print "
|'.strftime("%Y",$obj->da)."|'.strftime("%b",$obj->da)."'.strftime("%d",$obj->da)."'.strftime("%H:%M",$obj->da)."  '; + print ''.img_object($langs->trans("ShowTask"),"task"); + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; print ''; + print ''; + if ($obj->propalrowid) + { + print ''.img_object($langs->trans("ShowPropal"),"propal"); + print $langs->trans("Propal"); + print ''; + } + if ($obj->fk_facture) + { + print ''.img_object($langs->trans("ShowBill"),"bill"); + print $langs->trans("Invoice"); + print ''; + } + else print ' '; + print '$obj->label'.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
$obj->label'.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
"; - + else + { + dolibarr_print_error($db); + } + + + print ""; + } } else { diff --git a/htdocs/includes/boxes/box_actions.php b/htdocs/includes/boxes/box_actions.php index f53807e2b42..2b28ed43495 100644 --- a/htdocs/includes/boxes/box_actions.php +++ b/htdocs/includes/boxes/box_actions.php @@ -68,7 +68,7 @@ class box_actions extends ModeleBoxes { $this->info_box_head = array('text' => $langs->trans("BoxTitleLastActionsToDo",$max)); - if ($user->rights->commercial->main->lire) + if ($user->rights->agenda->myactions->read) { $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp , a.percent as percentage,"; $sql.= " ta.code,"; diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index 48765c57f64..47fb07bb64f 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -65,7 +65,7 @@ class MenuLeft { if (! session_id()) { session_name("DOLSESSID_".$dolibarr_main_db_name); - session_start(); // En mode authentification PEAR, la session a déjà été ouverte + session_start(); } $user->getrights(""); @@ -104,7 +104,7 @@ class MenuLeft { } $newmenu = new Menu(); - $overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','project','tools'); + $overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','agenda','project','tools'); /** * On definit newmenu en fonction de mainmenu et leftmenu @@ -290,12 +290,15 @@ class MenuLeft { $newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); // Actions - $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Actions"), 0, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&time=today", $langs->trans("Today"), 1, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->societe->lire); - + if ($conf->agenda->enabled) + { + $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read); + } + // Propal if ($conf->propal->enabled) { @@ -685,7 +688,22 @@ class MenuLeft { } - + /* + * Menu AGENDA + */ + if ($mainmenu == 'agenda') + { + // Actions + if ($conf->agenda->enabled) + { + $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read); + } + } + /* * Menu PROJETS */ diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php index 83b2bc10325..501e6e282a4 100644 --- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php @@ -63,7 +63,7 @@ class MenuLeft { if (! session_id()) { session_name("DOLSESSID_".$dolibarr_main_db_name); - session_start(); // En mode authentification PEAR, la session a déjà été ouverte + session_start(); } $user->getrights(""); @@ -103,7 +103,7 @@ class MenuLeft { $newmenu = new Menu(); - $overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','project','tools'); + $overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','agenda','project','tools'); /** * On definit newmenu en fonction de mainmenu et leftmenu @@ -275,11 +275,14 @@ class MenuLeft { */ // Actions /* - $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Actions"), 0, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&time=today", $langs->trans("Today"), 1, $user->rights->societe->lire); - if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->societe->lire); + if ($conf->agenda->enabled) + { + $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=actions", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=actions&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read); + if ($leftmenu=="actions") $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=actions", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read); + } */ // Propal if ($conf->propal->enabled) @@ -659,6 +662,24 @@ class MenuLeft { } + /* + * Menu AGENDA + */ + /* + if ($mainmenu == 'agenda') + { + // Actions + if ($conf->agenda->enabled) + { + $newmenu->add(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda", $langs->trans("Agenda"), 0, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/societe.php?leftmenu=agenda", $langs->trans("NewAction"), 1, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda&status=todo", $langs->trans("MenuToDoActions"), 1, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/index.php?leftmenu=agenda&time=today", $langs->trans("Today"), 1, $user->rights->agenda->myactions->read); + $newmenu->add_submenu(DOL_URL_ROOT."/comm/action/rapport/index.php?leftmenu=agenda", $langs->trans("Reportings"), 1, $user->rights->agenda->myactions->read); + } + } + */ + /* * Menu PROJETS */ diff --git a/htdocs/includes/menus/barre_top/eldy_backoffice.php b/htdocs/includes/menus/barre_top/eldy_backoffice.php index 4e40bc844b0..55b8211fc34 100644 --- a/htdocs/includes/menus/barre_top/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_top/eldy_backoffice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2008 Laurent Destailleur * Copyright (C) 2007 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -21,14 +21,14 @@ /** \file htdocs/includes/menus/barre_top/eldy_backoffice.php - \brief Gestionnaire nommé eldy du menu du haut + \brief Gestionnaire nomm� eldy du menu du haut \version $Revision$ \remarks La construction d'un gestionnaire pour le menu du haut est simple: - \remarks Toutes les entrées de menu à faire apparaitre dans la barre du haut - \remarks doivent être affichées par ... - \remarks On peut éventuellement ajouter l'attribut id="sel" dans la balise - \remarks quand il s'agit de l'entrée du menu qui est sélectionnée. + \remarks Toutes les entr�es de menu � faire apparaitre dans la barre du haut + \remarks doivent �tre affich�es par ... + \remarks On peut �ventuellement ajouter l'attribut id="sel" dans la balise + \remarks quand il s'agit de l'entr�e du menu qui est s�lectionn�e. */ @@ -45,7 +45,7 @@ class MenuTop { /** * \brief Constructeur - * \param db Handler d'accès base de donnée + * \param db Handler d'acc�s base de donn�e */ function MenuTop($db) { @@ -66,19 +66,19 @@ class MenuTop { if (! session_id()) { session_name("DOLSESSID_".$dolibarr_main_db_name); - session_start(); // En mode authentification PEAR, la session a déjà été ouverte + session_start(); } $user->getrights(""); - // On récupère mainmenu + // On recupere mainmenu if (isset($_GET["mainmenu"])) { // On sauve en session le menu principal choisi $mainmenu=$_GET["mainmenu"]; $_SESSION["mainmenu"]=$mainmenu; $_SESSION["leftmenuopened"]=""; } else { - // On va le chercher en session si non défini par le lien + // On va le chercher en session si non defini par le lien $mainmenu=$_SESSION["mainmenu"]; } @@ -212,6 +212,28 @@ class MenuTop { print ''.$langs->trans("MenuFinancial").''; } + // Agenda + if ($conf->agenda->enabled) + { + $langs->load("commercial"); + $langs->load("agenda"); + + $class=""; + if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "agenda") + { + $class='class="tmenu" id="sel"'; + } + else + { + $class = 'class="tmenu"'; + } + + if ($user->rights->agenda->myactions->read || $user->rights->agenda->allactions->read) + print 'atarget?" target=$this->atarget":"").'>'.$langs->trans("Agenda").''; + else + print ''.$langs->trans("Agenda").''; + } + // Projects if ($conf->projet->enabled) { diff --git a/htdocs/includes/menus/barre_top/eldy_frontoffice.php b/htdocs/includes/menus/barre_top/eldy_frontoffice.php index b5763e53439..9f7ac4842bd 100644 --- a/htdocs/includes/menus/barre_top/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_top/eldy_frontoffice.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2008 Laurent Destailleur * * 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 @@ -20,14 +20,14 @@ /** \file htdocs/includes/menus/barre_top/eldy_frontoffice.php - \brief Gestionnaire nommé eldy du menu du haut + \brief Gestionnaire nomm� eldy du menu du haut \version $Revision$ \remarks La construction d'un gestionnaire pour le menu du haut est simple: - \remarks Toutes les entrées de menu à faire apparaitre dans la barre du haut - \remarks doivent être affichées par ... - \remarks On peut éventuellement ajouter l'attribut id="sel" dans la balise - \remarks quand il s'agit de l'entrée du menu qui est sélectionnée. + \remarks Toutes les entr�es de menu � faire apparaitre dans la barre du haut + \remarks doivent �tre affich�es par ... + \remarks On peut �ventuellement ajouter l'attribut id="sel" dans la balise + \remarks quand il s'agit de l'entr�e du menu qui est s�lectionn�e. */ @@ -44,7 +44,7 @@ class MenuTop { /** * \brief Constructeur - * \param db Handler d'accès base de donnée + * \param db Handler d'acc�s base de donn�e */ function MenuTop($db) { @@ -65,19 +65,19 @@ class MenuTop { if (! session_id()) { session_name("DOLSESSID_".$dolibarr_main_db_name); - session_start(); // En mode authentification PEAR, la session a déjà été ouverte + session_start(); // En mode authentification PEAR, la session a d�j� �t� ouverte } $user->getrights(""); - // On récupère mainmenu + // On r�cup�re mainmenu if (isset($_GET["mainmenu"])) { // On sauve en session le menu principal choisi $mainmenu=$_GET["mainmenu"]; $_SESSION["mainmenu"]=$mainmenu; $_SESSION["leftmenuopened"]=""; } else { - // On va le chercher en session si non défini par le lien + // On va le chercher en session si non d�fini par le lien $mainmenu=$_SESSION["mainmenu"]; } diff --git a/htdocs/includes/modules/modAgenda.class.php b/htdocs/includes/modules/modAgenda.class.php new file mode 100644 index 00000000000..460dd04e9d2 --- /dev/null +++ b/htdocs/includes/modules/modAgenda.class.php @@ -0,0 +1,209 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * + * 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. + * + * $Id$ + */ + +/** + \defgroup adherent Module adherents + \brief Module pour gerer les adherents d'une association +*/ + +/** + \file htdocs/includes/modules/modAgenda.class.php + \ingroup agenda + \brief Fichier de description et activation du module agenda +*/ + +include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); + +/** + \class modAdherent + \brief Classe de description et activation du module Adherent +*/ + +class modAgenda extends DolibarrModules +{ + + /** + * \brief Constructeur. Definit les noms, constantes et boites + * \param DB handler d'acc�s base + */ + function modAgenda($DB) + { + $this->db = $DB; + $this->id = 'agenda'; // Same value xxx than in file modXxx.class.php file + $this->numero = 2400; + + $this->family = "projects"; + $this->name = "Agenda"; + $this->description = "Gestion de l'agenda et des actions"; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->const_name = 'MAIN_MODULE_AGENDA'; + $this->special = 0; + $this->picto='calendar'; + + // Dir + //---- + $this->dirs = array(); + + // Config pages + //------------- + $this->config_page_url = array(); + + // Dependances + //------------ + $this->depends = array(); + $this->requiredby = array(); + $this->langfiles = array("companies"); + + // Constantes + //----------- + $this->const = array(); + + // Boites + //------- + $this->boxes = array(); + + // Permissions + //------------ + $this->rights = array(); + $this->rights_class = 'agenda'; + $r=0; + + // $this->rights[$r][0] Id permission (unique tous modules confondus) + // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission) + // $this->rights[$r][2] Non utilise + // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut + // $this->rights[$r][4] Niveau 1 pour nommer permission dans code + // $this->rights[$r][5] Niveau 2 pour nommer permission dans code + + $r++; + $this->rights[$r][0] = 2401; + $this->rights[$r][1] = 'Lire les actions liees a son compte'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 1; + $this->rights[$r][4] = 'myactions'; + $this->rights[$r][5] = 'read'; + + $r++; + $this->rights[$r][0] = 2402; + $this->rights[$r][1] = 'Creer/modifier/supprimer les actions liees a son compte'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'myactions'; + $this->rights[$r][5] = 'create'; + + $r++; + $this->rights[$r][0] = 2403; + $this->rights[$r][1] = 'Lire les actions des autres'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'allactions'; + $this->rights[$r][5] = 'read'; + + $r++; + $this->rights[$r][0] = 2405; + $this->rights[$r][1] = 'Creer/modifier/supprimer les actions pour les autres'; + $this->rights[$r][2] = 'w'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'allactions'; + $this->rights[$r][5] = 'create'; + + // Exports + //-------- + $r=0; + + // $this->export_code[$r] Code unique identifiant l'export (tous modules confondus) + // $this->export_label[$r] Libelle par defaut si traduction de cle "ExportXXX" non trouvee (XXX = Code) + // $this->export_fields_sql[$r] Liste des champs exportables en codif sql + // $this->export_fields_name[$r] Liste des champs exportables en codif traduction + // $this->export_sql[$r] Requete sql qui offre les donnees a l'export + // $this->export_permission[$r] Liste des codes permissions requis pour faire l'export + + $r++; + $this->export_code[$r]=$this->id.'_'.$r; + $this->export_label[$r]='Adherents et adhesions'; + $this->export_fields_array[$r]=array('a.nom'=>"Lastname",'a.prenom'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'MorPhy','a.adresse'=>"Address",'a.cp'=>"Zip",'a.ville'=>"Town",'a.pays'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.naiss'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note'=>"Note",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount'); + $this->export_entities_array[$r]=array('a.nom'=>"member",'a.prenom'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.adresse'=>"member",'a.cp'=>"member",'a.ville'=>"member",'a.pays'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.naiss'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); + $this->export_alias_array[$r]=array('a.nom'=>"lastname",'a.prenom'=>"firstname",'a.login'=>"login",'a.morphy'=>'morphy','a.adresse'=>"address",'a.cp'=>"zip",'a.ville'=>"town",'a.pays'=>"country",'a.phone'=>"phone",'a.phone_perso'=>"phone_perso",'a.phone_mobile'=>"phone_mobile",'a.email'=>"email",'a.naiss'=>"birthday",'a.statut'=>"status",'a.photo'=>'photo','a.note'=>'note','a.datec'=>'datec','a.datevalid'=>'datevalid','a.tms'=>'datem','a.datefin'=>'dateend','ta.rowid'=>'type_id','ta.libelle'=>'type_label','c.dateadh'=>'date_subscription','c.cotisation'=>'amount_subscription'); + // On complete avec champs options + $sql='SELECT name, label FROM '.MAIN_DB_PREFIX.'adherent_options_label'; + $resql=$this->db->query($sql); + while ($obj=$this->db->fetch_object($resql)) + { + $fieldname='ao.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_entities_array[$r][$fieldname]='member'; + $this->export_alias_array[$r][$fieldname]='opt_'.$obj->name; + } + // Fin complement + $this->export_sql[$r]="select distinct "; + $i=0; + foreach ($this->export_alias_array[$r] as $key => $value) + { + if ($i > 0) $this->export_sql[$r].=', '; + else $i++; + $this->export_sql[$r].=$key.' as '.$value; + } + $this->export_sql[$r].=' from ('.MAIN_DB_PREFIX.'adherent as a, '.MAIN_DB_PREFIX.'adherent_type as ta)'; + $this->export_sql[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_options as ao ON a.rowid = ao.adhid'; + $this->export_sql[$r].=' LEFT JOIN '.MAIN_DB_PREFIX.'cotisation as c ON c.fk_adherent = a.rowid'; + $this->export_sql[$r].=' WHERE a.fk_adherent_type = ta.rowid'; + $this->export_permission[$r]=array(array("adherent","export")); + } + + + /** + * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. + * Definit egalement les repertoires de donnees a creer pour ce module. + */ + function init() + { + global $conf; + + // Permissions + $this->remove(); + + // Dir + $this->dirs[0] = $conf->adherent->dir_output; + $this->dirs[1] = $conf->adherent->dir_output."/photos"; + $this->dirs[2] = $conf->adherent->dir_export; + + $sql = array(); + + return $this->_init($sql); + } + + /** + * \brief Fonction appelee lors de la desactivation d'un module. + * Supprime de la base les constantes, boites et permissions du module. + */ + function remove() + { + $sql = array(); + + return $this->_remove($sql); + } + +} +?> diff --git a/htdocs/user.class.php b/htdocs/user.class.php index c8200b1e177..4b7a938c590 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -318,8 +318,8 @@ class User extends CommonObject // Where pour la liste des droits a ajouter $whereforadd="id=".$rid; // Ajout des droits induits - if ($subperms) $whereforadd.=" OR (module='$module' AND perms='$perms' AND subperms='lire')"; - if ($perms) $whereforadd.=" OR (module='$module' AND perms='lire' AND subperms IS NULL)"; + if ($subperms) $whereforadd.=" OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; + else if ($perms) $whereforadd.=" OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; } else { // On a pas demande un droit en particulier mais une liste de droits @@ -412,8 +412,8 @@ class User extends CommonObject // Where pour la liste des droits a supprimer $wherefordel="id=".$rid; // Suppression des droits induits - if ($subperms=='lire') $wherefordel.=" OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; - if ($perms=='lire') $wherefordel.=" OR (module='$module')"; + if ($subperms=='lire' || $subperms=='read') $wherefordel.=" OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; + if ($perms=='lire' || $perms=='read') $wherefordel.=" OR (module='$module')"; } else { // On a demande suppression d'un droit sur la base d'un nom de module ou perms diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 8305afc95a6..71196d4430b 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -52,7 +52,7 @@ if ($_GET["action"] == 'addrights' && $caneditperms) $edituser = new User($db,$_GET["id"]); $edituser->addrights($_GET["rights"],$module); - // Si on a touché à ces propres droits, on recharge + // Si on a touche a ses propres droits, on recharge if ($_GET["id"] == $user->id) { $user->clearrights(); @@ -65,7 +65,7 @@ if ($_GET["action"] == 'delrights' && $caneditperms) $edituser = new User($db,$_GET["id"]); $edituser->delrights($_GET["rights"],$module); - // Si on a touché à ces propres droits, on recharge + // Si on a touche a ses propres droits, on recharge if ($_GET["id"] == $user->id) { $user->clearrights(); @@ -242,7 +242,7 @@ if ($result) $oldmod = $obj->module; $var = !$var; - // Rupture détectée, on récupère objMod + // Rupture detectee, on recupere objMod $objMod=$modules[$obj->module]; $picto=($objMod->picto?$objMod->picto:'generic');