diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 568b20d456f..119f76b8ece 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -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;
diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php
index 1a0da3bd5ab..286c4b60f59 100644
--- a/htdocs/comm/action/fiche.php
+++ b/htdocs/comm/action/fiche.php
@@ -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 '
';
// Ref
- print '| '.$langs->trans("Ref").' | '.$act->id.' |
';
+ print '| '.$langs->trans("Ref").' | ';
+ print $html->showrefnav($act,'id','',1,'id','ref','');
+ print ' |
';
// Type
print '| '.$langs->trans("Type").' | '.$act->type.' |
';
diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index 342ef97ef69..65473cb9069 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -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;
diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php
index 2ac3dec5ad7..3fc760d5fbe 100644
--- a/htdocs/comm/action/listactions.php
+++ b/htdocs/comm/action/listactions.php
@@ -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;
diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php
index 2fbac752fbf..417f75e8d09 100644
--- a/htdocs/comm/fiche.php
+++ b/htdocs/comm/fiche.php
@@ -378,7 +378,7 @@ if ($socid > 0)
print '
';
print '
';
- $now=gmmktime();
+ $now=dol_now();
/*
* Last proposals
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index b00bb0a894d..d649e6353e1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -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."
";
$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."
";
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 49d1c0f737d..81fe1d70b59 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -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
diff --git a/htdocs/includes/modules/modAgenda.class.php b/htdocs/includes/modules/modAgenda.class.php
index 9905c005cbf..99a205620b5 100644
--- a/htdocs/includes/modules/modAgenda.class.php
+++ b/htdocs/includes/modules/modAgenda.class.php
@@ -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&leftmenu=agenda", $langs->trans("Actions"), 0, $user->rights->agenda->myactions->read);
$newmenu->add(DOL_URL_ROOT."/comm/action/fiche.php?mainmenu=agenda&leftmenu=agenda&action=create", $langs->trans("NewAction"), 1, ($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create));
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 0ce13468e7e..727af15ae03 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -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)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 463f6b93e2e..1d85bcde1f1 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -969,7 +969,14 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$htmltext.='
'.$langs->trans("Name").': '.$user->fullname;
$htmltext.='
'.$langs->trans("Login").': '.$user->login;
$htmltext.='
'.$langs->trans("Administrator").': '.yn($user->admin);
- $htmltext.='
'.$langs->trans("Type").': '.($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.='
'.$langs->trans("Type").': '.$type;
$htmltext.='
';
$htmltext.='
'.$langs->trans("Connection").'';
if ($conf->global->MAIN_MODULE_MULTICOMPANY) $htmltext.='
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')';