diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php
index 45c7d3b298c..95e5bd49af1 100644
--- a/htdocs/lib/company.lib.php
+++ b/htdocs/lib/company.lib.php
@@ -510,11 +510,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL');
print '';
- print '
';
- print '';
- print img_edit();
- print ' | ';
-
if ($conf->agenda->enabled && $user->rights->agenda->myactions->create)
{
print '';
@@ -522,6 +517,14 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print ' | ';
}
+ if ($user->rights->societe->contact->creer)
+ {
+ print '';
+ print '';
+ print img_edit();
+ print ' | ';
+ }
+
print "\n";
$i++;
}
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index fb4c1a1ef5a..97a59094635 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -487,10 +487,13 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
print '';
}
- // Define max of key (max may be higher than sizeof becaus of hole due to module disabling some tabs).
- $keys=array_keys($links);
- if (sizeof($keys)) $maxkey=max($keys);
- else $maxkey=-1;
+ // Define max of key (max may be higher than sizeof because of hole due to module disabling some tabs).
+ $maxkey=-1;
+ if (is_array($links))
+ {
+ $keys=array_keys($links);
+ if (sizeof($keys)) $maxkey=max($keys);
+ }
// Show tabs
for ($i = 0 ; $i <= $maxkey ; $i++)