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.
This commit is contained in:
parent
f06911a8b0
commit
3dbe27030e
@ -870,7 +870,7 @@ else
|
||||
$conciliate=$account->canBeConciliated();
|
||||
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
||||
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>';
|
||||
|
||||
// Balance
|
||||
|
||||
@ -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)
|
||||
*
|
||||
|
||||
@ -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';
|
||||
$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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user