Fix: Gestion transaction sur commande

Qual: Ajout des methode fetch sur les lignes commandes, facture, propale
New: Debut script migration pour alimenter de maniere retroactive les champs total_ht, total_tva, total_ttc au niveau lignes
This commit is contained in:
Laurent Destailleur
2006-06-17 14:13:49 +00:00
parent e6800a461a
commit 9755133e1a
14 changed files with 542 additions and 253 deletions

View File

@@ -326,20 +326,27 @@ class Commande
// Nettoyage parametres // Nettoyage parametres
$this->brouillon = 1; // On positionne en mode brouillon la commande $this->brouillon = 1; // On positionne en mode brouillon la commande
dolibarr_syslog("Commande.class.php::create");
// V<>rification param<61>tres // V<>rification param<61>tres
if ($this->source < 0) if ($this->source < 0)
{ {
$this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source")); $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Source"));
dolibarr_syslog("Commande.class.php::create ".$this->error);
return -1; return -1;
} }
if (! $remise) $remise=0; if (! $remise) $remise=0;
if (! $this->projetid) $this->projetid = 0; if (! $this->projetid) $this->projetid = 0;
dolibarr_syslog("Commande.class.php::create");
$soc = new Societe($this->db); $soc = new Societe($this->db);
$soc->fetch($this->socidp); $result=$soc->fetch($this->soc_id);
if ($result < 0)
{
$this->error="Failed to fetch company";
dolibarr_syslog("Commande.class.php::create ".$this->error);
return -2;
}
$this->db->begin(); $this->db->begin();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande ('; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commande (';
@@ -356,6 +363,8 @@ class Commande
$sql.= " '".$this->remise_absolue."',"; $sql.= " '".$this->remise_absolue."',";
$sql.= " '".$this->remise_percent."')"; $sql.= " '".$this->remise_percent."')";
dolibarr_syslog("Commande.class.php::create sql=".$sql);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@@ -407,10 +416,12 @@ class Commande
$this->db->query($sql); $this->db->query($sql);
} }
$this->db->commit();
return $this->id; return $this->id;
} }
else else
{ {
$this->db->rollback();
return -1; return -1;
} }
} }
@@ -418,7 +429,8 @@ class Commande
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return 0; $this->db->rollback();
return -1;
} }
} }
@@ -441,7 +453,7 @@ class Commande
*/ */
function addline($commandeid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0) function addline($commandeid, $desc, $pu, $qty, $txtva, $fk_product=0, $remise_percent=0)
{ {
dolibarr_syslog("commande.class.php::addline $commandeid, $desc, $pu, $qty, $txtva, $fk_product, $remise_percent"); dolibarr_syslog("commande.class.php::addline this->id=$this->id, $commandeid, $desc, $pu, $qty, $txtva, $fk_product, $remise_percent");
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
if ($this->statut == 0) if ($this->statut == 0)
@@ -676,10 +688,10 @@ class Commande
} }
} }
/** /**
* Lit une commande * \brief Recup<75>re de la base les caract<63>ristiques d'une commande
* * \param rowid id de la commande <20> r<>cup<75>rer
*/ */
function fetch($id) function fetch($id)
{ {
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,'; $sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,';
@@ -687,157 +699,168 @@ class Commande
$sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison'; $sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
$sql.= ' WHERE c.rowid = '.$id; $sql.= ' WHERE c.rowid = '.$id;
dolibarr_syslog("Commande::fetch sql=$sql");
$result = $this->db->query($sql) ; $result = $this->db->query($sql) ;
if ( $result ) if ($result)
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; if ($obj)
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->soc_id = $obj->fk_soc;
$this->socidp = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva;
$this->total_ttc = $obj->total_ttc;
$this->date = $obj->date_commande;
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->facturee = $obj->facturee;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->projet_id = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->date_livraison = $obj->date_livraison;
$this->adresse_livraison_id = $obj->fk_adresse_livraison;
$this->db->free();
if ($this->cond_reglement_id)
{
$sql = "SELECT rowid, libelle, code";
$sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
$sql.= " WHERE rowid = ".$this->cond_reglement_id;
$resqlcond = $this->db->query($sql);
if ($resqlcond)
{
$objc = $this->db->fetch_object($resqlcond);
$this->cond_reglement = $objc->libelle;
$this->cond_reglement_code = $objc->code;
}
}
if ($this->user_author_id)
{
$sql = "SELECT name, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE rowid = ".$this->user_author_id;
$resqluser = $this->db->query($sql);
if ($resqluser)
{
$obju = $this->db->fetch_object($resqluser);
$this->user_author_name = $obju->name;
$this->user_author_firstname = $obju->firstname;
}
}
if ($this->statut == 0)
$this->brouillon = 1;
// exp pdf -----------
$this->lignes = array();
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, l.coef,';
$sql.= ' p.label, p.description as product_desc, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_commande = '.$this->id;
$sql.= ' ORDER BY l.rang';
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$ligne = new CommandeLigne($this->db);
$ligne->desc = $objp->description; // Description ligne
$ligne->qty = $objp->qty;
$ligne->tva_tx = $objp->tva_tx;
$ligne->subprice = $objp->subprice;
$ligne->remise_percent = $objp->remise_percent;
$ligne->price = $objp->price;
$ligne->product_id = $objp->fk_product;
$ligne->coef = $objp->coef;
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->ref = $objp->ref;
$this->lignes[$i] = $ligne;
//dolibarr_syslog("1 ".$ligne->desc);
//dolibarr_syslog("2 ".$ligne->product_desc);
$i++;
}
$this->db->free($result);
}
else
{
dolibarr_syslog("Propal::Fetch Erreur lecture des produits");
return -1;
}
// -------- exp pdf //
/*
* Propale associ<63>e
*/
$sql = 'SELECT cp.fk_propale';
$sql .= ' FROM '.MAIN_DB_PREFIX.'co_pr as cp';
$sql .= ' WHERE cp.fk_commande = '.$this->id;
if ($this->db->query($sql) )
{ {
if ($this->db->num_rows()) $this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->soc_id = $obj->fk_soc;
$this->socidp = $obj->fk_soc;
$this->statut = $obj->fk_statut;
$this->user_author_id = $obj->fk_user_author;
$this->total_ht = $obj->total_ht;
$this->total_tva = $obj->tva;
$this->total_ttc = $obj->total_ttc;
$this->date = $obj->date_commande;
$this->remise = $obj->remise;
$this->remise_percent = $obj->remise_percent;
$this->remise_absolue = $obj->remise_absolue;
$this->source = $obj->source;
$this->facturee = $obj->facturee;
$this->note = $obj->note;
$this->note_public = $obj->note_public;
$this->projet_id = $obj->fk_projet;
$this->modelpdf = $obj->model_pdf;
$this->cond_reglement_id = $obj->fk_cond_reglement;
$this->mode_reglement_id = $obj->fk_mode_reglement;
$this->date_livraison = $obj->date_livraison;
$this->adresse_livraison_id = $obj->fk_adresse_livraison;
$this->db->free();
if ($this->cond_reglement_id)
{ {
$obj = $this->db->fetch_object(); $sql = "SELECT rowid, libelle, code";
$this->propale_id = $obj->fk_propale; $sql.= " FROM ".MAIN_DB_PREFIX."cond_reglement";
$sql.= " WHERE rowid = ".$this->cond_reglement_id;
$resqlcond = $this->db->query($sql);
if ($resqlcond)
{
$objc = $this->db->fetch_object($resqlcond);
$this->cond_reglement = $objc->libelle;
$this->cond_reglement_code = $objc->code;
}
}
if ($this->user_author_id)
{
$sql = "SELECT name, firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE rowid = ".$this->user_author_id;
$resqluser = $this->db->query($sql);
if ($resqluser)
{
$obju = $this->db->fetch_object($resqluser);
$this->user_author_name = $obju->name;
$this->user_author_firstname = $obju->firstname;
}
}
if ($this->statut == 0) $this->brouillon = 1;
// \todo Utiliser la classe CommandeLigne au lieu de ce code
$this->lignes = array();
$sql = 'SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, l.coef,';
$sql.= ' p.label, p.description as product_desc, p.ref, p.fk_product_type, p.rowid as prodid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
$sql.= ' WHERE l.fk_commande = '.$this->id;
$sql.= ' ORDER BY l.rang';
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$ligne = new CommandeLigne($this->db);
$ligne->desc = $objp->description; // Description ligne
$ligne->qty = $objp->qty;
$ligne->tva_tx = $objp->tva_tx;
$ligne->subprice = $objp->subprice;
$ligne->remise_percent = $objp->remise_percent;
$ligne->price = $objp->price;
$ligne->product_id = $objp->fk_product;
$ligne->coef = $objp->coef;
$ligne->libelle = $objp->label; // Label produit
$ligne->product_desc = $objp->product_desc; // Description produit
$ligne->ref = $objp->ref;
$this->lignes[$i] = $ligne;
//dolibarr_syslog("1 ".$ligne->desc);
//dolibarr_syslog("2 ".$ligne->product_desc);
$i++;
}
$this->db->free($result);
}
else
{
$this->error=$this->db->error();
dolibarr_syslog("Commande::Fetch Erreur sql=$sql, ".$this->error);
return -1;
}
// -------- exp pdf //
/*
* Propale associ<63>e
*/
$sql = 'SELECT cp.fk_propale';
$sql .= ' FROM '.MAIN_DB_PREFIX.'co_pr as cp';
$sql .= ' WHERE cp.fk_commande = '.$this->id;
if ($this->db->query($sql))
{
if ($this->db->num_rows())
{
$obj = $this->db->fetch_object();
$this->propale_id = $obj->fk_propale;
}
return 1;
}
else
{
dolibarr_print_error($this->db);
return -1;
} }
return 1;
} }
else else
{ {
dolibarr_print_error($this->db); $this->error="Order not found";
return -1; return -2;
} }
} }
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return -1; return -3;
} }
} }
/* /*
* *
* *
* *
*/ */
function set_pdf_model($user, $modelpdf)
function set_pdf_model($user, $modelpdf) {
{
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
{ {
@@ -2103,10 +2126,54 @@ class CommandeLigne
var $product_desc; // Description produit var $product_desc; // Description produit
var $ref; // Reference produit var $ref; // Reference produit
function CommandeLigne() /**
* \brief Constructeur d'objets ligne de commande
* \param DB handler d'acc<63>s base de donn<6E>e
*/
function CommandeLigne($DB)
{ {
$this->db= $DB ;
} }
/**
* \brief Recup<75>re l'objet ligne de commande
* \param rowid id de la ligne de commande
*/
function fetch($rowid)
{
$sql = 'SELECT fk_commande, fk_product, description, price, qty, rowid, tva_tx,';
$sql.= ' label,';
$sql.= ' remise, remise_percent, fk_remise_except, subprice,';
$sql.= ' info_bits, total_ht, total_tva, total_ttc, coef, rang';
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet WHERE rowid = '.$rowid;
$result = $this->db->query($sql);
if ($result)
{
$objp = $this->db->fetch_object($result);
$this->fk_propal = $objp->fk_propal;
$this->label = $objp->label;
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->price = $objp->price;
$this->subprice = $objp->subprice;
$this->tva_taux = $objp->tva_taux;
$this->remise = $objp->remise;
$this->remise_percent = $objp->remise_percent;
$this->fk_remise_except = $objp->fk_remise_except;
$this->produit_id = $objp->fk_product;
$this->info_bits = $objp->info_bits;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
$this->coef = $objp->coef;
$this->rang = $objp->rang;
$this->db->free($result);
}
else
{
dolibarr_print_error($this->db);
}
}
} }
?> ?>

View File

@@ -202,6 +202,11 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
{ {
$commande = new Commande($db); $commande = new Commande($db);
$ret=$commande->fetch($_POST['id']); $ret=$commande->fetch($_POST['id']);
if ($ret < 0)
{
dolibarr_print_error($db,$commande->error);
exit;
}
// Ecrase $pu par celui du produit // Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit // Ecrase $desc par celui du produit

View File

@@ -2413,25 +2413,28 @@ class FactureLigne
/** /**
* \brief Recup<75>re l'objet ligne de facture * \brief Recup<75>re l'objet ligne de facture
* \param rowid id de la ligne de facture * \param rowid id de la ligne de facture
* \param societe_id id de la societe
*/ */
function fetch($rowid, $societe_id=0) function fetch($rowid)
{ {
$sql = 'SELECT fk_product, description, price, qty, rowid, tva_taux, remise, remise_percent,'; $sql = 'SELECT fk_facture, fk_product, description, price, qty, rowid, tva_taux,';
$sql.= ' subprice, '.$this->db->pdate('date_start').' as date_start,'.$this->db->pdate('date_end').' as date_end,'; $sql.= ' remise, remise_percent, fk_remise_except, subprice,';
$sql.= ' info_bits, total_ht, total_tva, total_ttc'; $sql.= ' '.$this->db->pdate('date_start').' as date_start,'.$this->db->pdate('date_end').' as date_end,';
$sql.= ' info_bits, total_ht, total_tva, total_ttc, rang,';
$sql.= ' fk_code_ventilation, fk_export_compta';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet WHERE rowid = '.$rowid; $sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet WHERE rowid = '.$rowid;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$this->desc = stripslashes($objp->description); $this->fk_facture = $objp->fk_facture;
$this->desc = $objp->description;
$this->qty = $objp->qty; $this->qty = $objp->qty;
$this->price = $objp->price; $this->price = $objp->price;
$this->subprice = $objp->subprice; $this->subprice = $objp->subprice;
$this->tva_taux = $objp->tva_taux; $this->tva_taux = $objp->tva_taux;
$this->remise = $objp->remise; $this->remise = $objp->remise;
$this->remise_percent = $objp->remise_percent; $this->remise_percent = $objp->remise_percent;
$this->fk_remise_except = $objp->fk_remise_except;
$this->produit_id = $objp->fk_product; $this->produit_id = $objp->fk_product;
$this->date_start = $objp->date_start; $this->date_start = $objp->date_start;
$this->date_end = $objp->date_end; $this->date_end = $objp->date_end;
@@ -2439,6 +2442,9 @@ class FactureLigne
$this->total_ht = $objp->total_ht; $this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva; $this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc; $this->total_ttc = $objp->total_ttc;
$this->fk_code_ventilation = $objp->fk_code_ventilation;
$this->fk_export_compta = $objp->fk_export_compta;
$this->rang = $objp->rang;
$this->db->free($result); $this->db->free($result);
} }
else else

View File

@@ -40,6 +40,9 @@ $langs->setDefaultLang($setuplang);
$langs->load("install"); $langs->load("install");
dolibarr_install_syslog("Dolibarr install/upgrade process started");
pHeader($langs->trans("DolibarrWelcome"),""); // Etape suivante = license pHeader($langs->trans("DolibarrWelcome"),""); // Etape suivante = license
print $langs->trans("InstallEasy")."<br>"; print $langs->trans("InstallEasy")."<br>";

View File

@@ -36,6 +36,10 @@ $langs->setDefaultLang($setuplang);
$langs->load("admin"); $langs->load("admin");
$langs->load("install"); $langs->load("install");
dolibarr_install_syslog("Entering etape5.php page");
$success=0; $success=0;
if (file_exists($conffile)) if (file_exists($conffile))
@@ -191,6 +195,9 @@ print $langs->trans("GoToSetupArea");
print '</a>'; print '</a>';
dolibarr_install_syslog("Dolibarr install/setup finished");
pFooter(1,$setuplang); pFooter(1,$setuplang);
?> ?>

View File

@@ -110,18 +110,17 @@ function pFooter($nonext=0,$setuplang='')
} }
function xxdolibarr_syslog($message) function dolibarr_install_syslog($message)
{ {
// Les fonctions syslog ne sont pas toujours install豠ou autoris褳 chez les h补rgeurs // Ajout user a la log
if (function_exists("define_syslog_variables")) $login='install';
{ $message=sprintf("%-8s",$login)." ".$message;
// \todo D財ctiver sous Windows (gros probl笥 m謯ire et faute de protections)
// if (1 == 2) { $fileinstall="/tmp/dolibarr_install.log";
define_syslog_variables(); $file=@fopen($fileinstall,"a+");
openlog("dolibarr", LOG_PID | LOG_PERROR, LOG_USER); # LOG_USER au lieu de LOG_LOCAL0 car non accept矰ar tous les php if ($file) {
syslog(LOG_WARNING, $message); fwrite($file,strftime("%Y-%m-%d %H:%M:%S",time())." ".$level." ".$message."\n");
closelog(); fclose($file);
// }
} }
} }

View File

@@ -48,6 +48,9 @@ $langs->load("admin");
$langs->load("install"); $langs->load("install");
dolibarr_install_syslog("Entering upgrade.php page");
pHeader($langs->trans("DatabaseMigration"),"upgrade2","upgrade"); pHeader($langs->trans("DatabaseMigration"),"upgrade2","upgrade");
@@ -92,18 +95,20 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
{ {
print "<tr><td nowrap>"; print "<tr><td nowrap>";
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>"; print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td align=\"right\">".$langs->trans("OK")."</td></tr>";
dolibarr_install_syslog($langs->trans("ServerConnection")." : $dolibarr_main_db_host ".$langs->trans("OK"));
$ok = 1 ; $ok = 1 ;
} }
else else
{ {
print "<tr><td>Erreur lors de la cr<63>ation de : $dolibarr_main_db_name</td><td align=\"right\">".$langs->trans("Error")."</td></tr>"; print "<tr><td>".$langs->trans("ErrorFailedToCreateDatabase",$dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>";
dolibarr_install_syslog($langs->trans("ErrorFailedToCreateDatabase",$dolibarr_main_db_name));
} }
if ($ok) if ($ok)
{ {
if($db->database_selected == 1) if($db->database_selected == 1)
{ {
dolibarr_syslog("Connexion r<EFBFBD>ussie <20> la base : $dolibarr_main_db_name"); dolibarr_install_syslog("Database connection successfull : $dolibarr_main_db_name");
} }
else else
{ {
@@ -118,6 +123,7 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
$versionarray=$db->getVersionArray(); $versionarray=$db->getVersionArray();
print '<tr><td>'.$langs->trans("DatabaseVersion").'</td>'; print '<tr><td>'.$langs->trans("DatabaseVersion").'</td>';
print '<td align="right">'.$version.'</td></tr>'; print '<td align="right">'.$version.'</td></tr>';
dolibarr_install_syslog($langs->trans("DatabaseVersion")." : $version");
//print '<td align="right">'.join('.',$versionarray).'</td></tr>'; //print '<td align="right">'.join('.',$versionarray).'</td></tr>';
} }
@@ -189,9 +195,9 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
{ {
if ($sql) if ($sql)
{ {
// Ajout trace sur requete (eventuellement <20> commenter // Ajout trace sur requete (eventuellement <20> commenter si beaucoup de requetes)
// si beaucoup de requetes)
print('<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".$sql."'</td></tr>\n"); print('<tr><td valign="top">'.$langs->trans("Request").' '.($i+1)." sql='".$sql."'</td></tr>\n");
dolibarr_install_syslog($langs->trans("Request").' '.($i+1)." sql='".$sql);
if ($db->query($sql)) if ($db->query($sql))
{ {
@@ -219,6 +225,7 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1).'</td>'; print '<tr><td valign="top">'.$langs->trans("Request").' '.($i+1).'</td>';
print '<td valign="top">'.$langs->trans("Error")." ".$db->errno()." ".$sql."<br>".$db->error()."</td>"; print '<td valign="top">'.$langs->trans("Error")." ".$db->errno()." ".$sql."<br>".$db->error()."</td>";
print '</tr>'; print '</tr>';
dolibarr_install_syslog($langs->trans("Request").' '.($i+1)." ".$langs->trans("Error")." ".$db->errno()." ".$sql."<br>".$db->error());
$error++; $error++;
} }
} }
@@ -234,10 +241,16 @@ if (! isset($_GET["action"]) || $_GET["action"] == "upgrade")
if ($error == 0) if ($error == 0)
{ {
print '<tr><td>'; print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>';
print $langs->trans("ProcessMigrateScript").'</td><td align="right">'.$langs->trans("OK").'</td></tr>'; print '<td align="right">'.$langs->trans("OK").'</td></tr>';
$ok = 1; $ok = 1;
} }
else
{
print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>';
print '<td align="right"><div class="error">'.$langs->trans("KO").'</div></td></tr>';
$ok = 0;
}
} }
print '</table>'; print '</table>';

View File

@@ -30,6 +30,7 @@ include_once('./inc.php');
include_once('../facture.class.php'); include_once('../facture.class.php');
include_once('../propal.class.php'); include_once('../propal.class.php');
include_once('../commande/commande.class.php'); include_once('../commande/commande.class.php');
include_once('../lib/price.lib.php');
$grant_query=''; $grant_query='';
$etape = 2; $etape = 2;
@@ -52,6 +53,9 @@ $langs->load("bills");
$langs->load("suppliers"); $langs->load("suppliers");
dolibarr_install_syslog("Entering upgrade2.php page");
pHeader($langs->trans('DataMigration'),'etape5','upgrade'); pHeader($langs->trans('DataMigration'),'etape5','upgrade');
@@ -93,7 +97,7 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name); $db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
if ($db->connected != 1) if ($db->connected != 1)
{ {
print '<tr><td colspan="4">Erreur lors de la cr<63>ation de : '.$dolibarr_main_db_name.'</td><td align="right">'.$langs->trans('Error').'</td></tr>'; print '<tr><td colspan="4">'.$langs->trans("ErrorFailedToConnectToDatabase",$dolibarr_main_db_name).'</td><td align="right">'.$langs->trans('Error').'</td></tr>';
$error++; $error++;
} }
@@ -101,7 +105,7 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
{ {
if($db->database_selected == 1) if($db->database_selected == 1)
{ {
dolibarr_syslog('Connexion r<EFBFBD>ussie <20> la base : '.$dolibarr_main_db_name); dolibarr_install_syslog('Database connection successfull : '.$dolibarr_main_db_name);
} }
else else
{ {
@@ -166,17 +170,17 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
migrate_modeles($db,$langs,$conf); migrate_modeles($db,$langs,$conf);
/*
migrate_price_commande($db,$langs,$conf); migrate_price_commande($db,$langs,$conf);
migrate_price_propal($db,$langs,$conf); migrate_price_propal($db,$langs,$conf);
migrate_price_facture($db,$langs,$conf);
*/
// On commit dans tous les cas. // On commit dans tous les cas.
// La proc<6F>dure etant con<6F>ue pour pouvoir passer plusieurs fois quelquesoit la situation. // La proc<6F>dure etant con<6F>ue pour pouvoir passer plusieurs fois quelquesoit la situation.
$db->commit(); $db->commit();
migrate_price_facture($db,$langs,$conf);
$db->close(); $db->close();
} }
@@ -595,119 +599,203 @@ function migrate_paiementfourn_facturefourn($db,$langs,$conf)
/* /*
* Mise a jour des totaux facture * Mise a jour des totaux lignes de facture
*/ */
function migrate_price_facture($db,$langs,$conf) function migrate_price_facture($db,$langs,$conf)
{ {
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
$db->begin();
dolibarr_install_syslog("Upgrade data for invoice");
print '<br>'; print '<br>';
print '<b>'.$langs->trans('MigrationInvoice')."</b><br>\n"; print '<b>'.$langs->trans('MigrationInvoice')."</b><br>\n";
// TODO Ajout requete remplissage champ total_ht, totam_tva, total_ttc // Liste des lignes facture non a jour
// dans table det $sql = "SELECT fd.rowid, fd.qty, fd.subprice, fd.remise_percent, fd.tva_taux, ";
$sql.= " f.rowid as facid, f.remise_percent as remise_percent_global";
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE fd.fk_facture = f.rowid";
$sql.= " AND (fd.total_ttc = 0 or fd.total_ttc IS NULL) AND fd.remise_percent != 100";
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE total_ttc = 0 AND remise_percent != 100";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) if ($num)
{ {
$obj = $db->fetch_object($resql); while ($i < $num)
$facture = new Facture($db);
$facture->id=$obj->rowid;
if ( $facture->fetch($facture->id) >= 0)
{ {
if ( $facture->update_price($facture->id) > 0 ) $obj = $db->fetch_object($resql);
$rowid = $obj->rowid;
$qty = $obj->qty;
$pu = $obj->subprice;
$txtva = $obj->tva_taux;
$remise_percent = $obj->remise_percent;
$remise_percent_global = $obj->remise_percent_global;
// On met a jour les 3 nouveaux champs
$facligne= new FactureLigne($db);
$facligne->fetch($rowid);
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global);
$total_ht = $result[0];
$total_tva = $result[1];
$total_ttc = $result[2];
$facligne->total_ht = $total_ht;
$facligne->total_tva = $total_tva;
$facligne->total_ttc = $total_ttc;
dolibarr_install_syslog("Line $rowid: facid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
print ". ";
// $facligne->update($rowid);
/* On touche pas a facture mere
$facture = new Facture($db);
$facture->id=$obj->facid;
if ( $facture->fetch($facture->id) >= 0)
{ {
print ". "; if ( $facture->update_price($facture->id) > 0 )
{
print ". ";
}
else
{
print "Error id=".$facture->id;
$err++;
}
} }
else else
{ {
print "Error id=".$facture->id; print "Error #3";
$err++; $err++;
} }
*/
$i++;
} }
else }
{ else
print "Erreur #3"; {
$err++; print $langs->trans("AlreadyDone");
}
$i++;
} }
$db->free(); $db->free();
$db->rollback();
} }
else else
{ {
print "Erreur #1"; print "Error #1 ".$db->error();
$err++; $err++;
$db->rollback();
} }
print '<br>'; print '<br>';
} }
} }
/* /*
* Mise a jour des totaux propal * Mise a jour des totaux lignes de propal
*/ */
function migrate_price_propal($db,$langs,$conf) function migrate_price_propal($db,$langs,$conf)
{ {
if ($conf->propal->enabled) if ($conf->propal->enabled)
{ {
$db->begin();
dolibarr_install_syslog("Upgrade data for propal");
print '<br>'; print '<br>';
print '<b>'.$langs->trans('MigrationProposal')."</b><br>\n"; print '<b>'.$langs->trans('MigrationProposal')."</b><br>\n";
// TODO Ajout requete remplissage champ total_ht, totam_tva, total_ttc // Liste des lignes propal non a jour
// dans table det $sql = "SELECT pd.rowid, pd.qty, pd.subprice, pd.remise_percent, pd.tva_tx as tva_taux, ";
$sql.= " p.rowid as propalid, p.remise_percent as remise_percent_global";
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as pd, ".MAIN_DB_PREFIX."propal as p";
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."propal"; $sql.= " WHERE pd.fk_propal = p.rowid";
$sql.= " WHERE total = 0 AND remise_percent != 100"; $sql.= " AND (pd.total_ttc = 0 or pd.total_ttc IS NULL) AND pd.remise_percent != 100";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) if ($num)
{ {
$obj = $db->fetch_object($resql); while ($i < $num)
$propal = new Propal($db);
$propal->id=$obj->rowid;
if ( $propal->fetch($propal->id) >= 0 )
{ {
if ( $propal->update_price($propal->id) > 0 ) $obj = $db->fetch_object($resql);
$rowid = $obj->rowid;
$qty = $obj->qty;
$pu = $obj->subprice;
$txtva = $obj->tva_taux;
$remise_percent = $obj->remise_percent;
$remise_percent_global = $obj->remise_percent_global;
// On met a jour les 3 nouveaux champs
$propalligne= new PropaleLigne($db);
$propalligne->fetch($rowid);
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global);
$total_ht = $result[0];
$total_tva = $result[1];
$total_ttc = $result[2];
$propalligne->total_ht = $total_ht;
$propalligne->total_tva = $total_tva;
$propalligne->total_ttc = $total_ttc;
dolibarr_install_syslog("Line $rowid: propalid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
print ". ";
// $propalligne->update($rowid);
/* On touche pas a propal mere
$propal = new Propal($db);
$propal->id=$obj->rowid;
if ( $propal->fetch($propal->id) >= 0 )
{ {
print ". "; if ( $propal->update_price($propal->id) > 0 )
{
print ". ";
}
else
{
print "Error id=".$propal->id;
$err++;
}
} }
else else
{ {
print "Error id=".$propal->id; print "Error #3";
$err++; $err++;
} }
*/
$i++;
} }
else
{
print "Erreur #3";
$err++;
}
$i++;
} }
else
{
print $langs->trans("AlreadyDone");
}
$db->free(); $db->free();
$db->rollback();
} }
else else
{ {
print "Erreur #1"; print "Error #1 ".$db->error();
$err++; $err++;
$db->rollback();
} }
print '<br>'; print '<br>';
@@ -716,58 +804,99 @@ function migrate_price_propal($db,$langs,$conf)
/* /*
* Mise a jour des totaux commande * Mise a jour des totaux lignes de commande
*/ */
function migrate_price_commande($db,$langs,$conf) function migrate_price_commande($db,$langs,$conf)
{ {
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
$db->begin();
dolibarr_install_syslog("Upgrade data for order");
print '<br>'; print '<br>';
print '<b>'.$langs->trans('MigrationOrder')."</b><br>\n"; print '<b>'.$langs->trans('MigrationOrder')."</b><br>\n";
// TODO Ajout requete remplissage champ total_ht, totam_tva, total_ttc // Liste des lignes commande non a jour
// dans table det $sql = "SELECT cd.rowid, cd.qty, cd.subprice, cd.remise_percent, cd.tva_tx as tva_taux, ";
$sql.= " c.rowid as commandeid, c.remise_percent as remise_percent_global";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."commande as c";
$sql.= " WHERE cd.fk_commande = c.rowid";
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande"; $sql.= " AND (cd.total_ttc = 0 or cd.total_ttc IS NULL) AND cd.remise_percent != 100";
$sql.= " WHERE total_ttc = 0 AND remise_percent != 100";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) if ($num)
{ {
$obj = $db->fetch_object($resql); while ($i < $num)
$commande = new Commande($db);
$commande->id = $obj->rowid;
if ( $commande->fetch($commande->id) >= 0 )
{ {
if ( $commande->update_price($commande->id) > 0 ) $obj = $db->fetch_object($resql);
$rowid = $obj->rowid;
$qty = $obj->qty;
$pu = $obj->subprice;
$txtva = $obj->tva_taux;
$remise_percent = $obj->remise_percent;
$remise_percent_global = $obj->remise_percent_global;
// On met a jour les 3 nouveaux champs
$commandeligne= new CommandeLigne($db);
$commandeligne->fetch($rowid);
$result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global);
$total_ht = $result[0];
$total_tva = $result[1];
$total_ttc = $result[2];
$commandeligne->total_ht = $total_ht;
$commandeligne->total_tva = $total_tva;
$commandeligne->total_ttc = $total_ttc;
dolibarr_install_syslog("Line $rowid: commandeid=$obj->facid pu=$pu qty=$qty tva_taux=$txtva remise_percent=$remise_percent remise_global=$remise_percent_global -> $total_ht, $total_tva, $total_ttc");
print ". ";
// $commandeligne->update($rowid);
/* On touche pas a facture mere
$commande = new Commande($db);
$commande->id = $obj->rowid;
if ( $commande->fetch($commande->id) >= 0 )
{ {
print ". "; if ( $commande->update_price($commande->id) > 0 )
{
print ". ";
}
else
{
print "Error id=".$commande->id;
$err++;
}
} }
else else
{ {
print "Error id=".$commande->id; print "Error #3";
$err++; $err++;
} }
*/
$i++;
} }
else
{
print "Erreur #3";
$err++;
}
$i++;
} }
else
{
print $langs->trans("AlreadyDone");
}
$db->free(); $db->free();
$db->rollback();
} }
else else
{ {
print "Erreur #1"; print "Error #1 ".$db->error();
$err++; $err++;
$db->rollback();
} }
print '<br>'; print '<br>';

