From d04e0a7ac2dfe0c7818ec5d267cb7b14a587e825 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 04:45:11 +0100 Subject: [PATCH] Debug v21 --- htdocs/compta/bank/bankentries_list.php | 13 +++-- htdocs/compta/bank/releve.php | 3 +- htdocs/core/lib/bank.lib.php | 71 +++++++++++++++++++------ htdocs/langs/en_US/banks.lang | 2 +- htdocs/langs/en_US/stocks.lang | 1 + 5 files changed, 67 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 6f4e4a946f3aa..3dd37bf0d1be4 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -554,7 +554,11 @@ // Bank card $head = bank_prepare_head($object); - print dol_get_fiche_head($head, 'journal', $langs->trans("FinancialAccount"), 0, 'account'); + $activetab = 'journal'; + if ($action == 'reconcile') { + $activetab = 'reconcile'; + } + print dol_get_fiche_head($head, $activetab, $langs->trans("FinancialAccount"), 0, 'account'); $linkback = ''.$langs->trans("BackToList").''; @@ -566,7 +570,7 @@ /* * Buttons actions */ - + /* Moved into tab if ($action != 'reconcile') { if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO @@ -598,6 +602,7 @@ } } } + */ } $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; @@ -1032,8 +1037,8 @@ print ''; print ' '.$langs->trans("otherwise").' '; print ''; - print ' '.$langs->trans("or").' '; - print ''; + //print ' '.$langs->trans("or").' '; + //print ''; print ''; print '
'; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index f1d3523c3368e..1ebf78604fdcd 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -310,7 +310,7 @@ print dol_get_fiche_end(); - + /* Moved as a tab if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO $titletoconciliatemanual = $langs->trans("Conciliate"); @@ -339,6 +339,7 @@ } } } + */ // List of mass actions available $arrayofmassactions = array( diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 787ae74594958..7091f6aa0e5e4 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -38,7 +38,8 @@ */ function bank_prepare_head(Account $object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; + $h = 0; $head = array(); @@ -52,23 +53,44 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'journal'; $h++; - // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) - // { - $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; - $head[$h][1] = $langs->trans("PlannedTransactions"); - $head[$h][2] = 'cash'; - $h++; - // } - - $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; - $head[$h][1] = $langs->trans("IOMonthlyReporting"); - $head[$h][2] = 'annual'; - $h++; + if ($object->canBeConciliated() > 0) { + $allowautomaticconciliation = false; // TODO + $titletoconciliatemanual = $langs->trans("Conciliate"); + $titletoconciliateauto = $langs->trans("Conciliate"); + if ($allowautomaticconciliation) { + $titletoconciliatemanual .= ' ('.$langs->trans("Manual").')'; + $titletoconciliateauto .= ' ('.$langs->trans("Auto").')'; + } - $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; - $head[$h][1] = $langs->trans("Graph"); - $head[$h][2] = 'graph'; - $h++; + $param = ''; + + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$param; + $head[$h][1] = $titletoconciliatemanual; + $head[$h][2] = 'reconcile'; + $h++; + }/* else { + $buttonreconcile = ''.$titletoconciliatemanual.''; + }*/ + + if ($allowautomaticconciliation) { + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $newparam = $param; + $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam); + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$newparam; + $head[$h][1] = $titletoconciliateauto; + $head[$h][2] = 'reconcileauto'; + $h++; + + //$buttonreconcile .= ' '.$titletoconciliateauto.''; + }/* else { + $buttonreconcile .= ' '.$titletoconciliateauto.''; + }*/ + } + } if ($object->type != Account::TYPE_CASH || getDolGlobalString('BANK_CAN_RECONCILIATE_CASHACCOUNT')) { $nbReceipts = 0; @@ -110,6 +132,21 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'document'; $h++; + $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; + $head[$h][1] = $langs->trans("IOMonthlyReporting"); + $head[$h][2] = 'annual'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; + $head[$h][1] = $langs->trans("Graph"); + $head[$h][2] = 'graph'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; + $head[$h][1] = $langs->trans("PlannedTransactions"); + $head[$h][2] = 'cash'; + $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 diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7084a3332d782..fc5a428396503 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -133,7 +133,7 @@ DeleteTransaction=Delete entry ConfirmDeleteTransaction=Are you sure you want to delete this entry? ThisWillAlsoDeleteBankRecord=This will also delete generated bank entry BankMovements=Movements -PlannedTransactions=Planned entries +PlannedTransactions=Upcoming entries Graph=Graphs ExportDataset_banque_1=Bank entries and account statement ExportDataset_banque_2=Deposit slip diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 400a39ec95175..0648dde54b4f4 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -348,3 +348,4 @@ QtyViewed=Quantity viewed QtyStock=Quantity on stock QtyRegulated=Quantity on stock correction InventoryEntrepot=Warehouse identity +SelectedWarehouse=Select a warehouse