2
0
forked from Wavyzz/dolibarr

Fix: La suppression d'une adhsion n'effaait pas l'criture bancaire.

This commit is contained in:
Laurent Destailleur
2007-11-18 22:10:19 +00:00
parent 74c8bbbe7f
commit 4ce1d87927
6 changed files with 95 additions and 69 deletions

View File

@@ -190,11 +190,6 @@ class Cotisation extends CommonObject
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
$accountline=new AccountLine($this->db); $accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank); $result=$accountline->fetch($this->fk_bank);
if ($accountline->rappro)
{
$this->error="ErrorBankRecordConcialiated";
return -1;
}
} }
$this->db->begin(); $this->db->begin();
@@ -209,7 +204,7 @@ class Cotisation extends CommonObject
{ {
if ($this->fk_bank) if ($this->fk_bank)
{ {
$result=$accountline->delete(); $result=$accountline->delete(); // Renvoi faux si ligne rapprocher
if ($result > 0) if ($result > 0)
{ {
$this->db->commit(); $this->db->commit();
@@ -217,6 +212,7 @@ class Cotisation extends CommonObject
} }
else else
{ {
$this->error=$accountline->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }

View File

@@ -130,7 +130,7 @@ if ($user->rights->adherent->cotisation->creer && $_REQUEST["action"] == 'update
if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes') if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
{ {
$result=$subscription->fetch($rowid); $result=$subscription->fetch($rowid);
$result=$subscription->delete($rowid); $result=$subscription->delete();
if ($result > 0) if ($result > 0)
{ {
Header("Location: card_subscriptions.php?rowid=".$subscription->fk_adherent); Header("Location: card_subscriptions.php?rowid=".$subscription->fk_adherent);

View File

@@ -244,43 +244,51 @@ class DoliDb
} }
/** /**
\brief Debut d'une transaction. \brief Debut d'une transaction.
\return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur \return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur
*/ */
function begin() function begin()
{ {
if (! $this->transaction_opened) if (! $this->transaction_opened)
{ {
$ret=$this->query("BEGIN TRANSACTION"); $ret=$this->query("BEGIN TRANSACTION");
if ($ret) $this->transaction_opened++; if ($ret)
return $ret; {
} $this->transaction_opened++;
else dolibarr_syslog("BEGIN Transaction",LOG_DEBUG);
{ }
$this->transaction_opened++; return $ret;
return 1; }
} else
} {
$this->transaction_opened++;
return 1;
}
}
/** /**
\brief Validation d'une transaction \brief Validation d'une transaction
\return int 1 si validation ok ou niveau de transaction non ouverte, 0 en cas d'erreur \return int 1 si validation ok ou niveau de transaction non ouverte, 0 en cas d'erreur
*/ */
function commit() function commit()
{ {
if ($this->transaction_opened<=1) if ($this->transaction_opened <= 1)
{ {
$ret=$this->query("COMMIT TRANSACTION"); $ret=$this->query("COMMIT TRANSACTION");
if ($ret) $this->transaction_opened=0; if ($ret)
return $ret; {
} $this->transaction_opened=0;
else dolibarr_syslog("COMMIT Transaction",LOG_DEBUG);
{ }
$this->transaction_opened--; return $ret;
return 1; }
} else
} {
$this->transaction_opened--;
return 1;
}
}
/** /**
\brief Annulation d'une transaction et retour aux anciennes valeurs \brief Annulation d'une transaction et retour aux anciennes valeurs
@@ -288,13 +296,11 @@ class DoliDb
*/ */
function rollback() function rollback()
{ {
dolibarr_syslog("ROLLBACK ".$this->transaction_opened, LOG_ERR);
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("ROLLBACK TRANSACTION"); $ret=$this->query("ROLLBACK TRANSACTION");
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("ROLLBACK Transaction",LOG_DEBUG);
return $ret; return $ret;
} }
else else

View File

@@ -299,20 +299,24 @@ class DoliDb
\brief Debut d'une transaction. \brief Debut d'une transaction.
\return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur \return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur
*/ */
function begin() function begin()
{ {
if (! $this->transaction_opened) if (! $this->transaction_opened)
{ {
$ret=$this->query("BEGIN"); $ret=$this->query("BEGIN");
if ($ret) $this->transaction_opened++; if ($ret)
return $ret; {
} $this->transaction_opened++;
else dolibarr_syslog("BEGIN Transaction",LOG_DEBUG);
{ }
$this->transaction_opened++; return $ret;
return 1; }
} else
} {
$this->transaction_opened++;
return 1;
}
}
/** /**
\brief Validation d'une transaction \brief Validation d'une transaction
@@ -323,7 +327,11 @@ class DoliDb
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("COMMIT"); $ret=$this->query("COMMIT");
if ($ret) $this->transaction_opened=0; if ($ret)
{
$this->transaction_opened=0;
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG);
}
return $ret; return $ret;
} }
else else
@@ -339,13 +347,11 @@ class DoliDb
*/ */
function rollback() function rollback()
{ {
dolibarr_syslog("ROLLBACK ".$this->transaction_opened, LOG_ERR);
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("ROLLBACK"); $ret=$this->query("ROLLBACK");
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("ROLLBACK Transaction",LOG_DEBUG);
return $ret; return $ret;
} }
else else

View File

@@ -309,7 +309,11 @@ class DoliDb
if (! $this->transaction_opened) if (! $this->transaction_opened)
{ {
$ret=$this->query("BEGIN"); $ret=$this->query("BEGIN");
if ($ret) $this->transaction_opened++; if ($ret)
{
$this->transaction_opened++;
dolibarr_syslog("BEGIN Transaction",LOG_DEBUG);
}
return $ret; return $ret;
} }
else else
@@ -328,7 +332,11 @@ class DoliDb
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("COMMIT"); $ret=$this->query("COMMIT");
if ($ret) $this->transaction_opened=0; if ($ret)
{
$this->transaction_opened=0;
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG);
}
return $ret; return $ret;
} }
else else
@@ -348,6 +356,7 @@ class DoliDb
{ {
$ret=$this->query("ROLLBACK"); $ret=$this->query("ROLLBACK");
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("ROLLBACK Transaction",LOG_DEBUG);
return $ret; return $ret;
} }
else else

View File

@@ -252,7 +252,11 @@ class DoliDb
if (! $this->transaction_opened) if (! $this->transaction_opened)
{ {
$ret=$this->query("BEGIN;"); $ret=$this->query("BEGIN;");
if ($ret) $this->transaction_opened++; if ($ret)
{
$this->transaction_opened++;
dolibarr_syslog("BEGIN Transaction",LOG_DEBUG);
}
return $ret; return $ret;
} }
else else
@@ -271,7 +275,11 @@ class DoliDb
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("COMMIT;"); $ret=$this->query("COMMIT;");
if ($ret) $this->transaction_opened=0; if ($ret)
{
$this->transaction_opened=0;
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG);
}
return $ret; return $ret;
} }
else else
@@ -290,7 +298,8 @@ class DoliDb
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("ROLLBACK;"); $ret=$this->query("ROLLBACK;");
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("ROLLBACK Transaction",LOG_DEBUG);
return $ret; return $ret;
} }
else else