View File

@@ -9,6 +9,12 @@ ConfFileDoesNotExists=Configuration file <b>%s</b> does not exist !
ErrorDirDoesNotExists=Directory %s does not exists. ErrorDirDoesNotExists=Directory %s does not exists.
ErrorGoBackAndCorrectParameters=Go backward and correct wrong parameters. ErrorGoBackAndCorrectParameters=Go backward and correct wrong parameters.
ErrorWrongValueForParameter=You may have typed a wrong value for parameter '%s'. ErrorWrongValueForParameter=You may have typed a wrong value for parameter '%s'.
ErrorFaileToCreateDatabase=Failed to create database '%'.
ErrorFaileToConnectToDatabase=Failed to connect to database '%'.
MigrationOrder=Data migration for customers' orders
MigrationProposal=Data migration for commercial proposals
MigrationInvoice=Data migration for customers' invoices
MigrationContract=Data migration for contracts
YouCanContinue=You can continue... YouCanContinue=You can continue...
License=Using license License=Using license
ConfigurationFile=Configuration file ConfigurationFile=Configuration file

View File

@@ -23,12 +23,14 @@ ErrorYourCountryIsNotDefined=Your country is not defined. Go to Home-Setup-Edit
ErrorRecordIsUsedByChild=Failed to delete this record. This record is used by at least on child records. ErrorRecordIsUsedByChild=Failed to delete this record. This record is used by at least on child records.
ErrorWrongValue=Wrong value ErrorWrongValue=Wrong value
ErrorWrongValueForParameterX=Wrong value for parameter %s ErrorWrongValueForParameterX=Wrong value for parameter %s
ErrorNoRequestInError=No request in error
SeeAbove=See above SeeAbove=See above
HomeArea=Home area HomeArea=Home area
LastAccess=Last access LastAccess=Last access
RequestedUrl=Requested Url RequestedUrl=Requested Url
DatabaseTypeManager=Database type manager DatabaseTypeManager=Database type manager
RequestLastAccess=Request for last database access RequestLastAccess=Request for last database access
RequestLastAccessInError=Request for last database access in error
ReturnCodeLastAccess=Return code for last database access ReturnCodeLastAccess=Return code for last database access
InformationLastAccess=Information for last database access InformationLastAccess=Information for last database access
DolibarrHasDetectedError=Dolibarr has detected a technical error DolibarrHasDetectedError=Dolibarr has detected a technical error

