diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index 2e508a7ef10..9ff8de63afa 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -83,6 +83,14 @@ function societe_prepare_head($object) $head[$h][2] = 'category'; $h++; } + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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) { $head[$h][0] = DOL_URL_ROOT.'/societe/socnote.php?socid='.$object->id; @@ -90,6 +98,7 @@ function societe_prepare_head($object) $head[$h][2] = 'note'; $h++; } + // Attached files if ($user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; @@ -97,6 +106,7 @@ function societe_prepare_head($object) $head[$h][2] = 'document'; $h++; } + // Notifications if ($conf->notification->enabled && $user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$object->id; @@ -104,25 +114,6 @@ function societe_prepare_head($object) $head[$h][2] = 'notify'; $h++; } - - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['thirdparty'])) - { - $i=0; - foreach ($conf->tabs_modules['thirdparty'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - // Log if ($user->societe_id == 0) { diff --git a/htdocs/lib/contact.lib.php b/htdocs/lib/contact.lib.php index 11c16242c52..5f711e11a97 100644 --- a/htdocs/lib/contact.lib.php +++ b/htdocs/lib/contact.lib.php @@ -64,27 +64,18 @@ function contact_prepare_head($object) $head[$h][2] = 'exportimport'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'contact'); + + $head[$h][0] = DOL_URL_ROOT.'/contact/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['contact'])) - { - $i=0; - foreach ($conf->tabs_modules['contact'] as $value) - { - $values=explode(':',$value); - 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++; - } - } + + return $head; } diff --git a/htdocs/lib/contract.lib.php b/htdocs/lib/contract.lib.php index 1e4f4c8d586..023e28b4303 100644 --- a/htdocs/lib/contract.lib.php +++ b/htdocs/lib/contract.lib.php @@ -40,7 +40,13 @@ function contract_prepare_head($object) $head[$h][2] = 'contact'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'contract'); + + $head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; $h++; @@ -55,23 +61,6 @@ function contract_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['contract'])) - { - $i=0; - foreach ($conf->tabs_modules['contract'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/fichinter.lib.php b/htdocs/lib/fichinter.lib.php index 8f99cdba776..065bf7b6664 100644 --- a/htdocs/lib/fichinter.lib.php +++ b/htdocs/lib/fichinter.lib.php @@ -53,7 +53,13 @@ function fichinter_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'intervention'); + + $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); $head[$h][2] = 'note'; $h++; @@ -63,28 +69,11 @@ function fichinter_prepare_head($object) $head[$h][2] = 'documents'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$object->id; $head[$h][1] = $langs->trans('Info'); $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['intervention'])) - { - $i=0; - foreach ($conf->tabs_modules['intervention'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/fourn.lib.php b/htdocs/lib/fourn.lib.php index d58ed723d5a..11aede51cc7 100644 --- a/htdocs/lib/fourn.lib.php +++ b/htdocs/lib/fourn.lib.php @@ -40,7 +40,13 @@ function facturefourn_prepare_head($object) $head[$h][2] = 'contact'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'supplier_invoice'); + + $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/note.php?facid='.$object->id; $head[$h][1] = $langs->trans('Notes'); $head[$h][2] = 'note'; $h++; @@ -59,23 +65,6 @@ function facturefourn_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['invoice_supplier'])) - { - $i=0; - foreach ($conf->tabs_modules['invoice_supplier'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } @@ -105,7 +94,13 @@ function ordersupplier_prepare_head($object) $head[$h][2] = 'contact'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'supplier_order'); + + $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Notes"); $head[$h][2] = 'note'; $h++; @@ -124,23 +119,6 @@ function ordersupplier_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['order_supplier'])) - { - $i=0; - foreach ($conf->tabs_modules['order_supplier'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index e363dbdcaa4..e14636e4140 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -3760,4 +3760,52 @@ function picto_from_langcode($codelang) return $ret; } +/** + * Complete a head array with value added by external modules + * @param conf Object conf + * @param langs Object langs + * @param object Object object + * @param head Object head + * @param h New position to fill + * @param type Value for object where objectvalue can be + * 'thirdparty' to add a tab in third party view + * 'intervention' to add a tab in intervention view + * 'supplier_order' to add a tab in supplier order view + * 'supplier_invoice' to add a tab in supplier invoice view + * 'invoice' to add a tab in customer invoice view + * 'order' to add a tab in customer order view + * 'product' to add a tab in product view + * 'propal' to add a tab in propal view + * 'member' to add a tab in fundation member view + */ +function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type) +{ + if (is_array($conf->tabs_modules['thirdparty'])) + { + $i=0; + foreach ($conf->tabs_modules['thirdparty'] as $value) + { + $values=explode(':',$value); + if (sizeof($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 (sizeof($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++; + } + } + } +} + ?> \ No newline at end of file diff --git a/htdocs/lib/invoice.lib.php b/htdocs/lib/invoice.lib.php index d27d4145b1d..135c1d868b9 100644 --- a/htdocs/lib/invoice.lib.php +++ b/htdocs/lib/invoice.lib.php @@ -59,7 +59,13 @@ function facture_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'invoice'); + + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; $head[$h][1] = $langs->trans('Notes'); $head[$h][2] = 'note'; $h++; @@ -78,23 +84,6 @@ function facture_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['invoice'])) - { - $i=0; - foreach ($conf->tabs_modules['invoice'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/member.lib.php b/htdocs/lib/member.lib.php index fb6baf1501b..cefaf794f57 100644 --- a/htdocs/lib/member.lib.php +++ b/htdocs/lib/member.lib.php @@ -64,7 +64,13 @@ function member_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'member'); + + $head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id; $head[$h][1] = $langs->trans("Note"); $head[$h][2] = 'note'; $h++; @@ -79,23 +85,6 @@ function member_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['member'])) - { - $i=0; - foreach ($conf->tabs_modules['member'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/order.lib.php b/htdocs/lib/order.lib.php index 0a08c98ccfd..bcbf29ebc0a 100644 --- a/htdocs/lib/order.lib.php +++ b/htdocs/lib/order.lib.php @@ -77,7 +77,13 @@ function commande_prepare_head($object) $head[$h][2] = 'contact'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'order'); + + $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; /*$filesdir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($commande->ref); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); $listoffiles=dol_dir_list($filesdir,'files',1); @@ -96,23 +102,6 @@ function commande_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['order'])) - { - $i=0; - foreach ($conf->tabs_modules['order'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/prelevement.lib.php b/htdocs/lib/prelevement.lib.php index ed255358904..213840852ae 100644 --- a/htdocs/lib/prelevement.lib.php +++ b/htdocs/lib/prelevement.lib.php @@ -36,7 +36,7 @@ function prelevement_prepare_head($object) { global $langs, $conf, $user; $langs->load("withdrawals"); - + $h = 0; $head = array(); @@ -73,23 +73,12 @@ function prelevement_prepare_head($object) $head[$h][2] = 'statistics'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['prelevement'])) - { - $i=0; - foreach ($conf->tabs_modules['prelevement'] as $value) - { - $values=explode(':',$value); - 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++; - } - } + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'prelevement'); - return $head; + return $head; } ?> \ No newline at end of file diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index 7ba3258e8ff..cb7a472ce21 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -105,38 +105,28 @@ function product_prepare_head($object, $user) $head[$h][2] = 'referers'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; + if($object->isproduct()) // Si produit stockable + { + if ($conf->stock->enabled && $user->rights->stock->lire) + { + $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; + $head[$h][1] = $langs->trans("Stock"); + $head[$h][2] = 'stock'; + $h++; + } + } + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'product'); + + $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); $head[$h][2] = 'documents'; $h++; - if($object->isproduct()) // Si produit stockable - { - if ($conf->stock->enabled && $user->rights->stock->lire) - { - $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$object->id; - $head[$h][1] = $langs->trans("Stock"); - $head[$h][2] = 'stock'; - $h++; - } - } - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['product'])) - { - $i=0; - foreach ($conf->tabs_modules['product'] as $value) - { - $values=explode(':',$value); - 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++; - } - } // More tabs from canvas if (is_array($object->onglets)) diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php index a46282fb795..83b70bf5136 100644 --- a/htdocs/lib/project.lib.php +++ b/htdocs/lib/project.lib.php @@ -52,7 +52,13 @@ function project_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'project'); + + $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; /*$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); $listoffiles=dol_dir_list($filesdir,'files',1); @@ -66,23 +72,6 @@ function project_prepare_head($object) $head[$h][2] = 'note'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['project'])) - { - $i=0; - foreach ($conf->tabs_modules['project'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - // Then tab for sub level of projet, i mean tasks $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; $head[$h][1] = $langs->trans("Tasks"); @@ -132,7 +121,13 @@ function task_prepare_head($object) $head[$h][2] = 'time'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'task'); + + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id; /*$filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); $listoffiles=dol_dir_list($filesdir,'files',1); @@ -146,23 +141,6 @@ function task_prepare_head($object) $head[$h][2] = 'note'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['task'])) - { - $i=0; - foreach ($conf->tabs_modules['task'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/propal.lib.php b/htdocs/lib/propal.lib.php index 23c52d0fb39..041c87e94c5 100644 --- a/htdocs/lib/propal.lib.php +++ b/htdocs/lib/propal.lib.php @@ -72,7 +72,13 @@ function propal_prepare_head($object) $head[$h][2] = 'contact'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'propal'); + + $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); $head[$h][2] = 'note'; $h++; @@ -91,23 +97,6 @@ function propal_prepare_head($object) $head[$h][2] = 'info'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['propal'])) - { - $i=0; - foreach ($conf->tabs_modules['propal'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } diff --git a/htdocs/lib/sendings.lib.php b/htdocs/lib/sendings.lib.php index 68d2db52c7b..73ccbaf5d98 100644 --- a/htdocs/lib/sendings.lib.php +++ b/htdocs/lib/sendings.lib.php @@ -49,26 +49,16 @@ function shipping_prepare_head($object) $h++; } - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['delivery'])) - { - $i=0; - foreach ($conf->tabs_modules['delivery'] as $value) - { - $values=explode(':',$value); - 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++; - } - } + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'delivery'); - return $head; + return $head; } + function delivery_prepare_head($object) { global $langs, $conf, $user; @@ -92,24 +82,13 @@ function delivery_prepare_head($object) $head[$h][2] = 'delivery'; $h++; - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['delivery'])) - { - $i=0; - foreach ($conf->tabs_modules['delivery'] as $value) - { - $values=explode(':',$value); - 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++; - } - } + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'delivery'); - return $head; + return $head; } /** diff --git a/htdocs/lib/stock.lib.php b/htdocs/lib/stock.lib.php index 73d89a24182..e086652bbbf 100644 --- a/htdocs/lib/stock.lib.php +++ b/htdocs/lib/stock.lib.php @@ -65,27 +65,16 @@ function stock_prepare_head($object) } */ - $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$object->id; + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'stock'); + + $head[$h][0] = DOL_URL_ROOT.'/product/stock/info.php?id='.$object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; $h++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['stock'])) - { - $i=0; - foreach ($conf->tabs_modules['stock'] as $value) - { - $values=explode(':',$value); - 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++; - } - } return $head; } diff --git a/htdocs/lib/usergroups.lib.php b/htdocs/lib/usergroups.lib.php index 5ab1f16353b..a6878493053 100644 --- a/htdocs/lib/usergroups.lib.php +++ b/htdocs/lib/usergroups.lib.php @@ -74,6 +74,12 @@ function user_prepare_head($object) $h++; } + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'user'); + if (! $user->societe_id) { $head[$h][0] = DOL_URL_ROOT.'/user/note.php?id='.$object->id; @@ -87,23 +93,6 @@ function user_prepare_head($object) $h++; } - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['user'])) - { - $i=0; - foreach ($conf->tabs_modules['user'] as $value) - { - $values=explode(':',$value); - 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++; - } - } - return $head; } @@ -143,24 +132,13 @@ function group_prepare_head($object) $h++; } - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:MyModule:@mymodule:/mymodule/mypage.php?id=__ID__'); - if (is_array($conf->tabs_modules['group'])) - { - $i=0; - foreach ($conf->tabs_modules['group'] as $value) - { - $values=explode(':',$value); - 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++; - } - } + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $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,'group'); - return $head; + return $head; } @@ -234,7 +212,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { // Disable not stable themes if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/bureau2crea/i',$subdir)) continue; - + if ($i % $thumbsbyrow == 0) { print '';