2
0
forked from Wavyzz/dolibarr

Fix duplicate tab "contact" on thirdparty

This commit is contained in:
Laurent Destailleur
2018-07-17 13:48:08 +02:00
parent f747cefda3
commit 8249179fb8
2 changed files with 31 additions and 28 deletions

View File

@@ -50,6 +50,8 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
if (empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
{
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
//$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); //$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
@@ -71,6 +73,16 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
} }
}
else
{
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}
if ($object->client==1 || $object->client==2 || $object->client==3) if ($object->client==1 || $object->client==2 || $object->client==3)
{ {
@@ -100,16 +112,6 @@ function societe_prepare_head(Societe $object)
$h++; $h++;
} }
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/societecontact.php?socid='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}
if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) )) if (! empty($conf->projet->enabled) && (!empty($user->rights->projet->lire) ))
{ {
$head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/societe/project.php?socid='.$object->id;

View File

@@ -6940,6 +6940,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
foreach($head as $key => $val) foreach($head as $key => $val)
{ {
$condition = (! empty($values[3]) ? verifCond($values[3]) : 1); $condition = (! empty($values[3]) ? verifCond($values[3]) : 1);
//var_dump($key.' - '.$tabname.' - '.$head[$key][2].' - '.$condition);
if ($head[$key][2]==$tabname && $condition) if ($head[$key][2]==$tabname && $condition)
{ {
unset($head[$key]); unset($head[$key]);