View File

@@ -9,6 +9,12 @@ ConfFileIsWritable=Le fichier <b>%s</b> est modifiable.
ErrorDirDoesNotExists=Le r<>pertoire <b>%s</b> n'existe pas ou n'est pas accessible. ErrorDirDoesNotExists=Le r<>pertoire <b>%s</b> n'existe pas ou n'est pas accessible.
ErrorGoBackAndCorrectParameters=Revenez en arri<72>re et corrigez les param<61>tres invalides. ErrorGoBackAndCorrectParameters=Revenez en arri<72>re et corrigez les param<61>tres invalides.
ErrorWrongValueForParameter=Vous avez peut-<2D>tre saisi une mauvaise valeur pour le param<61>tre '%s'. ErrorWrongValueForParameter=Vous avez peut-<2D>tre saisi une mauvaise valeur pour le param<61>tre '%s'.
ErrorFaileToCreateDatabase=Echec de cr<63>ation de la base '%'.
ErrorFaileToConnectToDatabase=Echec de connection <20> la base '%'.
MigrationOrder=Migration de donn<6E>es sur les commandes clients
MigrationProposal=Migration de donn<6E>es sur les propositions commerciales
MigrationInvoice=Migration de donn<6E>es sur les factures clients
MigrationContract=Migration de donn<6E>es sur les contrats
YouCanContinue=Vous pouvez continuer... YouCanContinue=Vous pouvez continuer...
License=Licence d'utilisation License=Licence d'utilisation
ConfigurationFile=Fichier de configuration ConfigurationFile=Fichier de configuration

