diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 7502d4644f5..7548b65bb1c 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -32,6 +32,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other')); @@ -246,16 +247,7 @@ foreach ($cats as $cat) { $arrayselected[] = $cat->id; } -$tabs = array( - array( - DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$rowid, - $langs->trans('BankTransaction') - ), - array( - DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$rowid, - $langs->trans('Info') - ) -); +$head = bankline_prepare_head($rowid); $sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,"; @@ -296,7 +288,7 @@ if ($result) print ''; print ''; - dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'accountline', 0); + dol_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'account', 0); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 969eb05328c..02b5727e174 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -2,6 +2,7 @@ /** * Copyright (C) 2013 Marcos García * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Abbes Bahfir * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,15 +29,15 @@ function payment_prepare_head(Paiement $object) { - global $langs, $conf; + global $langs, $conf; - $h = 0; - $head = array(); + $h = 0; + $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Payment"); - $head[$h][2] = 'payment'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id; + $head[$h][1] = $langs->trans("Payment"); + $head[$h][2] = 'payment'; + $h++; // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -44,14 +45,50 @@ function payment_prepare_head(Paiement $object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment'); - $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; + $head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; - complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove'); - return $head; + return $head; +} + +/** + * Returns an array with the tabs for the "Bannkline" section + * It loads tabs from modules looking for the entity payment + * + * @param Bankline $object Current payment object + * @return array Tabs for the Bankline section + */ +function bankline_prepare_head($id) +{ + + global $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$id; + $head[$h][1] = $langs->trans('BankTransaction'); + $head[$h][2] = 'bankline'; + $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, null, $head, $h, 'bankline'); + + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'bankline', 'remove'); + + return $head; } /**