- New: Agenda can be read by external contacts

This commit is contained in:
Laurent Destailleur 2010-06-09 18:25:20 +00:00
parent b1a1e82c97
commit 21908d0bd9
10 changed files with 59 additions and 30 deletions

View File

@ -25,15 +25,20 @@
* \version $Id$
*/
require_once(DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php');
require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php');
/** \class ActionComm
* \brief Classe permettant la gestion des actions commerciales
*/
class ActionComm
class ActionComm extends CommonObject
{
var $db;
var $error;
var $db;
var $error;
var $errors=array();
var $element='action';
var $table_element = 'actioncomm';
var $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $type_id;
var $type_code;

View File

@ -638,7 +638,7 @@ if ($_GET["id"])
$head=actions_prepare_head();
dol_fiche_head($head, 'card', $langs->trans("Action"),0,'task');
$now=gmmktime();
$now=dol_now();
$delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60;
// Confirmation suppression action
@ -777,7 +777,9 @@ if ($_GET["id"])
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$act->id.'</td></tr>';
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $html->showrefnav($act,'id','',1,'id','ref','');
print '</td></tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';

View File

@ -50,12 +50,12 @@ if (! $sortfield) $sortfield="a.datec";
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
$canedit=1;
if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $_GET["filter"]=='mine')
if (! $user->rights->agenda->allactions->read || $_GET["filter"]=='mine') // If no permission to see all, we show only affected to me
{
$filtera=$user->id;
$filtert=$user->id;

View File

@ -71,12 +71,12 @@ if (! $sortfield)
// Security check
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
$canedit=1;
if (! $user->rights->agenda->myactions->read) accessforbidden();
if (! $user->rights->agenda->allactions->read) $canedit=0;
if (! $user->rights->agenda->allactions->read || $_GET["filter"]=='mine')
if (! $user->rights->agenda->allactions->read || $_GET["filter"]=='mine') // If no permission to see all, we show only affected to me
{
$filtera=$user->id;
$filtert=$user->id;

View File

@ -378,7 +378,7 @@ if ($socid > 0)
print '</table>';
print '<br>';
$now=gmmktime();
$now=dol_now();
/*
* Last proposals

View File

@ -531,7 +531,7 @@ class CommonObject
if (! $this->table_element)
{
dol_syslog("CommonObject::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
dol_print_error("CommonObject::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
@ -548,7 +548,7 @@ class CommonObject
if (!$this->isnolinkedbythird && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
if (isset($filter)) $sql.=" AND ".$filter;
if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && !$this->isnolinkedbythird && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if ($this->ismultientitymanaged > 0) $sql.= ' AND te.entity IN (0,'.$conf->entity.')';
if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN (0,'.$conf->entity.')';
//print $sql."<br>";
$result = $this->db->query($sql) ;
@ -569,7 +569,7 @@ class CommonObject
if (!$this->isnolinkedbythird && !$user->rights->societe->client->voir) $sql.= " AND sc.fk_user = " .$user->id;
if (isset($filter)) $sql.=" AND ".$filter;
if ($this->ismultientitymanaged == 2 || ($this->element != 'societe' && !$this->isnolinkedbythird && !$user->rights->societe->client->voir)) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
if ($this->ismultientitymanaged > 0) $sql.= ' AND te.entity IN (0,'.$conf->entity.')';
if ($this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN (0,'.$conf->entity.')';
// Rem: Bug in some mysql version: SELECT MIN(rowid) FROM llx_socpeople WHERE rowid > 1 when one row in database with rowid=1, returns 1 instead of null
//print $sql."<br>";

View File

@ -2982,7 +2982,7 @@ class Form
* \param object Object to show
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
* \param morehtml Code html supplementaire a afficher avant barre nav
* \param shownav Show Condition
* \param shownav Show Condition (navigation is show if value is 1)
* \param fieldid Nom du champ en base a utiliser pour select next et previous
* \param fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* \param morehtmlref Code html supplementaire a afficher apres ref

View File

@ -152,6 +152,21 @@ class modAgenda extends DolibarrModules
$this->menu = array(); // List of menus to add
$r=0;
// Add here entries to declare new menus
// Example to declare the Top Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
// 'type'=>'top', // This is a Top menu entry
// 'titre'=>'MyModule top menu',
// 'mainmenu'=>'mymodule',
// 'leftmenu'=>'1', // Use 1 if you also want to add left menu entries using this descriptor.
// 'url'=>'/mymodule/pagetop.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'enabled'=>'1', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
// 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
$this->menu[$r]=array('fk_menu'=>0,
'type'=>'top',
'titre'=>'Agenda',
@ -163,7 +178,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=0',
@ -176,7 +191,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=1',
'type'=>'left',
@ -188,7 +203,7 @@ class modAgenda extends DolibarrModules
'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
// Calendar
$this->menu[$r]=array('fk_menu'=>'r=1',
@ -201,7 +216,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=3',
'type'=>'left',
@ -213,7 +228,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=3',
'type'=>'left',
@ -225,7 +240,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=3',
'type'=>'left',
@ -237,7 +252,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=3',
'type'=>'left',
@ -249,7 +264,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
// List
$this->menu[$r]=array('fk_menu'=>'r=1',
@ -262,7 +277,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=8',
'type'=>'left',
@ -274,7 +289,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=8',
'type'=>'left',
@ -286,7 +301,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=8',
'type'=>'left',
@ -298,7 +313,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
$this->menu[$r]=array('fk_menu'=>'r=8',
'type'=>'left',
@ -310,7 +325,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
// Reports
$this->menu[$r]=array('fk_menu'=>'r=1',
@ -323,7 +338,7 @@ class modAgenda extends DolibarrModules
'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$conf->agenda->enabled',
'target'=>'',
'user'=>0);
'user'=>2);
$r++;
/*$newmenu->add(DOL_URL_ROOT."/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
$newmenu->add(DOL_URL_ROOT."/comm/action/fiche.php?mainmenu=agenda&amp;leftmenu=agenda&amp;action=create", $langs->trans("NewAction"), 1, ($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create));

View File

@ -1539,7 +1539,7 @@ function info_admin($texte,$infoonimgalt=0)
* If $_REQUEST['action'] defined, we also check write permission.
* \param user User to check
* \param features Features to check (in most cases, it's module name)
* \param objectid Object ID if we want to check permission on on object (optionnal)
* \param objectid Object ID if we want to check permission on a particular record (optionnal)
* \param dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
* \param feature2 Feature to check (second level of permission)
* \param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal)

View File

@ -969,7 +969,14 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$htmltext.='<br><b>'.$langs->trans("Name").'</b>: '.$user->fullname;
$htmltext.='<br><b>'.$langs->trans("Login").'</b>: '.$user->login;
$htmltext.='<br><b>'.$langs->trans("Administrator").'</b>: '.yn($user->admin);
$htmltext.='<br><b>'.$langs->trans("Type").'</b>: '.($user->societe_id?$langs->trans("External"):$langs->trans("Internal"));
$type=($user->societe_id?$langs->trans("External"):$langs->trans("Internal"));
if ($user->societe_id)
{
$thirdpartystatic=new Societe($db);
$thirdpartystatic->fetch($user->societe_id);
$type.=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')';
}
$htmltext.='<br><b>'.$langs->trans("Type").'</b>: '.$type;
$htmltext.='<br>';
$htmltext.='<br><u>'.$langs->trans("Connection").'</u>';
if ($conf->global->MAIN_MODULE_MULTICOMPANY) $htmltext.='<br><b>'.$langs->trans("ConnectedOnMultiCompany").'</b>: '.$conf->entity.' (user entity '.$user->entity.')';