View File

@@ -23,12 +23,14 @@ ErrorYourCountryIsNotDefined=Votre pays n'est pas d
ErrorRecordIsUsedByChild=Impossible de supprimer cet enregistrement. Ce dernier est utilis<69> en tant que p<>re par au moins un enregistrement fils. ErrorRecordIsUsedByChild=Impossible de supprimer cet enregistrement. Ce dernier est utilis<69> en tant que p<>re par au moins un enregistrement fils.
ErrorWrongValue=Valeur incorrecte ErrorWrongValue=Valeur incorrecte
ErrorWrongValueForParameterX=Valeur incorrecte pour le param<61>tre %s ErrorWrongValueForParameterX=Valeur incorrecte pour le param<61>tre %s
ErrorNoRequestInError=Aucune requete en erreur
SeeAbove=Voir ci-dessus SeeAbove=Voir ci-dessus
HomeArea=Espace accueil HomeArea=Espace accueil
LastAccess=Derni<6E>re connexion LastAccess=Derni<6E>re connexion
RequestedUrl=Url sollicit<69>e RequestedUrl=Url sollicit<69>e
DatabaseTypeManager=Type gestionnaire de base de donn<6E>e DatabaseTypeManager=Type gestionnaire de base de donn<6E>e
RequestLastAccess=Requete dernier acces en base RequestLastAccess=Requete dernier acces en base
RequestLastAccessInError=Requete dernier acces en base en erreur
ReturnCodeLastAccess=Code retour dernier acces en base ReturnCodeLastAccess=Code retour dernier acces en base
InformationLastAccess=Information sur le dernier acc<63>s en base InformationLastAccess=Information sur le dernier acc<63>s en base
DolibarrHasDetectedError=Dolibarr a d<>tect<63> une erreur technique DolibarrHasDetectedError=Dolibarr a d<>tect<63> une erreur technique

