From f1f579ad67d2932fde86516163fa3e2dbcaa01a9 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 20 Aug 2020 22:17:34 +0200 Subject: [PATCH] Some fix on complete_head_from_modules --- htdocs/core/lib/expedition.lib.php | 3 ++- htdocs/core/lib/hrm.lib.php | 4 ++-- htdocs/core/lib/ldap.lib.php | 4 +++- htdocs/core/lib/member.lib.php | 4 ++-- htdocs/core/lib/multicurrency.lib.php | 2 ++ htdocs/core/lib/reception.lib.php | 18 ++++++++---------- htdocs/core/lib/resource.lib.php | 2 +- htdocs/core/lib/salaries.lib.php | 5 ++--- htdocs/core/lib/takepos.lib.php | 6 ++++-- htdocs/core/lib/ticket.lib.php | 2 ++ htdocs/margin/lib/margins.lib.php | 4 ++-- htdocs/takepos/admin/appearance.php | 2 +- htdocs/takepos/admin/bar.php | 2 +- htdocs/takepos/admin/other.php | 2 +- htdocs/takepos/admin/receipt.php | 2 +- htdocs/takepos/admin/setup.php | 2 +- htdocs/takepos/admin/terminal.php | 2 +- 17 files changed, 36 insertions(+), 30 deletions(-) diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index fc1ca494d36..ef687ef1131 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -58,6 +58,7 @@ function expedition_prepare_head(Expedition $object) $h++; } + complete_head_from_modules($conf, $langs, $object, $head, $h, 'order'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove'); @@ -132,7 +133,7 @@ function expedition_admin_prepare_head() $h++; } - + complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin'); complete_head_from_modules($conf, $langs, null, $head, $h, 'expedition_admin', 'remove'); diff --git a/htdocs/core/lib/hrm.lib.php b/htdocs/core/lib/hrm.lib.php index 3b336fee8d3..1ea359f6f0b 100644 --- a/htdocs/core/lib/hrm.lib.php +++ b/htdocs/core/lib/hrm.lib.php @@ -85,9 +85,9 @@ function hrm_admin_prepare_head() // 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, '', $head, $h, 'hrm_admin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin'); - complete_head_from_modules($conf, $langs, '', $head, $h, 'hrm_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove'); return $head; } diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index f95b6d03407..640152d5999 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -87,7 +87,9 @@ function ldap_prepare_head() // 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); to remove a tab - complete_head_from_modules($conf, $langs, '', $head, $h, 'ldap'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'ldap'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ldap', 'remove'); return $head; } diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 815060c8022..a59aa3e6301 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -185,7 +185,7 @@ function member_admin_prepare_head() // 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, '', $head, $h, 'member_admin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'member_admin'); $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsMember"); @@ -202,7 +202,7 @@ function member_admin_prepare_head() $head[$h][2] = 'website'; $h++; - complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'member_admin', 'remove'); return $head; } diff --git a/htdocs/core/lib/multicurrency.lib.php b/htdocs/core/lib/multicurrency.lib.php index 85142e0e631..94947e5c4b4 100644 --- a/htdocs/core/lib/multicurrency.lib.php +++ b/htdocs/core/lib/multicurrency.lib.php @@ -42,6 +42,8 @@ function multicurrencyAdminPrepareHead() complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency', 'remove'); + return $head; } diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 3cf9a535eaa..caa08228803 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -47,8 +47,6 @@ function reception_prepare_head(Reception $object) $head[$h][2] = 'reception'; $h++; - - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $objectsrc = $object; @@ -65,6 +63,12 @@ function reception_prepare_head(Reception $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); to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception'); + $nbNote = 0; if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_public)) $nbNote++; @@ -74,12 +78,7 @@ function reception_prepare_head(Reception $object) $head[$h][2] = 'note'; $h++; - - - - - - complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception', 'remove'); return $head; } @@ -102,6 +101,7 @@ function reception_admin_prepare_head() $head[$h][2] = 'reception'; $h++; + complete_head_from_modules($conf, $langs, null, $head, $h, 'reception_admin'); if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { @@ -119,8 +119,6 @@ function reception_admin_prepare_head() $h++; } - - complete_head_from_modules($conf, $langs, null, $head, $h, 'reception_admin', 'remove'); return $head; diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index e6a0998ba6f..3222c1c5768 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -37,7 +37,7 @@ function resource_prepare_head($object) $head[$h][0] = dol_buildpath('/resource/card.php', 1).'?id='.$object->id; $head[$h][1] = $langs->trans("ResourceCard"); - $head[$h][2] = 'resource'; + $head[$h][2] = 'resource'; $h++; if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && (empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER) || empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY))) diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 5a94e025097..a3df043d4c4 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -27,7 +27,6 @@ */ function salaries_prepare_head($object) { - global $db, $langs, $conf; $h = 0; @@ -86,14 +85,14 @@ function salaries_admin_prepare_head() // 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, '', $head, $h, 'salaries_admin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin'); $head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSalaries"); $head[$h][2] = 'attributes'; $h++; - complete_head_from_modules($conf, $langs, '', $head, $h, 'salaries_admin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin', 'remove'); return $head; } diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index bf90f818b3e..a651e1d76e0 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -26,7 +26,7 @@ * * @return array Array of tabs */ -function takepos_prepare_head() +function takepos_admin_prepare_head() { global $langs, $conf; @@ -67,7 +67,9 @@ function takepos_prepare_head() $head[$h][2] = 'other'; $h++; - complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos_admin'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'takepos_admin', 'remove'); return $head; } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 7ecea402607..8c6f154c840 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -62,6 +62,8 @@ function ticketAdminPrepareHead() //); // to remove a tab complete_head_from_modules($conf, $langs, null, $head, $h, 'ticketadmin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'ticketadmin', 'remove'); + return $head; } diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index fdfea1610bf..bf6447e8c21 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -44,9 +44,9 @@ function marges_admin_prepare_head() // 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); to remove a tab - complete_head_from_modules($conf, $langs, '', $head, $h, 'margesadmin'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'margesadmin'); - complete_head_from_modules($conf, $langs, '', $head, $h, 'margesadmin', 'remove'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'margesadmin', 'remove'); return $head; } diff --git a/htdocs/takepos/admin/appearance.php b/htdocs/takepos/admin/appearance.php index f085067197e..54e0752736c 100644 --- a/htdocs/takepos/admin/appearance.php +++ b/htdocs/takepos/admin/appearance.php @@ -74,7 +74,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'appearance', 'TakePOS', -1, 'cash-register'); print '
'; diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 2ec623024c7..e3b6a8d0099 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -79,7 +79,7 @@ llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayof $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index 902bcfc81d4..82940f2296a 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -110,7 +110,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'other', 'TakePOS', -1, 'cash-register'); print '
'; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 252781ec635..27b3a20cab9 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -78,7 +78,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'receipt', 'TakePOS', -1, 'cash-register'); print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index ab3b200df35..ccfcc166d77 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -130,7 +130,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'setup', 'TakePOS', -1, 'cash-register'); // Numbering modules diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 49b99daf280..fb43af6356a 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -124,7 +124,7 @@ llxHeader('', $langs->trans("CashDeskSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); -$head = takepos_prepare_head(); +$head = takepos_admin_prepare_head(); dol_fiche_head($head, 'terminal'.$terminal, 'TakePOS', -1, 'cash-register'); print '
';