Bugfix sur l'insertion dans la tables de communications

This commit is contained in:
Rodolphe Quiedeville 2005-07-29 12:30:40 +00:00
parent aec85febe8
commit e819f1ebee

View File

@ -496,19 +496,21 @@ function calcul($db, $ligne, $facture_id, &$total_cout_achat, &$total_cout_vente
$sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr as t"; $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_import_cdr as t";
$sql .= " WHERE t.fk_ligne = ".$ligne->id; $sql .= " WHERE t.fk_ligne = ".$ligne->id;
if ( $db->query($sql) ) $resql = $db->query($sql);
if ($resql)
{ {
$num_sql = $db->num_rows(); $num_sql = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num_sql && $error == 0) while ($i < $num_sql && $error == 0)
{ {
$objp = $db->fetch_object($i); $objp = $db->fetch_object($resql);
$comm = new CommunicationTelephonique(); $comm = new CommunicationTelephonique();
$comm->index = $objp->idx; $comm->index = $objp->idx;
$comm->fk_ligne = $facture_id; $comm->fk_ligne = $objp->fk_ligne;
$comm->ligne = $objp->ligne; $comm->ligne = $objp->ligne;
$comm->date = $objp->date; $comm->date = $objp->date;
$comm->heure = $objp->heure; $comm->heure = $objp->heure;
@ -525,7 +527,7 @@ function calcul($db, $ligne, $facture_id, &$total_cout_achat, &$total_cout_vente
$i++; $i++;
} }
$db->free(); $db->free($resql);
} }
else else
{ {