mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Fix: A account with conciliation disabled should not report warning of record late to reconciliate
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copytight (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copytight (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
* Copytight (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
* Copytight (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copytight (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
* Copytight (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
|
||||||
@@ -651,7 +651,7 @@ if ($account || $_GET["ref"])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Transaction reconciliated or edit link
|
// Transaction reconciliated or edit link
|
||||||
if ($objp->rappro && $acct->type != 2) // Si non compte cash
|
if ($objp->rappro && $acct->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
|
||||||
{
|
{
|
||||||
print "<td align=\"center\" nowrap>";
|
print "<td align=\"center\" nowrap>";
|
||||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'&page='.$page.'">';
|
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$acct->id.'&page='.$page.'">';
|
||||||
@@ -676,7 +676,7 @@ if ($account || $_GET["ref"])
|
|||||||
print img_view();
|
print img_view();
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
if ($acct->rappro && empty($objp->rappro))
|
if ($acct->canBeConciliated() > 0 && empty($objp->rappro))
|
||||||
{
|
{
|
||||||
if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay))
|
if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,11 +44,13 @@ class Account extends CommonObject
|
|||||||
var $rowid;
|
var $rowid;
|
||||||
var $ref;
|
var $ref;
|
||||||
var $label;
|
var $label;
|
||||||
var $type; // 'payment', 'company', 'member', 'banktransfert', 'payment_supplier', 'sc', 'payment_vat', ...
|
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
||||||
|
var $courant;
|
||||||
|
var $type; // same as courant
|
||||||
//! Name
|
//! Name
|
||||||
var $bank;
|
var $bank;
|
||||||
var $clos;
|
var $clos;
|
||||||
var $rappro;
|
var $rappro; // If bank need to be conciliated
|
||||||
var $url;
|
var $url;
|
||||||
//! BBAN field for French Code banque
|
//! BBAN field for French Code banque
|
||||||
var $code_banque;
|
var $code_banque;
|
||||||
@@ -65,8 +67,6 @@ class Account extends CommonObject
|
|||||||
var $proprio;
|
var $proprio;
|
||||||
var $adresse_proprio;
|
var $adresse_proprio;
|
||||||
|
|
||||||
//! 1=Compte courant/check/carte, 2=Compte liquide, 0=Compte épargne
|
|
||||||
var $courant;
|
|
||||||
|
|
||||||
var $fk_departement;
|
var $fk_departement;
|
||||||
var $departement_code;
|
var $departement_code;
|
||||||
@@ -109,6 +109,19 @@ class Account extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if a bank account need to be conciliated
|
||||||
|
* @return int 1 if need to be concialiated, < 0 otherwise.
|
||||||
|
*/
|
||||||
|
function canBeConciliated()
|
||||||
|
{
|
||||||
|
if (empty($this->rappro)) return -1;
|
||||||
|
if ($this->courant == 2) return -2;
|
||||||
|
if ($this->clos) return -3;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a link between bank line record and its source
|
* Add a link between bank line record and its source
|
||||||
* @param line_id Id ecriture bancaire
|
* @param line_id Id ecriture bancaire
|
||||||
@@ -539,12 +552,12 @@ class Account extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if (empty($id) && empty($ref) && empty($ref_ext))
|
if (empty($id) && empty($ref) && empty($ref_ext))
|
||||||
{
|
{
|
||||||
$this->error="ErrorBadParameters";
|
$this->error="ErrorBadParameters";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
|
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
|
||||||
$sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
|
$sql.= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
|
||||||
$sql.= " ba.domiciliation, ba.proprio, ba.adresse_proprio, ba.fk_departement, ba.fk_pays,";
|
$sql.= " ba.domiciliation, ba.proprio, ba.adresse_proprio, ba.fk_departement, ba.fk_pays,";
|
||||||
@@ -1002,9 +1015,10 @@ class AccountLine extends CommonObject
|
|||||||
var $note;
|
var $note;
|
||||||
var $fk_user_author;
|
var $fk_user_author;
|
||||||
var $fk_user_rappro;
|
var $fk_user_rappro;
|
||||||
|
var $fk_type;
|
||||||
var $num_releve;
|
var $num_releve;
|
||||||
var $num_chq;
|
var $num_chq;
|
||||||
var $rappro;
|
var $rappro; // Is it conciliated ?
|
||||||
|
|
||||||
var $bank_account_label;
|
var $bank_account_label;
|
||||||
|
|
||||||
|
|||||||
@@ -283,14 +283,6 @@ if ($action == 'create')
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Conciliable
|
|
||||||
/*print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
|
|
||||||
print '<td colspan="3">';
|
|
||||||
if ($account->type == 0 || $account->type == 1) print '<input type="checkbox" class="flat" name="norappro" '.($account->rappro?'':'checked="true"').'"> '.$langs->trans("DisableConciliation");
|
|
||||||
if ($account->type == 2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
|
|
||||||
print '</td></tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Accountancy code
|
// Accountancy code
|
||||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)
|
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)
|
||||||
{
|
{
|
||||||
@@ -420,8 +412,10 @@ else
|
|||||||
// Conciliate
|
// Conciliate
|
||||||
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($account->type == 0 || $account->type == 1) print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
|
$conciliate=$account->canBeConciliated();
|
||||||
if ($account->type == 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 print ($account->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy code
|
// Accountancy code
|
||||||
@@ -561,8 +555,10 @@ else
|
|||||||
// Conciliable
|
// Conciliable
|
||||||
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("Conciliable").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
if ($account->type == 0 || $account->type == 1) print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked="true"').'"> '.$langs->trans("DisableConciliation");
|
$conciliate=$account->canBeConciliated();
|
||||||
if ($account->type == 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 print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked="true"').'"> '.$langs->trans("DisableConciliation");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Accountancy code
|
// Accountancy code
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ if ($result)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
// Releve rappro
|
// Releve rappro
|
||||||
if ($acct->rappro) // Si compte rapprochable
|
if ($acct->canBeConciliated() > 0) // Si compte rapprochable
|
||||||
{
|
{
|
||||||
print '<br>'."\n";
|
print '<br>'."\n";
|
||||||
print_fiche_titre($langs->trans("Reconciliation"),'','');
|
print_fiche_titre($langs->trans("Reconciliation"),'','');
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0
|
|||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$menu->add_submenu('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
|
$menu->add_submenu('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
|
||||||
if ($objp->rappro && $objp->courant != 2) // If not cash account and can be reconciliate
|
if ($objp->rappro && $objp->courant != 2 && ! $objp->clos) // If not cash account and not closed and can be reconciliate
|
||||||
{
|
{
|
||||||
$menu->add_submenu('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
|
$menu->add_submenu('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user