Fixed: Category of a bank transaction was not saved.
This commit is contained in:
parent
18d471041d
commit
b9412fdb26
@ -17,6 +17,7 @@ For users:
|
|||||||
- Can add contacts to a supplier invoice.
|
- Can add contacts to a supplier invoice.
|
||||||
- Fixed: When an invoice is changed back to status draft, warehouse is increased
|
- Fixed: When an invoice is changed back to status draft, warehouse is increased
|
||||||
back.
|
back.
|
||||||
|
- Fixed: Category of a bank transaction was not saved.
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Added ca_ES language files
|
- Added ca_ES language files
|
||||||
|
|||||||
@ -789,15 +789,20 @@ class AccountLine
|
|||||||
var $error;
|
var $error;
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
var $rowid;
|
var $id;
|
||||||
var $rappro;
|
var $ref;
|
||||||
var $datec;
|
var $datec;
|
||||||
var $dateo;
|
var $dateo;
|
||||||
var $datev;
|
var $datev;
|
||||||
var $amount;
|
var $amount;
|
||||||
var $label;
|
var $label;
|
||||||
var $note;
|
|
||||||
var $fk_account;
|
var $fk_account;
|
||||||
|
var $note;
|
||||||
|
var $fk_user_author;
|
||||||
|
var $fk_user_rappro;
|
||||||
|
var $num_releve;
|
||||||
|
var $num_chq;
|
||||||
|
var $rappro;
|
||||||
|
|
||||||
var $bank_account_label;
|
var $bank_account_label;
|
||||||
|
|
||||||
@ -837,6 +842,7 @@ class AccountLine
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
|
|
||||||
|
$this->id = $rowid;
|
||||||
$this->rowid = $rowid;
|
$this->rowid = $rowid;
|
||||||
$this->ref = $rowid;
|
$this->ref = $rowid;
|
||||||
|
|
||||||
@ -932,7 +938,7 @@ class AccountLine
|
|||||||
$sql.= " dateo='".$this->db->idate($this->dateo)."'";
|
$sql.= " dateo='".$this->db->idate($this->dateo)."'";
|
||||||
$sql.= " WHERE rowid = ".$this->rowid;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
dolibarr_syslog("AccountLine::update sql=".$sql);
|
dol_syslog("AccountLine::update sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -943,12 +949,54 @@ class AccountLine
|
|||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dolibarr_syslog("AccountLine::update ".$this->error);
|
dol_syslog("AccountLine::update ".$this->error);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Update conciliation field
|
||||||
|
* \param user Objet user making update
|
||||||
|
* \param cat Category id
|
||||||
|
* \param int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function update_conciliation($user,$cat)
|
||||||
|
{
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||||
|
$sql.= " set rappro=1, num_releve='".$this->num_releve."',";
|
||||||
|
$sql.= " fk_user_rappro=".$user->id;
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
dol_syslog("AccountLine::update_conciliation sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if (! empty($cat))
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ)";
|
||||||
|
$sql.= " VALUES (".$this->id.", ".$cat.")";
|
||||||
|
|
||||||
|
dol_syslog("AccountLine::update_conciliation sql=".$sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
|
||||||
|
// No error check. Can fail if category already affected
|
||||||
|
}
|
||||||
|
|
||||||
|
$bankline->rappro=1;
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Charge les informations d'ordre info dans l'objet facture
|
* \brief Charge les informations d'ordre info dans l'objet facture
|
||||||
* \param id Id de la facture a charger
|
* \param id Id de la facture a charger
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
|
* Copyright (C) 2003 Xavier DUTOIT <doli@sydesy.com>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -22,7 +22,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/compta/bank/ligne.php
|
* \file htdocs/compta/bank/ligne.php
|
||||||
* \ingroup compta
|
* \ingroup compta
|
||||||
* \brief Page edition d'une ecriture bancaire
|
* \brief Page to edit a bank transaction record
|
||||||
* \version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ if ($_POST["action"] == 'emetteur')
|
|||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["action"] == 'num_releve')
|
if ($user->rights->banque->consolidate && $_POST["action"] == 'num_releve')
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -147,6 +147,7 @@ if ($_POST["action"] == 'num_releve')
|
|||||||
if (! $num_rel) $sql.= ", rappro = 0";
|
if (! $num_rel) $sql.= ", rappro = 0";
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
|
dol_syslog("ligne.php sql=".$sql, LOG_DEBUG);
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/compta/bank/rappro.php
|
* \file htdocs/compta/bank/rappro.php
|
||||||
\ingroup banque
|
* \ingroup banque
|
||||||
\brief Page de rapprochement bancaire
|
* \brief Page de rapprochement bancaire
|
||||||
\version $Id$
|
* \version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
@ -53,50 +53,21 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
|
|||||||
if ($user->rights->banque->consolidate && $_POST["action"] == 'rappro')
|
if ($user->rights->banque->consolidate && $_POST["action"] == 'rappro')
|
||||||
{
|
{
|
||||||
// Definition, nettoyage parametres
|
// Definition, nettoyage parametres
|
||||||
$valrappro=1;
|
|
||||||
$num_releve=trim($_POST["num_releve"]);
|
$num_releve=trim($_POST["num_releve"]);
|
||||||
|
|
||||||
if ($num_releve)
|
if ($num_releve)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$bankline=new AccountLine($db);
|
||||||
|
$result=$bankline->fetch($_POST["rowid"]);
|
||||||
|
$bankline->num_releve=$_POST["num_releve"];
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
$result=$bankline->update_conciliation($user,$_POST["cat"]);
|
||||||
$sql.= " set rappro=".$valrappro.", num_releve='".$_POST["num_releve"]."',";
|
if ($result < 0) $mesg=$bankline->error;
|
||||||
$sql.= " fk_user_rappro=".$user->id;
|
|
||||||
$sql.= " WHERE rowid=".$_POST["rowid"];
|
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
if ($cat1 && $_POST["action"])
|
|
||||||
{
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ)";
|
|
||||||
$sql.= " VALUES ($rowid, $cat1)";
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$langs->load("errors");
|
||||||
dolibarr_print_error($db);
|
$mesg='<div class="error">'.$langs->trans("ErrorPleaseTypeBankTransactionReportName").'</div>';
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$db->rollback();
|
|
||||||
dolibarr_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$msg="Erreur: Saisissez le relevé qui référence la transaction pour la rapprocher.";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +106,7 @@ if ($resql) {
|
|||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form=new Form($db);
|
$form=new Form($db);
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -157,9 +129,7 @@ if ($resql)
|
|||||||
print_titre($langs->trans("Reconciliation").': <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
print_titre($langs->trans("Reconciliation").': <a href="account.php?account='.$_GET["account"].'">'.$acct->label.'</a>');
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if ($msg) {
|
if ($mesg) print $mesg."<br>";
|
||||||
print "$msg<br><br>";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Affiche nom des derniers relevés
|
// Affiche nom des derniers relevés
|
||||||
$nbmax=5;
|
$nbmax=5;
|
||||||
@ -183,7 +153,7 @@ if ($resql)
|
|||||||
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
$liste='<a href="releve.php?account='.$_GET["account"].'&num='.$objr->num_releve.'">'.$objr->num_releve.'</a> '.$liste;
|
||||||
}
|
}
|
||||||
if ($num >= $nbmax) $liste="... ".$liste;
|
if ($num >= $nbmax) $liste="... ".$liste;
|
||||||
print "$liste";
|
print $liste;
|
||||||
if ($num > 0) print '<br><br>';
|
if ($num > 0) print '<br><br>';
|
||||||
else print $langs->trans("None").'<br><br>';
|
else print $langs->trans("None").'<br><br>';
|
||||||
}
|
}
|
||||||
@ -365,15 +335,15 @@ if ($resql)
|
|||||||
|
|
||||||
|
|
||||||
// Affiche zone saisie relevé + bouton "Rapprocher"
|
// Affiche zone saisie relevé + bouton "Rapprocher"
|
||||||
if ($objp->do <= mktime())
|
if ($objp->do <= gmmktime())
|
||||||
{
|
{
|
||||||
print '<td align="center" nowrap="nowrap">';
|
print '<td align="center" nowrap="nowrap">';
|
||||||
print "<input class=\"flat\" name=\"num_releve\" type=\"text\" value=\"\" size=\"8\">";
|
print '<input class="flat" name="num_releve" type="text" value="'.$objp->num_releve.'" size="8">';
|
||||||
print ' ';
|
print ' ';
|
||||||
print "<input class=\"button\" type=\"submit\" value=\"".$langs->trans("Rapprocher")."\">";
|
print "<input class=\"button\" type=\"submit\" value=\"".$langs->trans("Rapprocher")."\">";
|
||||||
if ($options)
|
if ($options)
|
||||||
{
|
{
|
||||||
print "<br><select class=\"flat\" name=\"cat1\">$options";
|
print "<br><select class=\"flat\" name=\"cat\">$options";
|
||||||
print "</select>";
|
print "</select>";
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
@ -381,7 +351,7 @@ if ($resql)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
print 'Ecriture future. Ne peut pas encore être rapprochée.';
|
print 'Transaction in futur. No way to conciliate.';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,3 +43,4 @@ ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete.
|
|||||||
ErrorLDAPMakeManualTest=A .ldif file has been generated in directory %s. Try to load it manually from command line to have more informations on errors.
|
ErrorLDAPMakeManualTest=A .ldif file has been generated in directory %s. Try to load it manually from command line to have more informations on errors.
|
||||||
ErrorCantSaveADoneUserWithZeroPercentage=Can't save an action with "statut not started" if field "done by" is also filled.
|
ErrorCantSaveADoneUserWithZeroPercentage=Can't save an action with "statut not started" if field "done by" is also filled.
|
||||||
ErrorBillRefAlreadyExists=Ref used for creation already exists.
|
ErrorBillRefAlreadyExists=Ref used for creation already exists.
|
||||||
|
ErrorPleaseTypeBankTransactionReportName=Please type bank receipt name where transaction is reported (Format YYYYMM or YYYYMMDD)
|
||||||
|
|||||||
@ -43,3 +43,4 @@ ErrorLDAPSetupNotComplete=Le matching Dolibarr-LDAP est incomplet.
|
|||||||
ErrorLDAPMakeManualTest=Un fichier .ldif a été généré dans le répertoire %s. Essayer de charger ce fichier en manuel depuis la ligne de commande pour plus de détail sur l'erreur.
|
ErrorLDAPMakeManualTest=Un fichier .ldif a été généré dans le répertoire %s. Essayer de charger ce fichier en manuel depuis la ligne de commande pour plus de détail sur l'erreur.
|
||||||
ErrorCantSaveADoneUserWithZeroPercentage=Impossible sauver une action à l'état non commencé avec un utilisateur défini comme ayant fait l'action.
|
ErrorCantSaveADoneUserWithZeroPercentage=Impossible sauver une action à l'état non commencé avec un utilisateur défini comme ayant fait l'action.
|
||||||
ErrorBillRefAlreadyExists=La référence utilisée pour la création existe déjà
|
ErrorBillRefAlreadyExists=La référence utilisée pour la création existe déjà
|
||||||
|
ErrorPleaseTypeBankTransactionReportName=Veuiller saisir le nom de relevé bancaire sur lequel l'écriture est constaté (Format AAAAMM ou AAAMMJJ)
|
||||||
Loading…
Reference in New Issue
Block a user