diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 5eb45fcca67..cebfbcb4991 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -89,34 +89,30 @@ function societe_prepare_head($object) // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab complete_head_from_modules($conf,$langs,$object,$head,$h,'thirdparty'); - // Notes if ($user->societe_id == 0) { + // Notes $head[$h][0] = DOL_URL_ROOT.'/societe/socnote.php?socid='.$object->id; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; $h++; - } - // Attached files - if ($user->societe_id == 0) - { + + // Attached files $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; $head[$h][1] = $langs->trans("Documents"); $head[$h][2] = 'document'; $h++; - } - // Notifications - if (! empty($conf->notification->enabled) && $user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$object->id; - $head[$h][1] = $langs->trans("Notifications"); - $head[$h][2] = 'notify'; - $h++; - } - - // Log - if ($user->societe_id == 0) - { + + // Notifications + if (! empty($conf->notification->enabled)) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$object->id; + $head[$h][1] = $langs->trans("Notifications"); + $head[$h][2] = 'notify'; + $h++; + } + + // Log $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2d4ef228a37..a57e4748518 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4308,62 +4308,61 @@ function picto_from_langcode($codelang) */ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add') { - if (is_array($conf->tabs_modules[$type])) - { - foreach ($conf->tabs_modules[$type] as $value) - { - $values=explode(':',$value); - - if ($mode == 'add') - { - if (count($values) == 6) // new declaration with permissions - { - if ($values[0] != $type) continue; - //print 'ee'.$values[4]; - if (verifCond($values[4])) - { - if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); - $head[$h][1] = $langs->trans($values[2]); - $head[$h][2] = str_replace('+','',$values[1]); - $h++; - } - } - else if (count($values) == 5) // new declaration - { - if ($values[0] != $type) continue; - if ($values[3]) $langs->load($values[3]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1); - $head[$h][1] = $langs->trans($values[2]); - $head[$h][2] = str_replace('+','',$values[1]); - $h++; - } - else if (count($values) == 4) // old declaration, for backward compatibility - { - if ($values[0] != $type) continue; - if ($values[2]) $langs->load($values[2]); - $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1); - $head[$h][1] = $langs->trans($values[1]); - $head[$h][2] = 'tab'.$values[1]; - $h++; - } - } - else if ($mode == 'remove') - { - if ($values[0] != $type) continue; - $tabname=str_replace('-','',$values[1]); - foreach($head as $key => $val) - { - if ($head[$key][2]==$tabname) - { - //print 'on vire '.$tabname.' key='.$key; - unset($head[$key]); - break; - } - } - } - } - } + if (is_array($conf->tabs_modules[$type])) + { + foreach ($conf->tabs_modules[$type] as $value) + { + $values=explode(':',$value); + + if ($mode == 'add' && ! preg_match('/^\-/',$values[1])) + { + if (count($values) == 6) // new declaration with permissions + { + if ($values[0] != $type) continue; + if (verifCond($values[4])) + { + if ($values[3]) $langs->load($values[3]); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1); + $head[$h][1] = $langs->trans($values[2]); + $head[$h][2] = str_replace('+','',$values[1]); + $h++; + } + } + else if (count($values) == 5) // new declaration + { + if ($values[0] != $type) continue; + if ($values[3]) $langs->load($values[3]); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1); + $head[$h][1] = $langs->trans($values[2]); + $head[$h][2] = str_replace('+','',$values[1]); + $h++; + } + else if (count($values) == 4) // old declaration, for backward compatibility + { + if ($values[0] != $type) continue; + if ($values[2]) $langs->load($values[2]); + $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1); + $head[$h][1] = $langs->trans($values[1]); + $head[$h][2] = 'tab'.$values[1]; + $h++; + } + } + else if ($mode == 'remove') + { + if ($values[0] != $type) continue; + $tabname=str_replace('-','',$values[1]); + foreach($head as $key => $val) + { + $condition = (! empty($values[3]) ? verifCond($values[3]) : 1); + if ($head[$key][2]==$tabname && $condition) + { + unset($head[$key]); + break; + } + } + } + } + } } /** diff --git a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql index a9b60c1b88d..42c907f915b 100755 --- a/htdocs/install/mysql/migration/3.0.0-3.1.0.sql +++ b/htdocs/install/mysql/migration/3.0.0-3.1.0.sql @@ -476,13 +476,13 @@ ALTER TABLE llx_c_type_contact ADD COLUMN module varchar(32) NULL; ALTER TABLE llx_c_type_fees ADD COLUMN module varchar(32) NULL; ALTER TABLE llx_c_typent ADD COLUMN module varchar(32) NULL; +ALTER TABLE llx_user ADD ref_ext varchar(30) AFTER entity +ALTER TABLE llx_user ADD civilite varchar(6) AFTER pass_temp; ALTER TABLE llx_user ADD signature text DEFAULT NULL AFTER email; ALTER TABLE llx_don ADD phone_mobile varchar(24) after email; ALTER TABLE llx_don ADD phone varchar(24) after email; -ALTER TABLE llx_user ADD civilite varchar(6) after entity; - ALTER TABLE llx_element_element MODIFY sourcetype varchar(32) NOT NULL; ALTER TABLE llx_element_element MODIFY targettype varchar(32) NOT NULL; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c866085e50c..4d671ecb393 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1137,8 +1137,6 @@ class User extends CommonObject $adh->user_id=$this->id; $adh->user_login=$this->login; - //$adh->entity=$this->entity; - $result=$adh->update($user,0,1); if ($result < 0) { diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 7727f351915..d82a3db71b1 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1584,7 +1584,8 @@ else { $yn = yn($fuser->admin); print ''; - if (! empty($conf->multicompany->enabled) && ! $fuser->entity) print $form->textwithpicto($yn,$langs->trans("DontDowngradeSuperAdmin"),1,'warning'); + print ''; + if (! empty($conf->multicompany->enabled) && empty($fuser->entity)) print $form->textwithpicto($yn,$langs->trans("DontDowngradeSuperAdmin"),1,'warning'); else print $yn; } print '';