Fix: Corrige pb envoi propal par mail.

This commit is contained in:
Laurent Destailleur 2005-06-25 13:38:28 +00:00
parent 47ae0fffb9
commit 3acef1fd50
2 changed files with 136 additions and 133 deletions

View File

@ -214,6 +214,7 @@ class FormMail
if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; } if ($this->param["models"]=='body') { $defaultmessage=$this->withbody; }
if ($this->param["models"]=='facture_send') { $defaultmessage="Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n"; } if ($this->param["models"]=='facture_send') { $defaultmessage="Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n"; }
if ($this->param["models"]=='facture_relance') { $defaultmessage="Nous apportons à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n"; } if ($this->param["models"]=='facture_relance') { $defaultmessage="Nous apportons à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n"; }
if ($this->param["models"]=='propal_send') { $defaultmessage="Veuillez trouver ci-joint la proposition commercial __PROPREF__\n\nCordialement\n\n"; }
$defaultmessage=$this->make_substitutions($defaultmessage); $defaultmessage=$this->make_substitutions($defaultmessage);

View File

@ -354,23 +354,23 @@ class Propal
* \brief Recupère de la base les caractéristiques d'une propale * \brief Recupère de la base les caractéristiques d'une propale
* \param rowid id de la propal à récupérer * \param rowid id de la propal à récupérer
*/ */
function fetch($rowid) function fetch($rowid)
{ {
$sql = "SELECT ref,total,price,remise,tva,fk_soc,fk_soc_contact,".$this->db->pdate("datep")."as dp,".$this->db->pdate("fin_validite")."as dfv, model_pdf, note, fk_projet, fk_statut, remise_percent, fk_user_author"; $sql = "SELECT ref,total,price,remise,tva,fk_soc,fk_soc_contact,".$this->db->pdate("datep")."as dp,".$this->db->pdate("fin_validite")."as dfv, model_pdf, note, fk_projet, fk_statut, remise_percent, fk_user_author";
$sql .= ", c.label as statut_label"; $sql .= ", c.label as statut_label";
$sql .= " FROM ".MAIN_DB_PREFIX."propal"; $sql .= " FROM ".MAIN_DB_PREFIX."propal";
$sql .= "," . MAIN_DB_PREFIX."c_propalst as c"; $sql .= "," . MAIN_DB_PREFIX."c_propalst as c";
$sql .= " WHERE rowid=$rowid AND fk_statut = c.id"; $sql .= " WHERE rowid=$rowid AND fk_statut = c.id";
if ($this->db->query($sql) ) $resql=$this->db->query($sql);
if ($resql)
{ {
if ($this->db->num_rows()) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object(); $obj = $this->db->fetch_object($resql);
$this->id = $rowid; $this->id = $rowid;
$this->datep = $obj->dp; $this->datep = $obj->dp;
$this->fin_validite = $obj->dfv; $this->fin_validite = $obj->dfv;
$this->date = $obj->dp; $this->date = $obj->dp;
@ -414,12 +414,12 @@ class Propal
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows(); $num = $this->db->num_rows($result);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$objp = $this->db->fetch_object(); $objp = $this->db->fetch_object($result);
$ligne = new PropaleLigne(); $ligne = new PropaleLigne();
$ligne->libelle = stripslashes($objp->label); $ligne->libelle = stripslashes($objp->label);
@ -435,15 +435,16 @@ class Propal
$this->lignes[$i] = $ligne; $this->lignes[$i] = $ligne;
$i++; $i++;
} }
$this->db->free(); $this->db->free($result);
} }
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return -1;
} }
/* /*
* Lignes génériques * Lignes propales
*/ */
$sql = "SELECT d.qty, d.description, d.price, d.subprice, d.tva_tx, d.rowid, d.remise_percent"; $sql = "SELECT d.qty, d.description, d.price, d.subprice, d.tva_tx, d.rowid, d.remise_percent";
$sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d"; $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as d";
@ -452,12 +453,12 @@ class Propal
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$num = $this->db->num_rows(); $num = $this->db->num_rows($result);
$j = 0; $j = 0;
while ($j < $num) while ($j < $num)
{ {
$objp = $this->db->fetch_object(); $objp = $this->db->fetch_object($result);
$ligne = new PropaleLigne(); $ligne = new PropaleLigne();
$ligne->libelle = stripslashes($objp->description); $ligne->libelle = stripslashes($objp->description);
$ligne->desc = stripslashes($objp->description); $ligne->desc = stripslashes($objp->description);
@ -474,11 +475,12 @@ class Propal
$j++; $j++;
} }
$this->db->free(); $this->db->free($result);
} }
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return -1;
} }
} }
return 1; return 1;
@ -486,7 +488,7 @@ class Propal
else else
{ {
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return 0; return -1;
} }
} }