Skip to content

Commit

Permalink
Debug v21
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 21, 2024
1 parent 2d135b4 commit d04e0a7
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 23 deletions.
13 changes: 9 additions & 4 deletions htdocs/compta/bank/bankentries_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

Expand All @@ -566,7 +570,7 @@
/*
* Buttons actions
*/

/* Moved into tab
if ($action != 'reconcile') {
if ($object->canBeConciliated() > 0) {
$allowautomaticconciliation = false; // TODO
Expand Down Expand Up @@ -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,";
Expand Down Expand Up @@ -1032,8 +1037,8 @@
print '<input type="submit" class="button" name="confirm_reconcile" value="'.$langs->trans("Conciliate").'">';
print ' <span class="opacitymedium">'.$langs->trans("otherwise").'</span> ';
print '<input type="submit" class="button small" name="confirm_savestatement" value="'.$langs->trans("SaveStatementOnly").'">';
print ' <span class="opacitymedium">'.$langs->trans("or").'</span> ';
print '<input type="submit" name="cancel" class="button button-cancel small" value="'.$langs->trans("Cancel").'">';
//print ' <span class="opacitymedium">'.$langs->trans("or").'</span> ';
//print '<input type="submit" name="cancel" class="button button-cancel small" value="'.$langs->trans("Cancel").'">';
print '</div>';

print '<br>';
Expand Down
3 changes: 2 additions & 1 deletion htdocs/compta/bank/releve.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@

print dol_get_fiche_end();


/* Moved as a tab
if ($object->canBeConciliated() > 0) {
$allowautomaticconciliation = false; // TODO
$titletoconciliatemanual = $langs->trans("Conciliate");
Expand Down Expand Up @@ -339,6 +339,7 @@
}
}
}
*/

// List of mass actions available
$arrayofmassactions = array(
Expand Down
71 changes: 54 additions & 17 deletions htdocs/core/lib/bank.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
*/
function bank_prepare_head(Account $object)
{
global $db, $langs, $conf;
global $db, $langs, $conf, $user;

$h = 0;
$head = array();

Expand All @@ -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) {

Check failure on line 60 in htdocs/core/lib/bank.lib.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

If condition is always false.
$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 = '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliatemanual.'</a>';
}*/

if ($allowautomaticconciliation) {

Check failure on line 77 in htdocs/core/lib/bank.lib.php

View workflow job for this annotation

GitHub Actions / phpstan / php-stan (8.2)

If condition is always false.
// 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 .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
}/* else {
$buttonreconcile .= ' <a class="butActionRefused" style="margin-bottom: 5px !important; margin-top: 5px !important" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$titletoconciliateauto.'</a>';
}*/
}
}

if ($object->type != Account::TYPE_CASH || getDolGlobalString('BANK_CAN_RECONCILIATE_CASHACCOUNT')) {
$nbReceipts = 0;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/en_US/banks.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/stocks.lang
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,4 @@ QtyViewed=Quantity viewed
QtyStock=Quantity on stock
QtyRegulated=Quantity on stock correction
InventoryEntrepot=Warehouse identity
SelectedWarehouse=Select a warehouse

0 comments on commit d04e0a7

Please sign in to comment.