View File

@@ -1131,14 +1131,14 @@ function dolibarr_print_error($db='',$msg='')
{ {
print "<br>\n"; print "<br>\n";
print "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n"; print "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n";
print "<b>".$langs->trans("RequestLastAccess").":</b> ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."<br>\n"; print "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."<br>\n";
print "<b>".$langs->trans("ReturnCodeLastAccess").":</b> ".$db->errno()."<br>\n"; print "<b>".$langs->trans("ReturnCodeLastAccess").":</b> ".$db->errno()."<br>\n";
print "<b>".$langs->trans("InformationLastAccess").":</b> ".$db->error()."<br>\n"; print "<b>".$langs->trans("InformationLastAccess").":</b> ".$db->error()."<br>\n";
} }
else // Mode CLI else // Mode CLI
{ {
print $langs->trans("DatabaseTypeManager").":\n".$db->type."\n"; print $langs->trans("DatabaseTypeManager").":\n".$db->type."\n";
print $langs->trans("RequestLastAccess").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n"; print $langs->trans("RequestLastAccessInError").":\n".($db->lastqueryerror()?$db->lastqueryerror():$langs->trans("ErrorNoRequestInError"))."\n";
print $langs->trans("ReturnCodeLastAccess").":\n".$db->errno()."\n"; print $langs->trans("ReturnCodeLastAccess").":\n".$db->errno()."\n";
print $langs->trans("InformationLastAccess").":\n".$db->error()."\n"; print $langs->trans("InformationLastAccess").":\n".$db->error()."\n";

View File

@@ -2325,9 +2325,53 @@ class PropaleLigne
var $product_desc; // Description produit var $product_desc; // Description produit
var $ref; // Reference produit var $ref; // Reference produit
function PropaleLigne()
{ /**
} * \brief Constructeur d'objets ligne de propal
* \param DB handler d'acc<63>s base de donn<6E>e
*/
function PropaleLigne($DB)
{
$this->db= $DB ;
}
/**
* \brief Recup<75>re l'objet ligne de propal
* \param rowid id de la ligne de propal
*/
function fetch($rowid)
{
$sql = 'SELECT fk_propal, fk_product, description, price, qty, rowid, tva_tx,';
$sql.= ' remise, remise_percent, fk_remise_except, subprice,';
$sql.= ' info_bits, total_ht, total_tva, total_ttc, coef, rang';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet WHERE rowid = '.$rowid;
$result = $this->db->query($sql);
if ($result)
{
$objp = $this->db->fetch_object($result);
$this->fk_propal = $objp->fk_propal;
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->price = $objp->price;
$this->subprice = $objp->subprice;
$this->tva_taux = $objp->tva_taux;
$this->remise = $objp->remise;
$this->remise_percent = $objp->remise_percent;
$this->fk_remise_except = $objp->fk_remise_except;
$this->produit_id = $objp->fk_product;
$this->info_bits = $objp->info_bits;
$this->total_ht = $objp->total_ht;
$this->total_tva = $objp->total_tva;
$this->total_ttc = $objp->total_ttc;
$this->coef = $objp->coef;
$this->rang = $objp->rang;
$this->db->free($result);
}
else
{
dolibarr_print_error($this->db);
}
}
} }
?> ?>