Skip to content
Snippets Groups Projects
Commit 3dbe2703 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

FIX If all banks account are reconcilable to off, we must not show nb of

transactions to reconciles.
FIX Switching status reconcile on-off was broken.
parent f06911a8
No related branches found
No related tags found
No related merge requests found
...@@ -870,7 +870,7 @@ else ...@@ -870,7 +870,7 @@ else
$conciliate=$account->canBeConciliated(); $conciliate=$account->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked').'"> '.$langs->trans("DisableConciliation"); else print '<input type="checkbox" class="flat" name="norappro"'.(($conciliate > 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
print '</td></tr>'; print '</td></tr>';
// Balance // Balance
......
...@@ -970,6 +970,34 @@ class Account extends CommonObject ...@@ -970,6 +970,34 @@ class Account extends CommonObject
} }
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @return int Nb of account we can reconciliate
*/
public static function countAccountToReconcile()
{
global $db, $conf, $langs;
if ($user->societe_id) return 0; // protection pour eviter appel par utilisateur externe
$nb=0;
$sql = "SELECT COUNT(ba.rowid) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rappro > 0 and ba.clos = 0";
if (empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) $sql.= " AND ba.courant != 2";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$nb = $obj->nb;
}
else dol_print_error($db);
return $nb;
}
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
......
...@@ -400,7 +400,11 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s ...@@ -400,7 +400,11 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s
{ {
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$board=new Account($db); $board=new Account($db);
$dashboardlines[] = $board->load_board($user); $nb = $board::countAccountToReconcile();
if ($nb > 0)
{
$dashboardlines[] = $board->load_board($user);
}
} }
// Number of cheque to send // Number of cheque to send
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment