diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php
index 7f35c71cd11..cc7f36261cc 100644
--- a/htdocs/contact/agenda.php
+++ b/htdocs/contact/agenda.php
@@ -211,7 +211,7 @@ else
dol_fiche_head($head, 'agenda', $title, -1, 'contact');
$linkback = ''.$langs->trans("BackToList").'';
-
+
$morehtmlref='
';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
@@ -223,42 +223,42 @@ else
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
}
$morehtmlref.='
';
-
+
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
-
+
print '';
-
+
print '
';
-
+
$object->info($id);
print dol_print_object_info($object, 1);
-
+
print '
';
-
+
print dol_fiche_end();
-
+
// Actions buttons
-
+
$objcon=$object;
$object->fetch_thirdparty();
$objthirdparty=$object->thirdparty;
-
+
$out='';
$permok=$user->rights->agenda->myactions->create;
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
{
//$out.='trans("AddAnAction"),'filenew');
//$out.="";
}
-
-
+
+
print '';
-
+
if (! empty($conf->agenda->enabled))
{
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
@@ -270,22 +270,22 @@ else
print '
'.$langs->trans("AddAction").'';
}
}
-
+
print '
';
-
+
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$param='&id='.$id;
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
-
-
+
+
print load_fiche_titre($langs->trans("TasksHistoryForThisContact"),'','');
-
+
// List of all actions
$filters=array();
$filters['search_agenda_label']=$search_agenda_label;
-
+
show_actions_done($conf,$langs,$db,$objthirdparty,$object,0,$actioncode, '', $filters, $sortfield, $sortorder);
}
}
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index ae4dfe1c2e4..fe36e0e02f4 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1043,7 +1043,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
global $param;
// Check parameters
- if (! is_object($filterobj)) dol_print_error('','BadParameter');
+ if (! is_object($filterobj) && ! is_object($objcon)) dol_print_error('','BadParameter');
$out='';
$histo=array();
@@ -1061,24 +1061,24 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$sql.= " a.fk_user_author, a.fk_contact,";
$sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,";
$sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname";
- if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
- if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
- if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
+ if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname";
+ if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname";
+ if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
- if (get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
- if (get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
- if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
+ if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
+ if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m";
+ if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o";
$sql.= " WHERE u.rowid = a.fk_user_action";
$sql.= " AND a.entity IN (".getEntity('agenda').")";
- if (get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
- if (get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
- if (get_class($filterobj) == 'Adherent')
+ if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id;
+ if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id;
+ if (is_object($filterobj) && get_class($filterobj) == 'Adherent')
{
$sql.= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
}
- if (get_class($filterobj) == 'CommandeFournisseur')
+ if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur')
{
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
@@ -1239,7 +1239,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$facturestatic=new Facture($db);
$out.='