Qual: Modification des commandes BEGIN, COMMIT et ROLLBACK par l'quivalent de la couche d'abstraction de base $db->begin(), $db->commit() et $db->rollback
This commit is contained in:
parent
add221b92e
commit
2e3bfbe97c
@ -120,7 +120,7 @@ class BonPrelevement
|
||||
{
|
||||
$error == 0;
|
||||
|
||||
if ($this->db->query("BEGIN"))
|
||||
if ($this->db->begin())
|
||||
{
|
||||
|
||||
|
||||
@ -179,12 +179,12 @@ class BonPrelevement
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->query("COMMIT");
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("ROLLBACK");
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("bon-prelevment::set_credite ROLLBACK ");
|
||||
return -1;
|
||||
}
|
||||
@ -206,7 +206,7 @@ class BonPrelevement
|
||||
{
|
||||
$error == 0;
|
||||
|
||||
if ($this->db->query("BEGIN"))
|
||||
if ($this->db->begin())
|
||||
{
|
||||
|
||||
|
||||
@ -229,12 +229,12 @@ class BonPrelevement
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->query("COMMIT");
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("ROLLBACK");
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("bon-prelevment::set_infotrans ROLLBACK ");
|
||||
return -1;
|
||||
}
|
||||
@ -254,7 +254,7 @@ class BonPrelevement
|
||||
{
|
||||
$error == 0;
|
||||
|
||||
if ($this->db->query("BEGIN"))
|
||||
if ($this->db->begin())
|
||||
{
|
||||
|
||||
|
||||
@ -278,12 +278,12 @@ class BonPrelevement
|
||||
*/
|
||||
if ($error == 0)
|
||||
{
|
||||
$this->db->query("COMMIT");
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("ROLLBACK");
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("bon-prelevment::set_infotrans ROLLBACK ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -44,10 +44,13 @@ class PaiementCharge {
|
||||
|
||||
function PaiementCharge($DB) {
|
||||
$this->db = $DB;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Creation d'un paiement de charge sociale
|
||||
*
|
||||
*/
|
||||
function create($user) {
|
||||
$sql_err = 0;
|
||||
/*
|
||||
@ -101,10 +104,10 @@ class PaiementCharge {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank générée
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* \brief Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank générée
|
||||
*
|
||||
*/
|
||||
function update_fk_bank($id_bank) {
|
||||
$sql = "UPDATE llx_paiementcharge set fk_bank = ".$id_bank." where rowid = ".$this->id;
|
||||
$result = $this->db->query($sql);
|
||||
@ -144,10 +147,10 @@ class ChargeSociales {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrouve et charge une charge sociale
|
||||
* Retour: 1 si trouve, 0 sinon
|
||||
*/
|
||||
/**
|
||||
* \brief Retrouve et charge une charge sociale
|
||||
* \return int 1 si trouve, 0 sinon
|
||||
*/
|
||||
function fetch($id) {
|
||||
$sql = "SELECT cs.rowid,".$this->db->pdate("cs.date_ech")." as date_ech,".$this->db->pdate("cs.date_pai")." as date_pai";
|
||||
$sql .=", cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, ".$this->db->pdate("cs.periode")." as periode, c.libelle";
|
||||
@ -214,8 +217,8 @@ class ChargeSociales {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag la charge comme payée complètement
|
||||
*
|
||||
* \brief Tag la charge comme payée complètement
|
||||
* \param rowid id de la ligne a modifier
|
||||
*/
|
||||
function set_payed($rowid)
|
||||
{
|
||||
@ -225,16 +228,15 @@ class ChargeSociales {
|
||||
|
||||
|
||||
/**
|
||||
* Renvoi le staut sous forme de libellé d'une charge
|
||||
*
|
||||
* \brief Renvoi le staut de la charge sous forme de libellé
|
||||
* \return string libellé du statut
|
||||
*/
|
||||
function getLibStatut() {
|
||||
if ($this->paye == 0) { return "Non Payé"; }
|
||||
else { return "Payé"; }
|
||||
global $langs;
|
||||
|
||||
if ($this->paye == 0) { return $langs->trans("Unpayed"); }
|
||||
else { return $langs->trans("Payed"); }
|
||||
}
|
||||
}
|
||||
/*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
@ -82,7 +82,7 @@ class ComptaExportPoivre
|
||||
|
||||
$this->Agregate($linec);
|
||||
|
||||
$this->db->query("BEGIN");
|
||||
$this->db->begin();
|
||||
|
||||
$dt = strftime('EC%y%m', time());
|
||||
|
||||
@ -303,12 +303,12 @@ class ComptaExportPoivre
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->query("COMMIT");
|
||||
$this->db->commit();
|
||||
dolibarr_syslog("ComptaExportPoivre::Export COMMIT");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("ROLLBACK");
|
||||
$this->db->rollback();
|
||||
dolibarr_syslog("ComptaExportPoivre::Export ROLLBACK");
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
/**
|
||||
\file htdocs/compta/sociales/charges.php
|
||||
\ingroup compta
|
||||
\brief Fiche d'une charge sociale
|
||||
@ -183,7 +183,7 @@ if ($chid > 0)
|
||||
// Supprimer
|
||||
if ($cha->paye == 0 && $totalpaye <=0 && $user->rights->compta->charges)
|
||||
{
|
||||
print "<a class=\"tabAction\" href=\"charges.php?id=$cha->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
print "<a class=\"butDelete\" href=\"charges.php?id=$cha->id&action=delete\">".$langs->trans("Delete")."</a>";
|
||||
}
|
||||
|
||||
// Emettre paiement
|
||||
|
||||
@ -447,8 +447,8 @@ class Societe {
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Suppression d'une societe de la base
|
||||
* \todo Cette fonction n'est pas utilisée. Attente des contraintes d'intégrité dans MySql
|
||||
* \brief Suppression d'une societe de la base avec ses dépendances (contacts, rib...)
|
||||
* \param id id de la societe à supprimer
|
||||
*/
|
||||
|
||||
function delete($id)
|
||||
@ -456,7 +456,7 @@ class Societe {
|
||||
dolibarr_syslog("Societe::Delete");
|
||||
$sqr = 0;
|
||||
|
||||
if ( $this->db->query("BEGIN") )
|
||||
if ( $this->db->begin())
|
||||
{
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."socpeople ";
|
||||
$sql .= " WHERE fk_soc = " . $id .";";
|
||||
@ -500,7 +500,7 @@ class Societe {
|
||||
|
||||
if ($sqr == 3)
|
||||
{
|
||||
$this->db->query("COMMIT");
|
||||
$this->db->commit();
|
||||
|
||||
// Suppression du répertoire document
|
||||
$docdir = $conf->societe->dir_output . "/" . $id;
|
||||
@ -514,7 +514,7 @@ class Societe {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->query("ROLLBACK");
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user